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