1 | <?php |
||
39 | class Runner { |
||
40 | |||
41 | |||
42 | const TICK_TTL = 300; |
||
43 | const TICK_MINIMUM = 2; |
||
44 | const INFO_UPDATE = 10; |
||
45 | |||
46 | /** @var RunningService */ |
||
47 | private $runningService; |
||
48 | |||
49 | /** @var string */ |
||
50 | private $source; |
||
51 | |||
52 | /** @var bool */ |
||
53 | private $strict = false; |
||
54 | |||
55 | /** @var int */ |
||
56 | private $tickId; |
||
57 | |||
58 | /** @var ExtendedBase */ |
||
59 | private $commandBase = null; |
||
60 | |||
61 | /** @var OutputInterface */ |
||
62 | private $outputInterface = null; |
||
63 | |||
64 | /** @var int */ |
||
65 | private $oldTick = 0; |
||
66 | |||
67 | /** @var string */ |
||
68 | private $oldAction = ''; |
||
69 | |||
70 | /** @var int */ |
||
71 | private $ramTick = 0; |
||
72 | |||
73 | /** |
||
74 | * Runner constructor. |
||
75 | * |
||
76 | * @param RunningService $runningService |
||
77 | * @param string $source |
||
78 | */ |
||
79 | public function __construct(RunningService $runningService, $source) { |
||
83 | |||
84 | |||
85 | /** |
||
86 | * @param bool $strict |
||
87 | * |
||
88 | * @throws RunnerAlreadyUpException |
||
89 | */ |
||
90 | public function start($strict = false) { |
||
94 | |||
95 | |||
96 | /** |
||
97 | * @param $action |
||
98 | * |
||
99 | * @throws InterruptException |
||
100 | * @throws TickDoesNotExistException |
||
101 | */ |
||
102 | public function update($action) { |
||
127 | |||
128 | |||
129 | /** |
||
130 | * @throws InterruptException |
||
131 | */ |
||
132 | private function hasBeenInterrupted() { |
||
138 | |||
139 | |||
140 | /** |
||
141 | * @param $tick |
||
142 | */ |
||
143 | private function updateInfo($tick) { |
||
151 | |||
152 | |||
153 | public function exception($reason, $stop) { |
||
160 | |||
161 | |||
162 | /** |
||
163 | * @throws TickDoesNotExistException |
||
164 | */ |
||
165 | public function stop() { |
||
168 | |||
169 | |||
170 | /** |
||
171 | * @param ExtendedBase $base |
||
172 | * @param OutputInterface $output |
||
173 | */ |
||
174 | public function sourceIsCommandLine(ExtendedBase $base, OutputInterface $output) { |
||
178 | |||
179 | |||
180 | public function isStrict() { |
||
183 | |||
184 | /** |
||
185 | * @param string $line |
||
186 | */ |
||
187 | public function output($line) { |
||
194 | |||
195 | |||
196 | } |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.