1 | <?php |
||
11 | class CommandExecutionLock implements ICommandExecutionLock { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $lockFile; |
||
16 | |||
17 | /** |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $recentCommands = []; |
||
21 | |||
22 | /** |
||
23 | * CommandExecutionLock constructor. |
||
24 | * |
||
25 | * @param string $lockFile |
||
26 | */ |
||
27 | public function __construct($lockFile = null) { |
||
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | */ |
||
39 | public function getLockFile() { |
||
42 | |||
43 | /** |
||
44 | * @param string $lockFile |
||
45 | */ |
||
46 | public function setLockFile($lockFile) { |
||
49 | |||
50 | /** |
||
51 | * @return array |
||
52 | */ |
||
53 | public function readLockFile() { |
||
70 | |||
71 | /** |
||
72 | * @param array $data |
||
73 | */ |
||
74 | public function writeLockFile(array $data) { |
||
80 | |||
81 | /** |
||
82 | * @param string $value |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | public function isInLockFile($value) { |
||
89 | |||
90 | /** |
||
91 | * @param string $value |
||
92 | */ |
||
93 | public function addToLockFile($value) { |
||
101 | |||
102 | /** |
||
103 | * @param string $value |
||
104 | */ |
||
105 | public function removeFromLockFile($value) { |
||
112 | |||
113 | /** |
||
114 | * Remove all locks for commands called trough |
||
115 | * this particular lock instance. |
||
116 | */ |
||
117 | public function removeRecentCommandsFromLockFile() { |
||
122 | |||
123 | /** |
||
124 | * @param IConsole $console |
||
125 | * @param ICommand $command |
||
126 | */ |
||
127 | public function lockCommand(IConsole $console, ICommand $command) { |
||
144 | |||
145 | /** |
||
146 | * Handle shutdown events and clean up lock files. |
||
147 | */ |
||
148 | protected function handleShutdowns() { |
||
173 | |||
174 | /** |
||
175 | * @return string |
||
176 | */ |
||
177 | protected function getDefaultLockFile() { |
||
180 | } |
||
181 |