Skip to content

Commit d810668

Browse files
committed
Remove unused methods
1 parent 384d30d commit d810668

2 files changed

Lines changed: 2 additions & 44 deletions

File tree

src/StreamReader.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ public function readByte()
9191
});
9292
}
9393

94-
public function readNull(){
95-
return $this->readByteAssert(0x00);
96-
}
97-
9894
public function readByteAssert($expect)
9995
{
10096
return $this->readByte()->then(function ($byte) use ($expect) {
@@ -105,11 +101,6 @@ public function readByteAssert($expect)
105101
});
106102
}
107103

108-
public function readChar()
109-
{
110-
return $this->readLength(1);
111-
}
112-
113104
public function readStringNull()
114105
{
115106
$deferred = new Deferred();
@@ -131,39 +122,6 @@ public function readStringNull()
131122
return $deferred->promise();
132123
}
133124

134-
public function readAssert($byteSequence)
135-
{
136-
$deferred = new Deferred();
137-
$pos = 0;
138-
139-
$that = $this;
140-
$this->readLength(strlen($byteSequence))->then(function ($data) use ($deferred) {
141-
$deferred->resolve($data);
142-
}, null, function ($part) use ($byteSequence, &$pos, $deferred, $that) {
143-
$len = strlen($part);
144-
$expect = substr($byteSequence, $pos, $len);
145-
146-
if ($part === $expect) {
147-
$pos += $len;
148-
} else {
149-
$deferred->reject(new UnexpectedValueException('Expected "'.$that->escape($expect).'", but got "'.$that->escape($part).'"'));
150-
}
151-
});
152-
return $deferred->promise();
153-
}
154-
155-
public function escape($bytes)
156-
{
157-
$ret = '';
158-
for ($i = 0, $l = strlen($bytes); $i < $l; ++$i) {
159-
if ($i !== 0) {
160-
$ret .= ' ';
161-
}
162-
$ret .= sprintf('0x%02X', ord($bytes[$i]));
163-
}
164-
return $ret;
165-
}
166-
167125
public function readBufferCallback(/* callable */ $callable)
168126
{
169127
if (!is_callable($callable)) {

tests/StreamReaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public function testA()
1515
{
1616
$that = $this;
1717

18-
$this->reader->readChar()->then($this->expectCallableOnce('h'));
19-
$this->reader->readChar()->then($this->expectCallableOnce('e'));
18+
$this->reader->readByte()->then($this->expectCallableOnce(ord('h')));
19+
$this->reader->readByteAssert(ord('e'))->then($this->expectCallableOnce(ord('e')));
2020
$this->reader->readLength(4)->then($this->expectCallableOnce('llo '));
2121
$this->reader->readBinary(array('w'=>'C', 'o' => 'C'))->then($this->expectCallableOnce(array('w' => ord('w'), 'o' => ord('o'))));
2222

0 commit comments

Comments
 (0)