| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | 28 | public function parse($id, array $service, $fileName) |
|
| 34 | { |
||
| 35 | 28 | if (false === isset($service['alias'])) { |
|
| 36 | 22 | return null; |
|
| 37 | } |
||
| 38 | |||
| 39 | 8 | $aliasName = $service['alias']; |
|
| 40 | 8 | if (false === is_string($aliasName)) { |
|
| 41 | 2 | throw new InvalidArgumentException( |
|
| 42 | 1 | sprintf( |
|
| 43 | 2 | 'Parameter "alias" must be a plain name for service "%s", but found "%s" instead in %s. Check your YAML syntax.', |
|
| 44 | 1 | $id, |
|
| 45 | 1 | gettype($aliasName), |
|
| 46 | $fileName |
||
| 47 | 1 | ) |
|
| 48 | 1 | ); |
|
| 49 | } |
||
| 50 | |||
| 51 | 6 | return new Alias($aliasName, $id); |
|
| 52 | } |
||
| 53 | } |
||
| 54 |