Conditions | 3 |
Paths | 3 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 10 |
Ratio | 41.67 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | public function parse($id, $service, $fileName) |
||
30 | { |
||
31 | if (false === isset($service['class'])) { |
||
32 | throw new InvalidArgumentException( |
||
33 | sprintf( |
||
34 | 'Parameter "class" missing for service "%s" in %s. Check your YAML syntax.', |
||
35 | $id, |
||
36 | $fileName |
||
37 | ) |
||
38 | ); |
||
39 | } |
||
40 | View Code Duplication | if (false === is_string($service['class'])) { |
|
|
|||
41 | throw new InvalidArgumentException( |
||
42 | sprintf( |
||
43 | 'Parameter "class" must be a FQCN for service "%s", but found "%s" instead in %s. Check your YAML syntax.', |
||
44 | $id, |
||
45 | gettype($service['class']), |
||
46 | $fileName |
||
47 | ) |
||
48 | ); |
||
49 | } |
||
50 | |||
51 | return $service['class']; |
||
52 | } |
||
53 | } |
||
54 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.