Skip to content

Commit

Permalink
Merge pull request #107 from gmorel/feature/php8.1
Browse files Browse the repository at this point in the history
Introduce PHP 8.1
  • Loading branch information
stephpy authored Apr 25, 2022
2 parents 0068a24 + dfd3db3 commit 877ae68
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ php:
- 7.3
- 7.4
- 8.0
- 8.1
- nightly
env:
matrix:
Expand Down
30 changes: 15 additions & 15 deletions src/Html/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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') {
Expand All @@ -56,10 +56,10 @@ private function bodyHasFileObject()
}

/**
*
*
* @return \GuzzleHttp\Psr7\MultipartStream
*/
private function getMultipartStreamBody()
private function getMultipartStreamBody()
{
$multiparts = array_map(
function ($element) {
Expand All @@ -80,10 +80,10 @@ function ($element) {
}

/**
*
*
* @return string
*/
private function getNameValuePairBody()
private function getNameValuePairBody()
{
$body = [];
foreach ($this->body as $element) {
Expand All @@ -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);
}

}
6 changes: 5 additions & 1 deletion src/Json/JsonContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 877ae68

Please sign in to comment.