| Conditions | 4 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | private function getHandleMethodName($event) |
||
| 26 | { |
||
| 27 | $classParts = explode('\\', get_class($event)); |
||
| 28 | $methodName = 'apply' . end($classParts); |
||
| 29 | |||
| 30 | if (!method_exists($this, $methodName)) { |
||
| 31 | return null; |
||
| 32 | } |
||
| 33 | |||
| 34 | try { |
||
| 35 | $parameter = new \ReflectionParameter(array($this, $methodName), 0); |
||
| 36 | } catch (\ReflectionException $e) { |
||
| 37 | // No parameter for the method, so we ignore it. |
||
| 38 | return null; |
||
| 39 | } |
||
| 40 | |||
| 41 | $expectedClass = $parameter->getClass(); |
||
| 42 | |||
| 43 | if ($expectedClass->getName() !== get_class($event)) { |
||
| 44 | return null; |
||
| 45 | } |
||
| 46 | |||
| 47 | return $methodName; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: