| Conditions | 4 |
| Paths | 6 |
| Total Lines | 20 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.1755 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 3 | public function __construct( |
|
| 15 | string $filePathOrContent, |
||
| 16 | ?string $url = null, |
||
| 17 | array $info = [], |
||
| 18 | $headers = PHP_EOL.PHP_EOL |
||
| 19 | ) { |
||
| 20 | 3 | $content = file_exists($filePathOrContent) ? file_get_contents($filePathOrContent) : $filePathOrContent; |
|
| 21 | |||
| 22 | 3 | if (!$content) { |
|
| 23 | throw new \Exception($filePath.' doesn\'t exist'); |
||
|
|
|||
| 24 | } |
||
| 25 | |||
| 26 | 3 | if (false !== $headers) { |
|
| 27 | 3 | list($this->headers, $this->content) = explode($headers, $content, 2); |
|
| 28 | } else { |
||
| 29 | $this->content = $content; |
||
| 30 | } |
||
| 31 | |||
| 32 | 3 | $this->info = $info; |
|
| 33 | 3 | $this->url = $url; |
|
| 34 | 3 | } |
|
| 75 |