src/Reader/SignedShortReader.php 1 location
|
@@ 45-57 (lines=13) @@
|
42 |
|
* @param StreamInterface $stream |
43 |
|
* @param int $endian |
44 |
|
*/ |
45 |
|
public function __construct(StreamInterface $stream, $endian) |
46 |
|
{ |
47 |
|
if (!$stream->isReadable()) { |
48 |
|
throw new Exception\InvalidArgumentException('Stream not readable'); |
49 |
|
} |
50 |
|
|
51 |
|
if (!in_array($endian, [Endian::ENDIAN_BIG, Endian::ENDIAN_LITTLE])) { |
52 |
|
throw new Exception\InvalidArgumentException('Invalid endian'); |
53 |
|
} |
54 |
|
|
55 |
|
$this->stream = $stream; |
56 |
|
$this->endian = $endian; |
57 |
|
} |
58 |
|
|
59 |
|
/** |
60 |
|
* Get stream |
src/Reader/UnsignedShortReader.php 1 location
|
@@ 40-52 (lines=13) @@
|
37 |
|
* @param StreamInterface $stream |
38 |
|
* @param int $endian |
39 |
|
*/ |
40 |
|
public function __construct(StreamInterface $stream, $endian) |
41 |
|
{ |
42 |
|
if (!$stream->isReadable()) { |
43 |
|
throw new Exception\InvalidArgumentException('Stream not readable'); |
44 |
|
} |
45 |
|
|
46 |
|
if (!in_array($endian, [Endian::ENDIAN_BIG, Endian::ENDIAN_LITTLE])) { |
47 |
|
throw new Exception\InvalidArgumentException('Invalid endian'); |
48 |
|
} |
49 |
|
|
50 |
|
$this->stream = $stream; |
51 |
|
$this->endian = $endian; |
52 |
|
} |
53 |
|
|
54 |
|
/** |
55 |
|
* Get stream |