| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function create(string $class): ActionMetadata |
||
| 25 | { |
||
| 26 | $refl = new \ReflectionClass($class); |
||
| 27 | |||
| 28 | if (!$refl->implementsInterface(ActionInterface::class)) { |
||
| 29 | throw new InvalidConfigurationException(\sprintf('The "%s" class should implement the "%s" interface.', $class, ActionInterface::class)); |
||
| 30 | } |
||
| 31 | |||
| 32 | return $refl->implementsInterface(ActionWithOptionsInterface::class) ? |
||
| 33 | new ActionWithOptionsMetadata($refl, $class, $refl->getMethod('getOptionsClass')->invoke(null)) : |
||
| 34 | new ActionMetadata($refl, $class); |
||
| 35 | } |
||
| 37 |