for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace seregazhuk\SmsIntel\Api\Requests;
use seregazhuk\SmsIntel\Contracts\HttpInterface;
use seregazhuk\SmsIntel\Contracts\RequestInterface;
abstract class Request implements RequestInterface
{
static public $allowedMethod = [];
/**
* @var HttpInterface
*/
protected $client;
* @var string
protected $login;
protected $password;
public function __construct(HttpInterface $http)
$this->client = $http;
}
* @param string $login
* @param string $password
* @return $this
public function setCredentials($login, $password)
$this->login = $login;
$this->password = $password;
return $this;
* Make the request to API
*
* @param string $action
* @param array $params
* @return array|null
public function exec($action, $params = [])
$endPoint = $this->makeEndPoint($action);
$requestBody = $this->createRequestBody($params);
$response = $this->client->post($endPoint, $requestBody);
$requestBody
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 $this->parseResponse($response);
$response
* @return string
protected function createRequestBody(array $params)
$params = array_merge(
[
'login' => $this->login,
'password' => $this->password,
],
$params
);
return $this->formatRequestBody($params);
* @param array $requestBody
* @return mixed
abstract protected function formatRequestBody(array $requestBody);
* @param string $response
* @return array
abstract protected function parseResponse($response);
abstract public function makeEndPoint($action);
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: