@@ -14,24 +14,24 @@ |
||
14 | 14 | $chars = 60; |
15 | 15 | |
16 | 16 | // show the header |
17 | - $console->br()->border('-',$chars); |
|
17 | + $console->br()->border('-', $chars); |
|
18 | 18 | $console->bold()->flank('Extender execution summary'); |
19 | - $console->border('-',$chars); |
|
19 | + $console->border('-', $chars); |
|
20 | 20 | $console->out('Total run time: '.self::calculateRunTime($daemon->starttime)); |
21 | - $console->border('-',$chars); |
|
21 | + $console->border('-', $chars); |
|
22 | 22 | $padding = $console->padding(26); |
23 | - $padding->label('Total processed jobs')->result($daemon->completedjobs+$daemon->failedjobs); |
|
23 | + $padding->label('Total processed jobs')->result($daemon->completedjobs + $daemon->failedjobs); |
|
24 | 24 | $padding = $console->padding(30); |
25 | 25 | $padding->label('├─ Completed')->result('<light_green>'.$daemon->completedjobs.'</green>'); |
26 | 26 | $padding->label('└─ Failed')->result('<red>'.$daemon->failedjobs.'</red>'); |
27 | - $console->border('-',$chars); |
|
27 | + $console->border('-', $chars); |
|
28 | 28 | |
29 | 29 | } |
30 | 30 | |
31 | 31 | private static function calculateRunTime($starttime) { |
32 | 32 | |
33 | - $start_formatted = sprintf("%06d",($starttime - floor($starttime)) * 1000000); |
|
34 | - $start = new DateTime( date('Y-m-d H:i:s.'.$start_formatted, $starttime) ); |
|
33 | + $start_formatted = sprintf("%06d", ($starttime - floor($starttime)) * 1000000); |
|
34 | + $start = new DateTime(date('Y-m-d H:i:s.'.$start_formatted, $starttime)); |
|
35 | 35 | $end = new DateTime(); |
36 | 36 | |
37 | 37 | $diff = $end->diff($start); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | $daemon = $event->getDaemon(); |
11 | 11 | |
12 | - if ( $daemon->looplimit === $daemon->loopcount) { |
|
12 | + if ( $daemon->looplimit === $daemon->loopcount ) { |
|
13 | 13 | $daemon->logger->info('Stopping daemon due to loop limit ('.$daemon->looplimit.') reached'); |
14 | 14 | // $daemon->stop(); |
15 | 15 | $daemon->loopactive = false; |
@@ -14,10 +14,10 @@ |
||
14 | 14 | |
15 | 15 | if ( empty($jobs) ) return; |
16 | 16 | |
17 | - $console->border('-',30); |
|
17 | + $console->border('-', 30); |
|
18 | 18 | $console->bold()->green('Extender loop summary'); |
19 | 19 | $console->out("Loop duration: ".round($daemon->loopelapsed)); |
20 | - $console->border('-',30); |
|
20 | + $console->border('-', 30); |
|
21 | 21 | $console->out("Executed jobs: "); |
22 | 22 | $console->table($jobs); |
23 | 23 |
@@ -137,7 +137,7 @@ |
||
137 | 137 | |
138 | 138 | $result = []; |
139 | 139 | |
140 | - foreach($tasks as $task) { |
|
140 | + foreach ( $tasks as $task ) { |
|
141 | 141 | |
142 | 142 | if ( empty($task['name']) || empty($task['class']) ) { |
143 | 143 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | |
21 | 21 | |
22 | -class Result extends Model{ |
|
22 | +class Result extends Model { |
|
23 | 23 | |
24 | 24 | protected $mode = self::READONLY; |
25 | 25 |
@@ -111,9 +111,9 @@ |
||
111 | 111 | |
112 | 112 | $t = microtime(true); |
113 | 113 | |
114 | - $micro = sprintf("%06d",($t - floor($t)) * 1000000); |
|
114 | + $micro = sprintf("%06d", ($t - floor($t)) * 1000000); |
|
115 | 115 | |
116 | - return new DateTime( date('Y-m-d H:i:s.'.$micro, $t) ); |
|
116 | + return new DateTime(date('Y-m-d H:i:s.'.$micro, $t)); |
|
117 | 117 | |
118 | 118 | } |
119 | 119 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $em = $this->getEntityManager(); |
82 | 82 | |
83 | - foreach ($queue as $record) { |
|
83 | + foreach ( $queue as $record ) { |
|
84 | 84 | $em->remove($record); |
85 | 85 | } |
86 | 86 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $records = []; |
108 | 108 | |
109 | - foreach ($queue as $name => $request) { |
|
109 | + foreach ( $queue as $name => $request ) { |
|
110 | 110 | $records[] = $request instanceof Request ? $this->doAddRequest($name, $request, $em) : false; |
111 | 111 | } |
112 | 112 |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | |
140 | 140 | $responses = []; |
141 | 141 | |
142 | - foreach ($requests as $id => $request) { |
|
142 | + foreach ( $requests as $id => $request ) { |
|
143 | 143 | |
144 | - if ($request instanceof \Comodojo\Extender\Task\Request) { |
|
144 | + if ( $request instanceof \Comodojo\Extender\Task\Request ) { |
|
145 | 145 | $this->add($request); |
146 | 146 | $responses[$id] = true; |
147 | 147 | } else { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | protected function cycle() { |
176 | 176 | |
177 | - foreach ($this->locker->getQueued() as $uid => $request) { |
|
177 | + foreach ( $this->locker->getQueued() as $uid => $request ) { |
|
178 | 178 | |
179 | 179 | if ( $this->multithread === false ) { |
180 | 180 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | if ( $this->max_childs > 0 && $this->locker->countRunning() >= $this->max_childs ) { |
204 | 204 | |
205 | - while( $this->locker->countRunning() >= $this->max_childs ) { |
|
205 | + while ( $this->locker->countRunning() >= $this->max_childs ) { |
|
206 | 206 | |
207 | 207 | $this->catcher(); |
208 | 208 |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | $thetask = $this->table->get($task)->getInstance($name, $parameters); |
99 | 99 | |
100 | - $this->events->emit( new TaskEvent('start', $thetask) ); |
|
100 | + $this->events->emit(new TaskEvent('start', $thetask)); |
|
101 | 101 | |
102 | 102 | $pid = $thetask->getPid(); |
103 | 103 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $this->stopwatch->getStartTime() |
113 | 113 | ); |
114 | 114 | |
115 | - $this->events->emit( new TaskStatusEvent('start', $thetask) ); |
|
115 | + $this->events->emit(new TaskStatusEvent('start', $thetask)); |
|
116 | 116 | |
117 | 117 | try { |
118 | 118 | |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | - $this->events->emit( new TaskStatusEvent($status ? 'success' : 'error', $thetask) ); |
|
137 | + $this->events->emit(new TaskStatusEvent($status ? 'success' : 'error', $thetask)); |
|
138 | 138 | |
139 | - $this->events->emit( new TaskStatusEvent('stop', $thetask) ); |
|
139 | + $this->events->emit(new TaskStatusEvent('stop', $thetask)); |
|
140 | 140 | |
141 | - $this->events->emit( new TaskEvent('stop', $thetask) ); |
|
141 | + $this->events->emit(new TaskEvent('stop', $thetask)); |
|
142 | 142 | |
143 | 143 | $this->stopwatch->stop(); |
144 | 144 |