2016-08-25 13:27:14 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types = 1);
|
|
|
|
|
|
|
|
namespace LanguageServer;
|
|
|
|
|
|
|
|
class ProtocolStreamWriter implements ProtocolWriter
|
|
|
|
{
|
|
|
|
private $output;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param resource $output
|
|
|
|
*/
|
|
|
|
public function __construct($output)
|
|
|
|
{
|
|
|
|
$this->output = $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends a Message to the client
|
|
|
|
*
|
|
|
|
* @param Message $msg
|
|
|
|
* @return void
|
|
|
|
*/
|
2016-08-25 15:01:29 +00:00
|
|
|
public function write(Message $msg)
|
2016-08-25 13:27:14 +00:00
|
|
|
{
|
|
|
|
fwrite($this->output, (string)$msg);
|
|
|
|
}
|
|
|
|
}
|