| Total Complexity | 4 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | class MessagePartStreamDecorator implements StreamInterface |
||
| 21 | { |
||
| 22 | use StreamDecoratorTrait { |
||
| 23 | read as private decoratorRead; |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var IMessagePart The part to read from. |
||
| 28 | */ |
||
| 29 | protected IMessagePart $part; |
||
| 30 | |||
| 31 | protected ?StreamInterface $stream; |
||
| 32 | |||
| 33 | public function __construct(IMessagePart $part, ?StreamInterface $stream = null) |
||
| 34 | { |
||
| 35 | $this->part = $part; |
||
| 36 | $this->stream = $stream; |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Overridden to wrap exceptions in MessagePartReadException which provides |
||
| 41 | * 'getPart' to inspect the part the error occurs on. |
||
| 42 | * |
||
| 43 | * @param int $length |
||
| 44 | * @return string |
||
| 45 | * @throws MessagePartStreamReadException |
||
| 46 | */ |
||
| 47 | public function read(int $length) : string |
||
| 60 | ); |
||
| 61 | } |
||
| 64 |