for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* HTTP Encoder
* User: moyo
* Date: 08/01/2018
* Time: 4:04 PM
*/
namespace Carno\HTTP\Powered\Native\Parser;
use Psr\Http\Message\ResponseInterface;
class Responding
{
private const LENGTH = 'Content-length';
* @var string
private $socket = null;
* Encoder constructor.
* @param Protocol $socket
public function __construct(Protocol $socket)
$this->socket = $socket;
$socket
Carno\HTTP\Powered\Native\Parser\Protocol
string
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
}
* @param ResponseInterface $response
public function makeResponse(ResponseInterface $response) : void
$lines[] = sprintf(
$lines
$lines = array();
'HTTP/%s %d %s',
$response->getProtocolVersion(),
$response->getStatusCode(),
$response->getReasonPhrase()
);
if (!$response->hasHeader(self::LENGTH)) {
$response->withHeader(self::LENGTH, $response->getBody()->getSize());
foreach ($response->getHeaders() as $name => $values) {
$lines[] = sprintf('%s: %s', $name, implode(',', $values));
$this->socket->write(implode(Protocol::CRLF, $lines).Protocol::SPLIT);
if ($response->getBody()->getSize() > 0) {
$this->socket->write((string)$response->getBody());
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..