Skip to content

Commit 81c0a78

Browse files
committed
Made Communicator compatible with the latest Transmitter.
1 parent 06c299e commit 81c0a78

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/PEAR2/Net/RouterOS/Communicator.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Communicator
8282
protected $charsets = array();
8383

8484
/**
85-
* @var SocketClientTransmitter The transmitter for the connection.
85+
* @var TcpClient The transmitter for the connection.
8686
*/
8787
protected $trans;
8888

@@ -104,7 +104,7 @@ class Communicator
104104
public function __construct($host, $port = 8728, $persist = false,
105105
$timeout = null, $key = '', $context = null
106106
) {
107-
$this->trans = new T\SocketClientTransmitter(
107+
$this->trans = new T\TcpClient(
108108
$host, $port, $persist, $timeout, $key, $context
109109
);
110110
$this->setCharset(
@@ -140,7 +140,7 @@ public function __invoke($string = null)
140140
*/
141141
public static function isSeekableStream($var)
142142
{
143-
if (T\StreamTransmitter::isStream($var)) {
143+
if (T\Stream::isStream($var)) {
144144
$meta = stream_get_meta_data($var);
145145
return $meta['seekable'];
146146
}
@@ -286,8 +286,7 @@ public function getCharset($charsetType)
286286
/**
287287
* Gets the transmitter for this connection.
288288
*
289-
* @return PEAR2\Net\Transmitter\SocketClientTransmitter The transmitter for
290-
* this connection.
289+
* @return T\TcpClient The transmitter for this connection.
291290
*/
292291
public function getTransmitter()
293292
{
@@ -486,12 +485,12 @@ public function getNextWordAsStream()
486485
* Decodes the lenght of the incoming message, as specified by the RouterOS
487486
* API.
488487
*
489-
* @param PEAR2\Net\Transmitter\StreamTransmitter $trans The transmitter
490-
* from which to decode the length of the incoming message.
488+
* @param T\Stream $trans The transmitter from which to decode the length of
489+
* the incoming message.
491490
*
492491
* @return int The decoded length
493492
*/
494-
public static function decodeLength(T\StreamTransmitter $trans)
493+
public static function decodeLength(T\Stream $trans)
495494
{
496495
$byte = ord($trans->receive(1, 'initial length byte'));
497496
if ($byte & 0x80) {

tests/RequestHandlingTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ public function testControlByteException()
555555
fwrite($stream, chr($controlByte));
556556
}
557557
rewind($stream);
558-
$trans = new T\StreamTransmitter($stream);
558+
$trans = new T\Stream($stream);
559559

560560
foreach ($controlBytes as $controlByte) {
561561
try {
@@ -612,7 +612,7 @@ public function testLengthDecoding()
612612
fwrite($stream, Communicator::encodeLength($length));
613613
}
614614
rewind($stream);
615-
$trans = new T\StreamTransmitter($stream);
615+
$trans = new T\Stream($stream);
616616

617617
foreach ($lengths as $length => $expected) {
618618
$this->assertEquals(

0 commit comments

Comments
 (0)