Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
11 | public function apply(object $event): void |
||
12 | { |
||
13 | static $hasMethodCache = []; |
||
14 | $parts = explode('\\', get_class($event)); |
||
15 | $methodName = 'apply' . end($parts); |
||
16 | $shouldApply = $hasMethodCache[$methodName] ?? method_exists($this, $methodName); |
||
17 | |||
18 | if ($shouldApply) { |
||
19 | $this->{$methodName}($event); |
||
20 | } |
||
21 | |||
22 | ++$this->aggregateRootVersion; |
||
23 | } |
||
25 |