| Conditions | 4 |
| Paths | 6 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 47 | private function read($data): string |
||
| 48 | { |
||
| 49 | if (\is_string($data)) { |
||
| 50 | $data = new \SplFileInfo($data); |
||
| 51 | } |
||
| 52 | |||
| 53 | if ($data instanceof \SplFileInfo) { |
||
| 54 | if (!$data->isReadable()) { |
||
| 55 | throw new \RuntimeException(); |
||
| 56 | } |
||
| 57 | |||
| 58 | return \file_get_contents($data->getRealPath()); |
||
| 59 | } |
||
| 60 | |||
| 61 | throw new \InvalidArgumentException(); |
||
| 62 | } |
||
| 64 |