@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | * @param ApplicationContracts $app |
25 | 25 | * @param array $args |
26 | 26 | */ |
27 | - public function __construct(ApplicationContracts $app, $args=array()) |
|
27 | + public function __construct(ApplicationContracts $app, $args = array()) |
|
28 | 28 | { |
29 | 29 | parent::__construct($app); |
30 | 30 | |
31 | - if($this->app->runningInConsole()===false){ |
|
31 | + if ($this->app->runningInConsole()===false) { |
|
32 | 32 | exception()->runtime('The worker can only be run as cli..'); |
33 | 33 | } |
34 | 34 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getApply() |
46 | 46 | { |
47 | - if(isset($this->args['apply'])){ |
|
47 | + if (isset($this->args['apply'])) { |
|
48 | 48 | return $this->args['apply']; |
49 | 49 | } |
50 | 50 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function getData() |
60 | 60 | { |
61 | - if(isset($this->args['data'])){ |
|
61 | + if (isset($this->args['data'])) { |
|
62 | 62 | return $this->args['data']; |
63 | 63 | } |
64 | 64 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getPauseValue() |
74 | 74 | { |
75 | - if(isset($this->args['pause'])){ |
|
75 | + if (isset($this->args['pause'])) { |
|
76 | 76 | return $this->args['pause']; |
77 | 77 | } |
78 | 78 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function getWorker() |
88 | 88 | { |
89 | - if(isset($this->args['worker'],$this->worker[$worker = strtolower($this->args['worker'])])){ |
|
89 | + if (isset($this->args['worker'], $this->worker[$worker = strtolower($this->args['worker'])])) { |
|
90 | 90 | return $worker; |
91 | 91 | } |
92 | 92 | |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @param null|\int $pause |
110 | 110 | */ |
111 | - public function pause($pause=null) |
|
111 | + public function pause($pause = null) |
|
112 | 112 | { |
113 | - if(is_null($pause)){ |
|
113 | + if (is_null($pause)) { |
|
114 | 114 | sleep($this->getPauseValue()); |
115 | 115 | } |
116 | - else{ |
|
116 | + else { |
|
117 | 117 | sleep($pause); |
118 | 118 | } |
119 | 119 | } |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | public function __call($name, $arguments) |
129 | 129 | { |
130 | 130 | $job = __NAMESPACE__.'\\'.ucfirst($name).'Job'; |
131 | - if(Utils::isNamespaceExists($job)){ |
|
132 | - return $this->app->resolve($job,['worker'=>$this])->execute(); |
|
131 | + if (Utils::isNamespaceExists($job)) { |
|
132 | + return $this->app->resolve($job, ['worker'=>$this])->execute(); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | exception()->runtime('Job Class not found'); |
@@ -112,8 +112,7 @@ |
||
112 | 112 | { |
113 | 113 | if(is_null($pause)){ |
114 | 114 | sleep($this->getPauseValue()); |
115 | - } |
|
116 | - else{ |
|
115 | + } else{ |
|
117 | 116 | sleep($pause); |
118 | 117 | } |
119 | 118 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function run() |
32 | 32 | { |
33 | - app()->resolve(WorkerManager::class,['args'=>$this->argument])->execute(); |
|
33 | + app()->resolve(WorkerManager::class, ['args'=>$this->argument])->execute(); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function create() |
40 | 40 | { |
41 | - if(!file_exists(app()->path()->workers())){ |
|
41 | + if (!file_exists(app()->path()->workers())) { |
|
42 | 42 | $this->directory['worker'] = app()->path()->workers(); |
43 | 43 | $this->file->makeDirectory($this); |
44 | 44 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $this->argument['workerClass'] = ucfirst($this->argument['worker']).''; |
48 | 48 | $this->argument['projectName'] = strtolower($this->projectName()); |
49 | 49 | |
50 | - $this->touch['worker/worker']= app()->path()->workers().'/'.$this->argument['worker'].'.php'; |
|
50 | + $this->touch['worker/worker'] = app()->path()->workers().'/'.$this->argument['worker'].'.php'; |
|
51 | 51 | |
52 | 52 | |
53 | 53 | $this->file->touch($this); |