| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 18 | public function create($definition): DefinitionInterface |
|
| 28 | { |
||
| 29 | 18 | if ($definition instanceof DefinitionInterface) { |
|
| 30 | 15 | return $definition; |
|
| 31 | } |
||
| 32 | |||
| 33 | 5 | if ($definition instanceof Closure) { |
|
| 34 | 1 | return new ClosureDefinition($definition); |
|
| 35 | } |
||
| 36 | |||
| 37 | 4 | if (is_string($definition)) { |
|
| 38 | 3 | return new ClassDefinition($definition); |
|
| 39 | } |
||
| 40 | |||
| 41 | 1 | throw InvalidDefinitionException::create($definition); |
|
| 42 | } |
||
| 43 | } |
||
| 44 |