Conditions | 5 |
Paths | 5 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5.025 |
Changes | 0 |
1 | <?php |
||
82 | 16 | private function getResource() |
|
83 | { |
||
84 | 16 | if ($this->resource && !feof($this->resource)) { |
|
85 | 4 | return $this->resource; |
|
86 | } |
||
87 | |||
88 | 16 | if ($this->resource !== null) { |
|
89 | 4 | fclose($this->resource); |
|
90 | 2 | } |
|
91 | |||
92 | 16 | $this->resource = fopen($this->filename, "r"); |
|
93 | 16 | if (!$this->resource) { |
|
94 | throw new \Exception("Unable to read from {$this->filename}"); |
||
95 | } |
||
96 | |||
97 | 16 | return $this->resource; |
|
98 | } |
||
99 | } |
||
100 |