for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Dazzle\Http;
use Dazzle\Socket\SocketInterface;
class NetworkConnection implements NetworkConnectionInterface
{
/**
* @var SocketInterface
*/
protected $conn;
* @param SocketInterface $conn
public function __construct(SocketInterface $conn)
$this->conn = $conn;
}
*
public function __destruct()
unset($this->conn);
* @override
* @inheritDoc
public function getResourceId()
return $this->conn->getResourceId();
public function getEndpoint()
return $this->conn->getRemoteEndpoint();
public function getAddress()
return $this->conn->getRemoteAddress();
public function getHost()
$address = explode(':', $this->getAddress());
return $address[0];
public function getPort()
return $address[1];
public function send($data)
$this->conn->write((string)$data);
public function close()
$this->conn->close();