| Conditions | 4 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | public function __construct($file) |
||
| 32 | { |
||
| 33 | if (!filter_var($file, FILTER_VALIDATE_URL) && !is_file($file)) { |
||
| 34 | throw new InvalidArgumentException( |
||
| 35 | "Cannot create stream: given file is not found." |
||
| 36 | ); |
||
| 37 | } |
||
| 38 | |||
| 39 | $string = fopen($file, 'r'); |
||
| 40 | if ($string === false) { |
||
| 41 | throw new InvalidArgumentException( |
||
| 42 | "Cannot create stream: could not open file." |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | |||
| 46 | $this->stream = $string; |
||
| 47 | } |
||
| 49 |