for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Atog\Api;
use Symfony\Component\HttpFoundation\Response;
/**
* Abstract Class Endpoint
* @package Atog\Api
*/
abstract class Endpoint
{
* @var \Atog\Api\Client
protected $client;
* @var \Atog\Api\Model
protected $model;
* @var string
protected $endpoint;
* Endpoint constructor.
* @param \Atog\Api\Client $client
* @param \Atog\Api\Model $model
public function __construct(Client $client, Model $model)
$this->client = $client;
$this->model = $model;
}
* @return \Atog\Api\Model
public function getModel()
return $this->model;
* Get the endpoint url for the request
* @param string $path
* @param bool $withTrailingSlash
* @return string
public function getEndpointUrl($path, $withTrailingSlash)
$url = $this->endpoint . '/' . $path;
if ($withTrailingSlash) {
$url = $url . '/';
return $url;
* @param \Symfony\Component\HttpFoundation\Response $response
* @return \Atog\Api\Model|null
public function respond(Response $response)
// return new model instance with fetched content if response is okay
if ($response->isOk()) {
return $this->model->newInstance($response->getContent());
$response->getContent()
string
array
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
return null;
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: