| @@ 40-49 (lines=10) @@ | ||
| 37 | ) |
|
| 38 | ); |
|
| 39 | } |
|
| 40 | 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 | } |
|
| @@ 36-45 (lines=10) @@ | ||
| 33 | */ |
|
| 34 | public function parse(ServiceInterface $service, $decoration, $fileName) |
|
| 35 | { |
|
| 36 | if (false === is_string($decoration['decorates'])) { |
|
| 37 | throw new InvalidArgumentException( |
|
| 38 | sprintf( |
|
| 39 | 'Parameter "decorates" for service "%s" must be the id of another service, but found "%s" instead in %s. Check your YAML syntax.', |
|
| 40 | $service->getName(), |
|
| 41 | gettype($decoration['decorates']), |
|
| 42 | $fileName |
|
| 43 | ) |
|
| 44 | ); |
|
| 45 | } |
|
| 46 | $decorates = $decoration['decorates']; |
|
| 47 | ||
| 48 | $decorationInnerName = (isset($decoration['decoration_inner_name'])) |
|
| @@ 52-61 (lines=10) @@ | ||
| 49 | ? $decoration['decoration_inner_name'] |
|
| 50 | : null |
|
| 51 | ; |
|
| 52 | if (null !== $decorationInnerName && false === is_string($decorationInnerName)) { |
|
| 53 | throw new InvalidArgumentException( |
|
| 54 | sprintf( |
|
| 55 | 'Parameter "decoration_inner_name" for service "%s" must be a string if is set, but found "%s" instead in %s. Check your YAML syntax.', |
|
| 56 | $service->getName(), |
|
| 57 | gettype($decorationInnerName), |
|
| 58 | $fileName |
|
| 59 | ) |
|
| 60 | ); |
|
| 61 | } |
|
| 62 | ||
| 63 | return new Decoration($service, $decorates, $decorationInnerName); |
|
| 64 | } |
|
| @@ 95-104 (lines=10) @@ | ||
| 92 | */ |
|
| 93 | private function parseFactory(ServiceInterface $service, $factoryClass, $factoryMethod, $fileName) |
|
| 94 | { |
|
| 95 | if (false === is_string($factoryClass)) { |
|
| 96 | throw new InvalidArgumentException( |
|
| 97 | sprintf( |
|
| 98 | 'The first parameter of "factory" for service "%s" must be a class name or a reference to a service, but found "%s" instead in %s. Check your YAML syntax.', |
|
| 99 | $service->getName(), |
|
| 100 | gettype($factoryClass), |
|
| 101 | $fileName |
|
| 102 | ) |
|
| 103 | ); |
|
| 104 | } |
|
| 105 | $factoryClass = $this->serviceResolver->resolve($factoryClass); |
|
| 106 | ||
| 107 | if (false === is_string($factoryMethod)) { |
|
| @@ 107-116 (lines=10) @@ | ||
| 104 | } |
|
| 105 | $factoryClass = $this->serviceResolver->resolve($factoryClass); |
|
| 106 | ||
| 107 | if (false === is_string($factoryMethod)) { |
|
| 108 | throw new InvalidArgumentException( |
|
| 109 | sprintf( |
|
| 110 | 'The second parameter of "factory" for service "%s" must be a class name or a reference to a service, but found "%s" instead in %s. Check your YAML syntax.', |
|
| 111 | $service->getName(), |
|
| 112 | gettype($factoryMethod), |
|
| 113 | $fileName |
|
| 114 | ) |
|
| 115 | ); |
|
| 116 | } |
|
| 117 | ||
| 118 | return new Factory($service, $factoryClass, $factoryMethod); |
|
| 119 | } |
|