Conditions | 5 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5.025 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 75 | public static function normalize($definition, string $id = null): DefinitionInterface |
|
24 | { |
||
25 | 75 | if (is_array($definition) && isset($definition[DefinitionParser::IS_PREPARED_ARRAY_DEFINITION_DATA])) { |
|
26 | 30 | [$class, $constructorArguments, $methodsAndProperties] = $definition; |
|
27 | |||
28 | 30 | $class = $class ?? $id; |
|
29 | 30 | if ($class === null) { |
|
30 | throw new InvalidConfigException('Invalid definition: don\'t set class name.'); |
||
31 | } |
||
32 | |||
33 | 30 | return ArrayDefinition::fromPreparedData($class, $constructorArguments, $methodsAndProperties); |
|
34 | } |
||
35 | |||
36 | 75 | if ($definition instanceof ExtensibleService) { |
|
37 | 2 | return $definition; |
|
38 | } |
||
39 | |||
40 | 75 | return Normalizer::normalize($definition, $id); |
|
41 | } |
||
43 |