22
33namespace Ubirak \RestApiBehatExtension \Html ;
44
5- class Form
5+ class Form
66{
77 private $ body = [];
8-
8+
99 private $ contentTypeHeaderValue = '' ;
1010
11- public function __construct (array $ body )
11+ public function __construct (array $ body )
1212 {
1313 $ this ->body = $ body ;
1414 }
1515
16- public function getBody ()
16+ public function getBody ()
1717 {
1818 if ($ this ->bodyHasFileObject ()) {
1919 return $ this ->getMultipartStreamBody ();
@@ -23,28 +23,28 @@ public function getBody()
2323 }
2424
2525 /**
26- *
26+ *
2727 * @return string
2828 */
29- public function getContentTypeHeaderValue ()
29+ public function getContentTypeHeaderValue ()
3030 {
3131 return $ this ->contentTypeHeaderValue ;
3232 }
3333
3434 /**
35- *
35+ *
3636 * @param string $value
3737 */
38- private function setContentTypeHeaderValue ($ value )
38+ private function setContentTypeHeaderValue ($ value )
3939 {
4040 $ this ->contentTypeHeaderValue = $ value ;
4141 }
4242
4343 /**
44- *
44+ *
4545 * @return boolean
4646 */
47- private function bodyHasFileObject ()
47+ private function bodyHasFileObject ()
4848 {
4949 foreach ($ this ->body as $ element ) {
5050 if ($ element ['object ' ] == 'file ' ) {
@@ -56,10 +56,10 @@ private function bodyHasFileObject()
5656 }
5757
5858 /**
59- *
59+ *
6060 * @return \GuzzleHttp\Psr7\MultipartStream
6161 */
62- private function getMultipartStreamBody ()
62+ private function getMultipartStreamBody ()
6363 {
6464 $ multiparts = array_map (
6565 function ($ element ) {
@@ -80,10 +80,10 @@ function ($element) {
8080 }
8181
8282 /**
83- *
83+ *
8484 * @return string
8585 */
86- private function getNameValuePairBody ()
86+ private function getNameValuePairBody ()
8787 {
8888 $ body = [];
8989 foreach ($ this ->body as $ element ) {
@@ -92,7 +92,7 @@ private function getNameValuePairBody()
9292
9393 $ this ->setContentTypeHeaderValue ('application/x-www-form-urlencoded ' );
9494
95- return http_build_query ($ body, null , ' & ' );
95+ return http_build_query ($ body);
9696 }
9797
9898}
0 commit comments