| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 19 | protected function fixPath( |
||
| 20 | string $applicationRootDirectory, |
||
| 21 | string $absoluteOrRelativePath, |
||
| 22 | string $baseFile |
||
| 23 | ): string { |
||
| 24 | $possiblyValidFiles = [ |
||
| 25 | $applicationRootDirectory . '/' . $absoluteOrRelativePath, |
||
| 26 | $this->makeAbsolutePath($baseFile, $absoluteOrRelativePath), |
||
| 27 | $absoluteOrRelativePath, |
||
| 28 | ]; |
||
| 29 | |||
| 30 | foreach ($possiblyValidFiles as $file) { |
||
| 31 | if (file_exists($file)) { |
||
| 32 | return $file; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | throw new InvalidArgumentException(sprintf( |
||
| 37 | 'Unable to find a file referenced by "%s", tried: %s', |
||
| 38 | $absoluteOrRelativePath, |
||
| 39 | print_r($possiblyValidFiles, true) |
||
| 40 | )); |
||
| 41 | } |
||
| 42 | |||
| 48 |