for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: Lombardo
* Date: 27/12/16
* Time: 16:35
*/
namespace AsyncHttpClient\Service;
use React\HttpClient\Response;
class AsyncHttpGenericService implements AsyncHttpService
{
* @var string
private $method;
private $url;
private $content;
* @var callable
private $callback;
public function __construct($method, $url, $content, callable $callback = null)
$this->method = $method;
$this->url = $url;
$this->content = $content;
$this->callback = $callback;
}
* @return string
public function getMethod()
return $this->method;
public function getUrl()
return $this->url;
string|null
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
public function getContent()
if ($this->getMethod() == 'POST') {
return $this->content;
return null;
* @return array
public function getHeaders()
if ($this->getMethod() == 'POST')
return [
'Content-Length' => strlen($this->getContent()),
'Content-Type' => 'application/x-www-form-urlencoded'
];
return [];
* @param $data
* @param Response $response
*
* @return void
public function execute($data, Response $response)
if (!is_null($this->callback)) {
$callback = $this->callback;
$callback($data, $response);
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.