| Conditions | 5 |
| Paths | 5 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 5.2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 2 | public function handle(AbstractValidation $formValidation, MethodInvocation $invocation, AbstractForm $form) |
|
| 22 | { |
||
| 23 | 2 | unset($form); |
|
| 24 | 2 | $args = (array) $invocation->getArguments(); |
|
| 25 | 2 | $object = $invocation->getThis(); |
|
| 26 | 2 | if (! $formValidation instanceof FormValidation) { |
|
| 27 | throw new InvalidOnFailureMethod(get_class($invocation->getThis())); |
||
| 28 | } |
||
| 29 | 2 | $onFailureMethod = $formValidation->onFailure ?: $invocation->getMethod()->getName() . self::FAILURE_SUFFIX; |
|
|
|
|||
| 30 | 2 | if (! $formValidation instanceof FormValidation || ! method_exists($object, $onFailureMethod)) { |
|
| 31 | throw new InvalidOnFailureMethod(get_class($invocation->getThis())); |
||
| 32 | } |
||
| 33 | |||
| 34 | 2 | return call_user_func_array([$invocation->getThis(), $onFailureMethod], $args); |
|
| 35 | } |
||
| 36 | } |
||
| 37 |