for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace nstdio\notymo;
use nstdio\notymo\exception\ConnectionException;
/**
* Class CurlWrapper
*
* @package nstdio\notymo
* @author Edgar Asatryan <[email protected]>
*/
class CurlWrapper implements Connection
{
* @var resource
private $stream;
* @inheritdoc
public function open(array $params, $socketAddress)
$this->stream = curl_init($socketAddress);
curl_setopt_array($this->stream, $params);
return $this;
}
public function write($option, $string)
curl_setopt($this->stream, $option, $string);
public function close()
if (is_resource($this->stream)) {
curl_close($this->stream);
public function read()
$response = curl_exec($this->stream);
if ($response === false) {
throw new ConnectionException(curl_error($this->stream), curl_errno($this->stream));
return $response;