Conditions | 5 |
Paths | 5 |
Total Lines | 24 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
30 | public function validate($content, $file) |
||
31 | { |
||
32 | if (null === $content) { |
||
33 | return $content; |
||
34 | } |
||
35 | |||
36 | if (false === is_array($content)) { |
||
37 | throw new InvalidArgumentException( |
||
38 | sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file) |
||
39 | ); |
||
40 | } |
||
41 | |||
42 | foreach ($content as $namespace => $data) { |
||
43 | if (in_array($namespace, ['parameters', 'services'])) { |
||
44 | continue; |
||
45 | } |
||
46 | |||
47 | throw new InvalidArgumentException( |
||
48 | sprintf('Invalid namespace name "%s" in "%s".', $namespace, $file) |
||
49 | ); |
||
50 | } |
||
51 | |||
52 | return $content; |
||
53 | } |
||
54 | } |
||
55 |