| @@ 25-31 (lines=7) @@ | ||
| 22 | * |
|
| 23 | * @throws Exception |
|
| 24 | */ |
|
| 25 | public function add($id, ActionInterface $action) |
|
| 26 | { |
|
| 27 | if (array_key_exists($id, $this->actions)) { |
|
| 28 | throw new Exception('An Action with the name "'.$id.'" has already been registered'); |
|
| 29 | } |
|
| 30 | $this->actions[$id] = $action; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * Return an Action from the registry. |
|
| @@ 40-48 (lines=9) @@ | ||
| 37 | * @return ActionInterface |
|
| 38 | * @throws Exception |
|
| 39 | */ |
|
| 40 | public function get($id) |
|
| 41 | { |
|
| 42 | if (!array_key_exists($id, $this->actions)) { |
|
| 43 | dump($this->actions); |
|
| 44 | throw new Exception('No Action with the service id "'.$id.'" has been found'); |
|
| 45 | } |
|
| 46 | ||
| 47 | return $this->actions[$id]; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * Return true if an Action with the name $id has been registered. |
|