diff --git a/.travis.yml b/.travis.yml index 76df6b5..0cf6409 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ php: - 7.3 - 7.4 - 8.0 + - 8.1 - nightly env: matrix: diff --git a/src/Html/Form.php b/src/Html/Form.php index 55aa85d..02dec2c 100644 --- a/src/Html/Form.php +++ b/src/Html/Form.php @@ -2,18 +2,18 @@ namespace Ubirak\RestApiBehatExtension\Html; -class Form +class Form { private $body = []; - + private $contentTypeHeaderValue = ''; - public function __construct(array $body) + public function __construct(array $body) { $this->body = $body; } - public function getBody() + public function getBody() { if ($this->bodyHasFileObject()) { return $this->getMultipartStreamBody(); @@ -23,28 +23,28 @@ public function getBody() } /** - * + * * @return string */ - public function getContentTypeHeaderValue() + public function getContentTypeHeaderValue() { return $this->contentTypeHeaderValue; } /** - * + * * @param string $value */ - private function setContentTypeHeaderValue($value) + private function setContentTypeHeaderValue($value) { $this->contentTypeHeaderValue = $value; } /** - * + * * @return boolean */ - private function bodyHasFileObject() + private function bodyHasFileObject() { foreach ($this->body as $element) { if ($element['object'] == 'file') { @@ -56,10 +56,10 @@ private function bodyHasFileObject() } /** - * + * * @return \GuzzleHttp\Psr7\MultipartStream */ - private function getMultipartStreamBody() + private function getMultipartStreamBody() { $multiparts = array_map( function ($element) { @@ -80,10 +80,10 @@ function ($element) { } /** - * + * * @return string */ - private function getNameValuePairBody() + private function getNameValuePairBody() { $body = []; foreach ($this->body as $element) { @@ -92,7 +92,7 @@ private function getNameValuePairBody() $this->setContentTypeHeaderValue('application/x-www-form-urlencoded'); - return http_build_query($body, null, '&'); + return http_build_query($body); } } diff --git a/src/Json/JsonContext.php b/src/Json/JsonContext.php index b0ff783..1324049 100644 --- a/src/Json/JsonContext.php +++ b/src/Json/JsonContext.php @@ -19,7 +19,11 @@ public function __construct(JsonInspector $jsonInspector, $jsonSchemaBaseUrl = n { $this->jsonInspector = $jsonInspector; $this->asserter = new asserter(); - $this->jsonSchemaBaseUrl = rtrim((string) $jsonSchemaBaseUrl, '/'); + + if (null !== $jsonSchemaBaseUrl) { + $jsonSchemaBaseUrl = rtrim($jsonSchemaBaseUrl, '/'); + } + $this->jsonSchemaBaseUrl = $jsonSchemaBaseUrl; } /**