Conditions | 4 |
Paths | 5 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | 4 | public function resolve(string $ident): \SplFileInfo |
|
36 | { |
||
37 | 4 | foreach ($this->searchPath as $basePath) { |
|
38 | 4 | $fullPath = rtrim($basePath, '/\\').'/'.$ident; |
|
39 | 4 | if ('.svg' !== substr($fullPath, -4)) { |
|
40 | 2 | $fullPath .= '.svg'; // Add svg extension |
|
41 | } |
||
42 | |||
43 | 4 | if (is_file($fullPath)) { |
|
44 | 3 | return new \SplFileInfo($fullPath); |
|
45 | } |
||
46 | } |
||
47 | |||
48 | 1 | throw new FileNotFoundException(sprintf( |
|
49 | 1 | 'SVG file for "%s" could not be found on "%s".', |
|
50 | 1 | $ident, |
|
51 | 1 | (string) $this, |
|
52 | 1 | )); |
|
60 |