| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.0312 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 7 | public function create($definition): DefinitionInterface |
|
| 19 | { |
||
| 20 | 7 | if ($definition instanceof DefinitionInterface) { |
|
| 21 | 5 | return $definition; |
|
| 22 | } |
||
| 23 | |||
| 24 | 2 | if ($definition instanceof Closure) { |
|
| 25 | 1 | return new ClosureDefinition($definition); |
|
| 26 | } |
||
| 27 | |||
| 28 | 1 | if (is_string($definition)) { |
|
| 29 | 1 | return new ClassDefinition($definition); |
|
| 30 | } |
||
| 31 | |||
| 32 | throw InvalidDefinitionException::create($definition); |
||
| 33 | } |
||
| 34 | } |
||
| 35 |