| Conditions | 6 | 
| Paths | 6 | 
| Total Lines | 21 | 
| Code Lines | 15 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 13 | 
| CRAP Score | 6.0131 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 24 | 9 | protected function toString(string $target, $content): string | |
| 25 |     { | ||
| 26 | 9 |         if (is_null($content)) { | |
| 27 | 1 | throw new FilesException($this->getLang()->flCannotLoadFile($target)); | |
| 28 | 8 |         } elseif (is_bool($content)) { | |
| 29 | 2 | throw new FilesException($this->getLang()->flCannotLoadFile($target)); | |
| 30 | 6 |         } elseif (is_resource($content)) { | |
| 31 | 1 | rewind($content); | |
| 32 | 1 | $data = stream_get_contents($content, -1, 0); | |
| 33 | 1 |             if (false === $data) { | |
| 34 | // @codeCoverageIgnoreStart | ||
| 35 | // must die something with stream reading | ||
| 36 | throw new FilesException($this->getLang()->flCannotLoadFile($target)); | ||
| 37 | } | ||
| 38 | // @codeCoverageIgnoreEnd | ||
| 39 | 1 | return strval($data); | |
| 40 |         } else { | ||
| 41 |             try { | ||
| 42 | 5 | return strval($content); | |
| 43 | 1 |             } catch (\Error $ex) { | |
| 44 | 1 | throw new FilesException($ex->getMessage(), $ex->getCode(), $ex); | |
| 45 | } | ||
| 49 |