@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | * @param ApplicationContracts $app |
26 | 26 | * @param array $args |
27 | 27 | */ |
28 | - public function __construct(ApplicationContracts $app, $args=array()) |
|
28 | + public function __construct(ApplicationContracts $app, $args = array()) |
|
29 | 29 | { |
30 | 30 | parent::__construct($app); |
31 | 31 | |
32 | - if($this->app->runningInConsole()===false){ |
|
32 | + if ($this->app->runningInConsole()===false) { |
|
33 | 33 | exception()->runtime('The worker can only be run as cli..'); |
34 | 34 | } |
35 | 35 | |
36 | - if($this->app->has('WORKER')===false){ |
|
36 | + if ($this->app->has('WORKER')===false) { |
|
37 | 37 | exception()->runtime('The worker console manipulation for WORKER container value'); |
38 | 38 | } |
39 | 39 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function getApply() |
51 | 51 | { |
52 | - if(isset($this->args['apply'])){ |
|
52 | + if (isset($this->args['apply'])) { |
|
53 | 53 | return $this->args['apply']; |
54 | 54 | } |
55 | 55 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getData() |
65 | 65 | { |
66 | - if(isset($this->args['data'])){ |
|
66 | + if (isset($this->args['data'])) { |
|
67 | 67 | return $this->args['data']; |
68 | 68 | } |
69 | 69 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getPauseValue() |
79 | 79 | { |
80 | - if(isset($this->args['pause'])){ |
|
80 | + if (isset($this->args['pause'])) { |
|
81 | 81 | return $this->args['pause']; |
82 | 82 | } |
83 | 83 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function getWorker() |
93 | 93 | { |
94 | - if(isset($this->args['worker'],$this->worker[$worker = strtolower($this->args['worker'])])){ |
|
94 | + if (isset($this->args['worker'], $this->worker[$worker = strtolower($this->args['worker'])])) { |
|
95 | 95 | return $worker; |
96 | 96 | } |
97 | 97 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param null|\int $pause |
115 | 115 | */ |
116 | - public function pause($pause=null) |
|
116 | + public function pause($pause = null) |
|
117 | 117 | { |
118 | - if(is_null($pause)){ |
|
118 | + if (is_null($pause)) { |
|
119 | 119 | sleep($this->getPauseValue()); |
120 | 120 | } |
121 | - else{ |
|
121 | + else { |
|
122 | 122 | sleep($pause); |
123 | 123 | } |
124 | 124 | } |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function __call($name, $arguments) |
134 | 134 | { |
135 | - $job = $this->app->get('macro')->call(strtolower($this->getApply()).'Job',function() use($name){ |
|
135 | + $job = $this->app->get('macro')->call(strtolower($this->getApply()).'Job', function() use($name){ |
|
136 | 136 | return __NAMESPACE__.'\\'.ucfirst($name).'Job'; |
137 | 137 | }); |
138 | 138 | |
139 | - if(Utils::isNamespaceExists($job)){ |
|
139 | + if (Utils::isNamespaceExists($job)) { |
|
140 | 140 | |
141 | 141 | /** @var JobContracts $resolve */ |
142 | - $resolve = $this->app->resolve($job,['worker'=>$this]); |
|
142 | + $resolve = $this->app->resolve($job, ['worker'=>$this]); |
|
143 | 143 | |
144 | - if($resolve instanceof JobContracts){ |
|
144 | + if ($resolve instanceof JobContracts) { |
|
145 | 145 | return $resolve->execute(); |
146 | 146 | } |
147 | 147 | } |