| Conditions | 3 |
| Paths | 4 |
| Total Lines | 30 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public function fromPath($path) |
||
| 30 | { |
||
| 31 | $finder = $this->finder |
||
| 32 | ->in($path) |
||
| 33 | ->files() |
||
| 34 | ->name(ConfigurationWriter::FILENAME) |
||
| 35 | ->depth(0); |
||
| 36 | |||
| 37 | /** @var SplFileInfo|null $file */ |
||
| 38 | $file = null; |
||
| 39 | foreach ($finder as $result) { |
||
| 40 | $file = $result; |
||
| 41 | break; |
||
| 42 | } |
||
| 43 | |||
| 44 | if (null === $file) { |
||
| 45 | throw new FileNotFoundException( |
||
| 46 | null, |
||
| 47 | 0, |
||
| 48 | null, |
||
| 49 | sprintf( |
||
| 50 | '%s/%s', |
||
| 51 | trim($path, '/'), |
||
| 52 | ConfigurationWriter::FILENAME |
||
| 53 | ) |
||
| 54 | ); |
||
| 55 | } |
||
| 56 | |||
| 57 | return $this->fromString($file->getContents()); |
||
| 58 | } |
||
| 59 | |||
| 68 |