@@ -48,6 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | } |
50 | 50 | |
51 | + /** |
|
52 | + * @param integer $uid |
|
53 | + */ |
|
51 | 54 | public function init($uid) { |
52 | 55 | |
53 | 56 | $this->ipc[$uid] = []; |
@@ -72,6 +75,10 @@ discard block |
||
72 | 75 | |
73 | 76 | } |
74 | 77 | |
78 | + /** |
|
79 | + * @param integer $uid |
|
80 | + * @param string $data |
|
81 | + */ |
|
75 | 82 | public function write($uid, $data) { |
76 | 83 | |
77 | 84 | $writer = $this->ipc[$uid][self::WRITER]; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | /** |
137 | 137 | * Get cron expression of this schedule |
138 | 138 | * |
139 | - * @return string |
|
139 | + * @return CronExpression |
|
140 | 140 | */ |
141 | 141 | public function getExpression() { |
142 | 142 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * set cron expression for this schedule |
149 | 149 | * |
150 | - * @param srting $expression A cron-compatible expression |
|
150 | + * @param CronExpression $expression A cron-compatible expression |
|
151 | 151 | * @return Schedule |
152 | 152 | */ |
153 | 153 | public function setExpression(CronExpression $expression) { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * Set enable/disable status |
179 | 179 | * |
180 | - * @param bool $enable |
|
180 | + * @param boolean $enabled |
|
181 | 181 | * @return Schedule |
182 | 182 | */ |
183 | 183 | public function setEnabled($enabled) { |
@@ -58,6 +58,9 @@ |
||
58 | 58 | |
59 | 59 | } |
60 | 60 | |
61 | + /** |
|
62 | + * @return \Doctrine\ORM\EntityManagerInterface |
|
63 | + */ |
|
61 | 64 | public function getEntityManager() { |
62 | 65 | |
63 | 66 | if ( $this->entity_manager === null ) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | false |
85 | 85 | ]; |
86 | 86 | |
87 | - switch (strtoupper($metadata_mode)) { |
|
87 | + switch ( strtoupper($metadata_mode) ) { |
|
88 | 88 | |
89 | 89 | case 'YAML': |
90 | 90 | $db_config = Setup::createYAMLMetadataConfiguration(...$config_args); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $repos = $configuration->get('database-repositories'); |
179 | 179 | |
180 | 180 | return array_map(function($repo) use ($base_folder) { |
181 | - return substr($repo, 0, 1 ) === "/" ? $repo : "$base_folder/$repo"; |
|
181 | + return substr($repo, 0, 1) === "/" ? $repo : "$base_folder/$repo"; |
|
182 | 182 | }, $repos); |
183 | 183 | |
184 | 184 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $base_folder = $configuration->get('base-path'); |
189 | 189 | $folder = $configuration->get('database-proxies'); |
190 | 190 | |
191 | - return substr($folder, 0, 1 ) === "/" ? $folder : "$base_folder/$folder"; |
|
191 | + return substr($folder, 0, 1) === "/" ? $folder : "$base_folder/$folder"; |
|
192 | 192 | |
193 | 193 | } |
194 | 194 |
@@ -41,7 +41,6 @@ |
||
41 | 41 | * |
42 | 42 | * @param Configuration $configuration |
43 | 43 | * @param LoggerInterface $logger |
44 | - * @param TasksTable $tasks |
|
45 | 44 | * @param EventsManager $events |
46 | 45 | * @param EntityManager $em |
47 | 46 | */ |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | |
80 | 80 | public function flush(array $queue) { |
81 | 81 | |
82 | - $this->getEvents()->emit( new QueueEvent('flush', null, $queue) ); |
|
82 | + $this->getEvents()->emit(new QueueEvent('flush', null, $queue)); |
|
83 | 83 | |
84 | 84 | $em = $this->getEntityManager(); |
85 | 85 | |
86 | - foreach ($queue as $record) { |
|
86 | + foreach ( $queue as $record ) { |
|
87 | 87 | $em->remove($record); |
88 | 88 | } |
89 | 89 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | $records = []; |
111 | 111 | |
112 | - foreach ($queue as $name => $request) { |
|
112 | + foreach ( $queue as $name => $request ) { |
|
113 | 113 | $records[] = $request instanceof Request ? $this->doAddRequest($request, $em) : false; |
114 | 114 | } |
115 | 115 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | protected function doAddRequest(Request $request, EntityManager $em) { |
123 | 123 | |
124 | - $this->getEvents()->emit( new QueueEvent('add', $request) ); |
|
124 | + $this->getEvents()->emit(new QueueEvent('add', $request)); |
|
125 | 125 | |
126 | 126 | $record = new Queue(); |
127 | 127 | $record->setName($request->getName())->setRequest($request); |
@@ -75,12 +75,10 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * Class constructor |
77 | 77 | * |
78 | - * @param string $manager_name |
|
79 | 78 | * @param Configuration $configuration |
80 | 79 | * @param LoggerInterface $logger |
81 | 80 | * @param TasksTable $tasks |
82 | 81 | * @param EventsManager $events |
83 | - * @param EntityManager $em |
|
84 | 82 | */ |
85 | 83 | public function __construct( |
86 | 84 | Locker $locker, |
@@ -413,6 +411,9 @@ discard block |
||
413 | 411 | |
414 | 412 | } |
415 | 413 | |
414 | + /** |
|
415 | + * @param string $message |
|
416 | + */ |
|
416 | 417 | private function generateSyntheticResult($uid, $message, $jid = null, $success = true) { |
417 | 418 | |
418 | 419 | return new Result([ |
@@ -437,6 +438,9 @@ discard block |
||
437 | 438 | |
438 | 439 | } |
439 | 440 | |
441 | + /** |
|
442 | + * @param null|integer $pid |
|
443 | + */ |
|
440 | 444 | private function updateTrackerSetRunning($uid, $pid) { |
441 | 445 | |
442 | 446 | $this->tracker->setRunning($uid, $pid); |
@@ -466,6 +470,9 @@ discard block |
||
466 | 470 | |
467 | 471 | } |
468 | 472 | |
473 | + /** |
|
474 | + * @param Result $result |
|
475 | + */ |
|
469 | 476 | private function updateTrackerSetAborted($uid, $result) { |
470 | 477 | |
471 | 478 | $this->tracker->setAborted($uid, $result); |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | public function addBulk(array $requests) { |
130 | 130 | |
131 | - foreach ($requests as $id => $request) { |
|
131 | + foreach ( $requests as $id => $request ) { |
|
132 | 132 | |
133 | - if ($request instanceof \Comodojo\Extender\Task\Request) { |
|
133 | + if ( $request instanceof \Comodojo\Extender\Task\Request ) { |
|
134 | 134 | $this->add($request); |
135 | 135 | } else { |
136 | 136 | $this->logger->error("Skipping invalid request with local id $id: class mismatch"); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $this->installErrorHandler(); |
165 | 165 | |
166 | - foreach ($this->tracker->getQueued() as $uid => $request) { |
|
166 | + foreach ( $this->tracker->getQueued() as $uid => $request ) { |
|
167 | 167 | |
168 | 168 | if ( $this->multithread === false ) { |
169 | 169 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | if ( $this->max_childs > 0 && $this->tracker->countRunning() >= $this->max_childs ) { |
193 | 193 | |
194 | - while( $this->tracker->countRunning() >= $this->max_childs ) { |
|
194 | + while ( $this->tracker->countRunning() >= $this->max_childs ) { |
|
195 | 195 | |
196 | 196 | $this->catcher(); |
197 | 197 |
@@ -190,6 +190,15 @@ discard block |
||
190 | 190 | |
191 | 191 | } |
192 | 192 | |
193 | + /** |
|
194 | + * @param integer $uid |
|
195 | + * @param integer $puid |
|
196 | + * @param string $name |
|
197 | + * @param integer $jid |
|
198 | + * @param string $task |
|
199 | + * @param TaskParameters $parameters |
|
200 | + * @param \DateTime $start |
|
201 | + */ |
|
193 | 202 | protected function openWorklog( |
194 | 203 | $uid, |
195 | 204 | $puid, |
@@ -221,6 +230,9 @@ discard block |
||
221 | 230 | |
222 | 231 | } |
223 | 232 | |
233 | + /** |
|
234 | + * @param \DateTime $end |
|
235 | + */ |
|
224 | 236 | protected function closeWorklog( |
225 | 237 | $status, |
226 | 238 | $result, |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | $thetask = $this->table->get($task)->getInstance($name, $parameters); |
90 | 90 | |
91 | - $this->events->emit( new TaskEvent('start', $thetask) ); |
|
91 | + $this->events->emit(new TaskEvent('start', $thetask)); |
|
92 | 92 | |
93 | 93 | $pid = $thetask->getPid(); |
94 | 94 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | $status = Worklog::STATUS_COMPLETE; |
113 | 113 | |
114 | - $this->events->emit( new TaskEvent('complete', $thetask) ); |
|
114 | + $this->events->emit(new TaskEvent('complete', $thetask)); |
|
115 | 115 | |
116 | 116 | } catch (TaskException $te) { |
117 | 117 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $result = $te->getMessage(); |
121 | 121 | |
122 | - $this->events->emit( new TaskEvent('abort', $thetask) ); |
|
122 | + $this->events->emit(new TaskEvent('abort', $thetask)); |
|
123 | 123 | |
124 | 124 | } catch (Exception $e) { |
125 | 125 | |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | |
128 | 128 | $result = $e->getMessage(); |
129 | 129 | |
130 | - $this->events->emit( new TaskEvent('error', $thetask) ); |
|
130 | + $this->events->emit(new TaskEvent('error', $thetask)); |
|
131 | 131 | |
132 | 132 | } |
133 | 133 | |
134 | 134 | $this->restoreErrorHandler(); |
135 | 135 | |
136 | - $this->events->emit( new TaskEvent('stop', $thetask) ); |
|
136 | + $this->events->emit(new TaskEvent('stop', $thetask)); |
|
137 | 137 | |
138 | 138 | $this->stopwatch->stop(); |
139 | 139 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | ob_end_clean(); |
169 | 169 | |
170 | - $this->events->emit( new TaskEvent(self::statusToEvent($status), $thetask, $result) ); |
|
170 | + $this->events->emit(new TaskEvent(self::statusToEvent($status), $thetask, $result)); |
|
171 | 171 | |
172 | 172 | return $result; |
173 | 173 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | protected function statusToEvent($status) { |
278 | 278 | |
279 | - switch ($status) { |
|
279 | + switch ( $status ) { |
|
280 | 280 | case Worklog::STATUS_COMPLETE: |
281 | 281 | return 'complete'; |
282 | 282 | break; |
@@ -44,7 +44,6 @@ |
||
44 | 44 | /** |
45 | 45 | * Tracker constructor |
46 | 46 | * |
47 | - * @param string $name |
|
48 | 47 | * @param Configuration $configuration |
49 | 48 | * @param LoggerInterface $logger |
50 | 49 | */ |
@@ -41,7 +41,6 @@ |
||
41 | 41 | * |
42 | 42 | * @param Configuration $configuration |
43 | 43 | * @param LoggerInterface $logger |
44 | - * @param TasksTable $tasks |
|
45 | 44 | * @param EventsManager $events |
46 | 45 | * @param EntityManager $em |
47 | 46 | */ |
@@ -144,7 +144,7 @@ |
||
144 | 144 | $records = []; |
145 | 145 | $em = $this->getEntityManager(); |
146 | 146 | |
147 | - foreach ($schedules as $key => $schedule) { |
|
147 | + foreach ( $schedules as $key => $schedule ) { |
|
148 | 148 | |
149 | 149 | try { |
150 | 150 |
@@ -38,9 +38,7 @@ |
||
38 | 38 | * |
39 | 39 | * @param Configuration $configuration |
40 | 40 | * @param LoggerInterface $logger |
41 | - * @param TasksTable $tasks |
|
42 | 41 | * @param EventsManager $events |
43 | - * @param EntityManager $em |
|
44 | 42 | */ |
45 | 43 | public function __construct( |
46 | 44 | Configuration $configuration, |
@@ -34,14 +34,14 @@ |
||
34 | 34 | use EventsTrait; |
35 | 35 | |
36 | 36 | /** |
37 | - * Class constructor |
|
38 | - * |
|
39 | - * @param Configuration $configuration |
|
40 | - * @param LoggerInterface $logger |
|
41 | - * @param TasksTable $tasks |
|
42 | - * @param EventsManager $events |
|
43 | - * @param EntityManager $em |
|
44 | - */ |
|
37 | + * Class constructor |
|
38 | + * |
|
39 | + * @param Configuration $configuration |
|
40 | + * @param LoggerInterface $logger |
|
41 | + * @param TasksTable $tasks |
|
42 | + * @param EventsManager $events |
|
43 | + * @param EntityManager $em |
|
44 | + */ |
|
45 | 45 | public function __construct( |
46 | 46 | Configuration $configuration, |
47 | 47 | LoggerInterface $logger, |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $em = Database::init($this->getConfiguration())->getEntityManager(); |
60 | 60 | |
61 | - foreach ($results as $result) { |
|
61 | + foreach ( $results as $result ) { |
|
62 | 62 | |
63 | 63 | $id = $result->jid; |
64 | 64 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $date = new DateTime(); |
94 | 94 | $timestamps = []; |
95 | 95 | |
96 | - foreach ($items as $schedule) { |
|
96 | + foreach ( $items as $schedule ) { |
|
97 | 97 | |
98 | 98 | $timestamps[] = $schedule->getNextPlannedRun($date)->getTimestamp(); |
99 | 99 |