Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
108 | * |
||
109 | * @throws YaEtlException |
||
110 | * |
||
111 | * @return $this |
||
112 | */ |
||
113 | protected function initHandle($input, $mode) |
||
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 | } |
||
128 | } |
||
129 |