| @@ 28-44 (lines=17) @@ | ||
| 25 | /** |
|
| 26 | * @inheritDoc |
|
| 27 | */ |
|
| 28 | public function apply(EventInterface $event) |
|
| 29 | { |
|
| 30 | $method = $this->createMethodName('apply', $event); |
|
| 31 | ||
| 32 | if (!method_exists($this, $method)) { |
|
| 33 | throw new EventHandlerMissing( |
|
| 34 | sprintf( |
|
| 35 | 'Command %s does not have a handler for its expected aggregate %s', |
|
| 36 | get_class($event), |
|
| 37 | get_class($this) |
|
| 38 | ), |
|
| 39 | 501 |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | $this->$method($event); |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Create Method Name |
|
| @@ 95-111 (lines=17) @@ | ||
| 92 | /** |
|
| 93 | * @inheritDoc |
|
| 94 | */ |
|
| 95 | public function handle(CommandInterface $command) |
|
| 96 | { |
|
| 97 | $method = $this->createMethodName('handle', $command); |
|
| 98 | ||
| 99 | if (!method_exists($this, $method)) { |
|
| 100 | throw new CommandHandlerMissing( |
|
| 101 | sprintf( |
|
| 102 | 'Command %s does not have a handler for its expected aggregate %s', |
|
| 103 | get_class($command), |
|
| 104 | get_class($this) |
|
| 105 | ), |
|
| 106 | 501 |
|
| 107 | ); |
|
| 108 | } |
|
| 109 | ||
| 110 | return $this->$method($command); |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * @inheritDoc |
|