Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
env:
global:
- TEST_COMMAND="composer test"
Expand Down
4 changes: 2 additions & 2 deletions src/Api/HttpApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ protected function hydrateResponse(ResponseInterface $response, $class)
return $response;
}

if ($response->getStatusCode() === 204) {
if (204 === $response->getStatusCode()) {
return null;
}

if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
if (200 !== $response->getStatusCode() && 201 !== $response->getStatusCode()) {
$this->handleErrors($response);
}

Expand Down
1 change: 1 addition & 0 deletions src/Api/UserManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function update($user, $param)

return $this->hydrateResponse($response, User::class);
}

/**
* @param string $user the user ID we should merge personality data to.
* @param string $from the user ID we should merge personality data from.
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/Domain/HttpClientException.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct($message, $code, ResponseInterface $response = null)
if ($response) {
$this->response = $response;
$body = $response->getBody()->__toString();
if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
if (0 !== strpos($response->getHeaderLine('Content-Type'), 'application/json')) {
$this->responseBody['message'] = $body;
} else {
$this->responseBody = json_decode($body, true);
Expand Down
2 changes: 1 addition & 1 deletion src/Hydrator/ArrayHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class ArrayHydrator implements Hydrator
public function hydrate(ResponseInterface $response, $class)
{
$body = $response->getBody()->__toString();
if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
if (0 !== strpos($response->getHeaderLine('Content-Type'), 'application/json')) {
throw new HydrationException('The ArrayHydrator cannot hydrate response with Content-Type:'.$response->getHeaderLine('Content-Type'));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Hydrator/ModelHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class ModelHydrator implements Hydrator
public function hydrate(ResponseInterface $response, $class)
{
$body = $response->getBody()->__toString();
if (strpos($response->getHeaderLine('Content-Type'), 'application/json') !== 0) {
if (0 !== strpos($response->getHeaderLine('Content-Type'), 'application/json')) {
throw new HydrationException('The ModelHydrator cannot hydrate response with Content-Type:'.$response->getHeaderLine('Content-Type'));
}

Expand Down
3 changes: 3 additions & 0 deletions src/Model/Statement/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
final class Statement implements CreatableFromArray
{
const TYPE_STRING = 'string';

const TYPE_IMAGE = 'image';

const SECTION_PERSONALITY = 'personality';

const SECTION_INTELLIGENCE = 'intelligence';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Model/UserManagement/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function createFromArray(array $data)
{
$data = $data['data'];

return new self(isset($data['name']) ? $data['name']: '', $data['email']);
return new self(isset($data['name']) ? $data['name'] : '', $data['email']);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/HttpClientConfiguratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
use Happyr\ApiClient\HttpClientConfigurator;
use Http\Client\Common\Plugin\HeaderAppendPlugin;
use Nyholm\NSA;
use PHPUnit\Framework\TestCase;

final class HttpClientConfiguratorTest extends \PHPUnit_Framework_TestCase
final class HttpClientConfiguratorTest extends TestCase
{
public function testAppendPlugin()
{
Expand Down