| Conditions | 5 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 113 | protected function initHandle($input, string $mode): self |
||
| 114 | { |
||
| 115 | if (is_resource($input)) { |
||
| 116 | $this->handle = $input; |
||
| 117 | } elseif (is_file($input)) { |
||
| 118 | $this->handle = fopen($input, $mode) ?: null; |
||
| 119 | if (!$this->handle) { |
||
| 120 | throw new YaEtlException('Handle could not be opened in mode:' . $mode); |
||
| 121 | } |
||
| 122 | } else { |
||
| 123 | throw new YaEtlException('$input is either not a resource or not a file'); |
||
| 124 | } |
||
| 125 | |||
| 126 | return $this; |
||
| 127 | } |
||
| 129 |