1 | <?php |
||
22 | class CommandHistoryLogger |
||
23 | { |
||
24 | /** @var array */ |
||
25 | private $commandHistory = []; |
||
26 | |||
27 | /** @var int */ |
||
28 | private $requestsCount = 0; |
||
29 | |||
30 | /** @var int */ |
||
31 | private $commandsCount = 0; |
||
32 | |||
33 | /** @var int */ |
||
34 | private $successfulCommandsCount = 0; |
||
35 | |||
36 | /** @var int */ |
||
37 | private $failedCommandsCount = 0; |
||
38 | |||
39 | /** |
||
40 | * @param CommandInterface $command |
||
41 | * @param bool $success |
||
42 | * @param array|null $result |
||
43 | */ |
||
44 | public function logCommand(CommandInterface $command, bool $success, ?array $result): void |
||
60 | |||
61 | /** |
||
62 | * Clear command history. |
||
63 | */ |
||
64 | public function clearCommandHistory(): void |
||
72 | |||
73 | /** |
||
74 | * @return CommandInterface[] |
||
75 | */ |
||
76 | public function getCommandHistory(): array |
||
80 | |||
81 | /** |
||
82 | * Increase requests count. |
||
83 | */ |
||
84 | public function increaseRequestsCount(): void |
||
88 | |||
89 | /** |
||
90 | * @return int |
||
91 | */ |
||
92 | public function getRequestsCount(): int |
||
96 | |||
97 | /** |
||
98 | * @return int |
||
99 | */ |
||
100 | public function getCommandsCount(): int |
||
104 | |||
105 | /** |
||
106 | * @return int |
||
107 | */ |
||
108 | public function getSuccessfulCommandsCount(): int |
||
112 | |||
113 | /** |
||
114 | * @return int |
||
115 | */ |
||
116 | public function getFailedCommandsCount(): int |
||
120 | } |
||
121 |