| Conditions | 5 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.025 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | 6 | protected function readSourceToString(string $sourcePath, $sourceData): string |
|
| 24 | { |
||
| 25 | 6 | if ((false === $sourceData) || (null === $sourceData)) { |
|
| 26 | 2 | throw new MimeException($this->getMiLang()->miCannotLoadFile($sourcePath)); |
|
| 27 | |||
| 28 | 4 | } elseif (is_resource($sourceData)) { |
|
| 29 | 1 | rewind($sourceData); |
|
| 30 | |||
| 31 | 1 | $data = stream_get_contents($sourceData, -1, 0); |
|
| 32 | 1 | if (false === $data) { |
|
| 33 | // @codeCoverageIgnoreStart |
||
| 34 | throw new MimeException($this->getMiLang()->miCannotGetFilePart($sourcePath)); |
||
| 35 | } |
||
| 36 | // @codeCoverageIgnoreEnd |
||
| 37 | |||
| 38 | 1 | return $data; |
|
| 39 | } else { |
||
| 40 | 3 | return strval($sourceData); |
|
| 41 | } |
||
| 44 |