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