| Conditions | 6 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 37 | public function createStreamFromFile(string $filename, string $mode = 'r'):StreamInterface{ |
||
| 38 | |||
| 39 | if(empty($filename) || !is_file($filename) || !is_readable($filename)){ |
||
| 40 | throw new RuntimeException('invalid file'); |
||
| 41 | } |
||
| 42 | |||
| 43 | if(!in_array($mode, FactoryHelpers::STREAM_MODES_WRITE) && !in_array($mode, FactoryHelpers::STREAM_MODES_READ)){ |
||
| 44 | throw new InvalidArgumentException('invalid mode'); |
||
| 45 | } |
||
| 46 | |||
| 47 | return new Stream(fopen($filename, $mode)); |
||
| 48 | } |
||
| 58 |