Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class AttemptsCounter |
||
10 | { |
||
11 | /** |
||
12 | * @var array<string, Action> actions; |
||
13 | * keys are action names, values are action objects |
||
14 | */ |
||
15 | protected $actions = []; |
||
16 | |||
17 | /** |
||
18 | * Adds a new action to the counter object. |
||
19 | * @param Action $action the action |
||
20 | * @param bool $overwrite whether to overwrite existing action data in case of name conflict |
||
21 | * @return $this the counter object. |
||
22 | */ |
||
23 | 3 | public function addAction($action, $overwrite = true) |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Get an action by name. |
||
36 | * @param int|string $actionName the action name |
||
37 | * @return Action the action object. |
||
38 | * @throws Exception |
||
39 | */ |
||
40 | 4 | public function getAction($actionName) |
|
49 |