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