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