Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
28 | public function getPathname(Readable $from): Readable |
||
29 | { |
||
30 | $file = $this->getValue(1); |
||
31 | |||
32 | foreach (['', '.pp', '.pp2'] as $ext) { |
||
33 | $path = \dirname($from->getPathname()) . '/' . $file . $ext; |
||
34 | |||
35 | if (\is_file($path)) { |
||
36 | return File::fromPathname($path); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | throw (new IncludeNotFoundException(\sprintf('Grammar "%s" not found', $file))) |
||
41 | ->throwsIn($from, $this->getOffset()); |
||
42 | } |
||
43 | } |
||
44 |