@@ -45,8 +45,6 @@ discard block |
||
| 45 | 45 | * Class constructor |
| 46 | 46 | * |
| 47 | 47 | * @param string $name |
| 48 | - * @param string $task |
|
| 49 | - * @param TaskParameters $parameters |
|
| 50 | 48 | */ |
| 51 | 49 | public function __construct($name, $expression, TaskRequest $request, $description = null) { |
| 52 | 50 | |
@@ -68,6 +66,9 @@ discard block |
||
| 68 | 66 | |
| 69 | 67 | } |
| 70 | 68 | |
| 69 | + /** |
|
| 70 | + * @param string $name |
|
| 71 | + */ |
|
| 71 | 72 | public function setName($name) { |
| 72 | 73 | |
| 73 | 74 | $this->name = $name; |
@@ -79,7 +80,7 @@ discard block |
||
| 79 | 80 | /** |
| 80 | 81 | * Get request associated task |
| 81 | 82 | * |
| 82 | - * @return string |
|
| 83 | + * @return TaskRequest |
|
| 83 | 84 | */ |
| 84 | 85 | public function getTaskRequest() { |
| 85 | 86 | |
@@ -117,7 +118,7 @@ discard block |
||
| 117 | 118 | /** |
| 118 | 119 | * Get parent unique id |
| 119 | 120 | * |
| 120 | - * @return int |
|
| 121 | + * @return string |
|
| 121 | 122 | */ |
| 122 | 123 | public function getExpression() { |
| 123 | 124 | |
@@ -95,6 +95,9 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | + /** |
|
| 99 | + * @param null|integer $pid |
|
| 100 | + */ |
|
| 98 | 101 | public function setRunning($uid, $pid) { |
| 99 | 102 | |
| 100 | 103 | $request = $this->queued[$uid]; |
@@ -214,6 +217,9 @@ discard block |
||
| 214 | 217 | |
| 215 | 218 | } |
| 216 | 219 | |
| 220 | + /** |
|
| 221 | + * @param string $name |
|
| 222 | + */ |
|
| 217 | 223 | public static function create($name, Configuration $configuration, LoggerInterface $logger) { |
| 218 | 224 | |
| 219 | 225 | return new Locker($name, $configuration, $logger); |
@@ -428,6 +428,9 @@ |
||
| 428 | 428 | |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | + /** |
|
| 432 | + * @param string $message |
|
| 433 | + */ |
|
| 431 | 434 | private function generateSyntheticResult($uid, $message, $success = true) { |
| 432 | 435 | |
| 433 | 436 | return new Result([ |
@@ -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 | |
@@ -140,6 +140,9 @@ |
||
| 140 | 140 | |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | + /** |
|
| 144 | + * @param string $name |
|
| 145 | + */ |
|
| 143 | 146 | public function getInstance($name, TaskParameters $parameters = null) { |
| 144 | 147 | |
| 145 | 148 | $task_class = $this->getClass(); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * Set queue item's id |
| 52 | 52 | * |
| 53 | 53 | * @param string $id |
| 54 | - * @return Schedule |
|
| 54 | + * @return BaseEntityTrait |
|
| 55 | 55 | */ |
| 56 | 56 | public function setId($id) { |
| 57 | 57 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * Set queue item's name |
| 77 | 77 | * |
| 78 | 78 | * @param string $name |
| 79 | - * @return Schedule |
|
| 79 | + * @return BaseEntityTrait |
|
| 80 | 80 | */ |
| 81 | 81 | public function setName($name) { |
| 82 | 82 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * Set queue item's id |
| 66 | 66 | * |
| 67 | 67 | * @param string $id |
| 68 | - * @return Schedule |
|
| 68 | + * @return BaseScheduleEntityTrait |
|
| 69 | 69 | */ |
| 70 | 70 | public function setId($id) { |
| 71 | 71 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * Set queue item's name |
| 91 | 91 | * |
| 92 | 92 | * @param string $name |
| 93 | - * @return Schedule |
|
| 93 | + * @return BaseScheduleEntityTrait |
|
| 94 | 94 | */ |
| 95 | 95 | public function setName($name) { |
| 96 | 96 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * Set associated task |
| 116 | 116 | * |
| 117 | 117 | * @param string $task |
| 118 | - * @return Schedule |
|
| 118 | + * @return BaseScheduleEntityTrait |
|
| 119 | 119 | */ |
| 120 | 120 | public function setTask($task) { |
| 121 | 121 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * Set queue item's parameters |
| 141 | 141 | * |
| 142 | 142 | * @param TaskParameters $parameters |
| 143 | - * @return Schedule |
|
| 143 | + * @return BaseScheduleEntityTrait |
|
| 144 | 144 | */ |
| 145 | 145 | public function setParameters(TaskParameters $parameters) { |
| 146 | 146 | |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | /** |
| 40 | 40 | * Set EntityManager |
| 41 | 41 | * |
| 42 | - * @param string $id |
|
| 43 | - * @return Schedule |
|
| 42 | + * @return EntityManagerTrait |
|
| 44 | 43 | */ |
| 45 | 44 | public function setEntityManager(EntityManager $em) { |
| 46 | 45 | |
@@ -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 | |
@@ -356,7 +356,7 @@ |
||
| 356 | 356 | |
| 357 | 357 | public function isChain() { |
| 358 | 358 | |
| 359 | - return ( $this->done !== null || $this->fail !== null || $this->pipe !== null ); |
|
| 359 | + return ($this->done !== null || $this->fail !== null || $this->pipe !== null); |
|
| 360 | 360 | |
| 361 | 361 | } |
| 362 | 362 | |