Total Complexity | 6 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class CommandRecorder |
||
10 | { |
||
11 | const MODE_SILENT = 'silent'; |
||
12 | const MODE_DEFAULT = 'default'; |
||
13 | |||
14 | /** |
||
15 | * @var Collection |
||
16 | */ |
||
17 | protected $commandsCalled; |
||
18 | |||
19 | /** |
||
20 | * CommandRecorder constructor. |
||
21 | */ |
||
22 | public function __construct() |
||
23 | { |
||
24 | $this->commandsCalled = new Collection; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Clears the records. |
||
29 | */ |
||
30 | public function reset() |
||
31 | { |
||
32 | $this->commandsCalled = new Collection; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return Collection |
||
37 | */ |
||
38 | public function getCommandsCalled() |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Record a command call. |
||
45 | * |
||
46 | * @param $command |
||
47 | * @param array $parameters |
||
48 | * @param string $mode |
||
49 | */ |
||
50 | public function record($command, $parameters = [], $mode = self::MODE_DEFAULT) |
||
56 | ]; |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Determine if the command was called with the provided parameters. |
||
61 | * |
||
62 | * @param $command |
||
63 | * @param array $parameters |
||
64 | * @return bool |
||
65 | */ |
||
66 | public function commandWasCalled($command, $parameters = []) |
||
70 | }); |
||
71 | } |
||
72 | } |