1 | <?php |
||
29 | class Runner |
||
30 | { |
||
31 | /** |
||
32 | * The task to be run. |
||
33 | * |
||
34 | * @var Task |
||
35 | */ |
||
36 | private $task; |
||
37 | |||
38 | /** |
||
39 | * The lock handler. |
||
40 | * |
||
41 | * @var LockHandler |
||
42 | */ |
||
43 | private $lock; |
||
44 | |||
45 | /** |
||
46 | * The logger in use. |
||
47 | * |
||
48 | * @var LoggerInterface |
||
49 | */ |
||
50 | private $logger; |
||
51 | |||
52 | /** |
||
53 | * The shutdown error handler shall be executed. |
||
54 | * |
||
55 | * @var bool |
||
56 | */ |
||
57 | private $shutdownHandlerActive; |
||
58 | |||
59 | /** |
||
60 | * Create a new instance. |
||
61 | * |
||
62 | * @param Task $task The task to be run. |
||
63 | * |
||
64 | * @param LockHandler $lock The lock file to use. |
||
65 | * |
||
66 | * @param LoggerInterface $logger The logger to use. |
||
67 | */ |
||
68 | public function __construct(Task $task, LockHandler $lock, LoggerInterface $logger) |
||
75 | |||
76 | /** |
||
77 | * Run the task. |
||
78 | * |
||
79 | * @param string $logfile The log file to use. |
||
80 | * |
||
81 | * @return bool |
||
82 | */ |
||
83 | public function run($logfile) |
||
101 | |||
102 | /** |
||
103 | * Called upon PHP shutdown. |
||
104 | * |
||
105 | * @return void |
||
106 | */ |
||
107 | public function handleError() |
||
125 | |||
126 | /** |
||
127 | * Acquire the lock. |
||
128 | * |
||
129 | * @return void |
||
130 | * |
||
131 | * @throws \RuntimeException When the lock could not be acquired. |
||
132 | */ |
||
133 | private function acquireLock() |
||
156 | |||
157 | /** |
||
158 | * Release the lock. |
||
159 | * |
||
160 | * @return void |
||
161 | */ |
||
162 | private function releaseLock() |
||
167 | } |
||
168 |