@@ -25,26 +25,26 @@ |
||
25 | 25 | * @param null|string $name |
26 | 26 | * @return array |
27 | 27 | */ |
28 | - public function container($name=null) |
|
28 | + public function container($name = null) |
|
29 | 29 | { |
30 | 30 | //check container value for kernel |
31 | - if(isset($this->instances['container'])){ |
|
31 | + if (isset($this->instances['container'])) { |
|
32 | 32 | |
33 | 33 | // if methoda is a null parameter, |
34 | 34 | // then we send direct container values. |
35 | - if(is_null($name)){ |
|
35 | + if (is_null($name)) { |
|
36 | 36 | return (array)$this->instances['container']; |
37 | 37 | } |
38 | 38 | |
39 | 39 | // if there is an existing value in the container as the method parameter, |
40 | 40 | // we send this value directly in the container. |
41 | - if(isset($this->container()[$name])){ |
|
41 | + if (isset($this->container()[$name])) { |
|
42 | 42 | return $this->container()[$name]; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // if there is no $name value in the container as the method parameter, |
46 | 46 | // we check this value directly in the core object. |
47 | - if(property_exists(core(),$name)){ |
|
47 | + if (property_exists(core(), $name)) { |
|
48 | 48 | return core()->{$name}; |
49 | 49 | } |
50 | 50 |
@@ -32,15 +32,15 @@ discard block |
||
32 | 32 | * @param callable $callback |
33 | 33 | * @return mixed|null |
34 | 34 | */ |
35 | - public function call($macro,callable $callback) |
|
35 | + public function call($macro, callable $callback) |
|
36 | 36 | { |
37 | - if(!is_null($macro)){ |
|
37 | + if (!is_null($macro)) { |
|
38 | 38 | |
39 | 39 | //get macro class from kernel macros |
40 | 40 | $macroCall = config('kernel.macros.'.$macro); |
41 | 41 | |
42 | 42 | //if macroCall class is available and an object. |
43 | - if(!is_null($macroCall) && Utils::isNamespaceExists($macroCall)){ |
|
43 | + if (!is_null($macroCall) && Utils::isNamespaceExists($macroCall)) { |
|
44 | 44 | return $macroCall; |
45 | 45 | } |
46 | 46 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param bool $static |
55 | 55 | * @return bool |
56 | 56 | */ |
57 | - protected function checkMacroConditions($static=false) |
|
57 | + protected function checkMacroConditions($static = false) |
|
58 | 58 | { |
59 | 59 | return is_string($this->macro) && |
60 | 60 | Utils::isNamespaceExists($this->macro) && |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @param bool $static |
68 | 68 | * @return bool |
69 | 69 | */ |
70 | - protected function checkMacroInstanceOf($static=false) |
|
70 | + protected function checkMacroInstanceOf($static = false) |
|
71 | 71 | { |
72 | - if($static){ |
|
72 | + if ($static) { |
|
73 | 73 | return true; |
74 | 74 | } |
75 | 75 | return $this->app->resolve($this->macro) instanceof MacroAbleContracts; |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | * @param callable $callback |
83 | 83 | * @return mixed |
84 | 84 | */ |
85 | - public function get($method,callable $callback) |
|
85 | + public function get($method, callable $callback) |
|
86 | 86 | { |
87 | - if($this->isMacro){ |
|
87 | + if ($this->isMacro) { |
|
88 | 88 | |
89 | - if(method_exists($resolve = $this->app->resolve($this->macro),$method)){ |
|
89 | + if (method_exists($resolve = $this->app->resolve($this->macro), $method)) { |
|
90 | 90 | return $resolve->macro($this->class); |
91 | 91 | } |
92 | 92 | } |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | * @param $class |
111 | 111 | * @return $this |
112 | 112 | */ |
113 | - public function isMacro($class,$static=false) |
|
113 | + public function isMacro($class, $static = false) |
|
114 | 114 | { |
115 | 115 | // if the macro class is a valid object, |
116 | 116 | // then this macro will return a boolean value if it has the specified methode. |
117 | - if($this->checkMacroConditions($static)){ |
|
117 | + if ($this->checkMacroConditions($static)) { |
|
118 | 118 | |
119 | 119 | $this->isMacro = true; |
120 | 120 | $this->class = $class; |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | * @param $method |
143 | 143 | * @return mixed |
144 | 144 | */ |
145 | - public function with($macro,$concrete,$method=null) |
|
145 | + public function with($macro, $concrete, $method = null) |
|
146 | 146 | { |
147 | - if($this->macro === null){ |
|
148 | - return $this($macro)->isMacro($concrete)->get($method,function() use($concrete){ |
|
147 | + if ($this->macro===null) { |
|
148 | + return $this($macro)->isMacro($concrete)->get($method, function() use($concrete){ |
|
149 | 149 | return $concrete; |
150 | 150 | }); |
151 | 151 | } |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * @param $method |
160 | 160 | * @return mixed |
161 | 161 | */ |
162 | - public function withStatic($macro,$concrete) |
|
162 | + public function withStatic($macro, $concrete) |
|
163 | 163 | { |
164 | - return $this($macro)->isMacro($concrete,true)->get(null,is_callable($concrete) ? |
|
164 | + return $this($macro)->isMacro($concrete, true)->get(null, is_callable($concrete) ? |
|
165 | 165 | $concrete : function() use($concrete){ |
166 | 166 | return $concrete; |
167 | 167 | }); |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | * @param null|string $macro |
174 | 174 | * @return $this |
175 | 175 | */ |
176 | - public function __invoke($macro=null) |
|
176 | + public function __invoke($macro = null) |
|
177 | 177 | { |
178 | - if($macro!==null){ |
|
178 | + if ($macro!==null) { |
|
179 | 179 | $this->macro = $macro; |
180 | 180 | } |
181 | 181 | return $this; |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | * @param null $app |
13 | 13 | * @return string |
14 | 14 | */ |
15 | - public function app($app=null) |
|
15 | + public function app($app = null) |
|
16 | 16 | { |
17 | - $app=($app===null) ? $this->appDetector() : $app; |
|
17 | + $app = ($app===null) ? $this->appDetector() : $app; |
|
18 | 18 | return StaticPathModel::appPath().''.DIRECTORY_SEPARATOR.''.Str::slashToBackSlash($app); |
19 | 19 | } |
20 | 20 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param null $app |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - public function appCall($app=null) |
|
41 | + public function appCall($app = null) |
|
42 | 42 | { |
43 | 43 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$controller; |
44 | 44 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @param null $app |
57 | 57 | * @return string |
58 | 58 | */ |
59 | - public function appConfig($app=null) |
|
59 | + public function appConfig($app = null) |
|
60 | 60 | { |
61 | - if(isset(core()->paths['config'])){ |
|
61 | + if (isset(core()->paths['config'])) { |
|
62 | 62 | return core()->paths['config']; |
63 | 63 | } |
64 | 64 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$config; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param null $app |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - public function appHelpers($app=null) |
|
71 | + public function appHelpers($app = null) |
|
72 | 72 | { |
73 | 73 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$helpers; |
74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param null $app |
102 | 102 | * @return mixed |
103 | 103 | */ |
104 | - public function appFactory($app=null) |
|
104 | + public function appFactory($app = null) |
|
105 | 105 | { |
106 | 106 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$factory; |
107 | 107 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function appKernel() |
113 | 113 | { |
114 | - $kernel = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$kernel; |
|
114 | + $kernel = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$kernel; |
|
115 | 115 | |
116 | 116 | return $kernel; |
117 | 117 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function appProvider() |
123 | 123 | { |
124 | - $kernel = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$kernel.''.DIRECTORY_SEPARATOR.''.StaticPathList::$provider; |
|
124 | + $kernel = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$kernel.''.DIRECTORY_SEPARATOR.''.StaticPathList::$provider; |
|
125 | 125 | |
126 | 126 | return $kernel; |
127 | 127 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param null $app |
147 | 147 | * @return mixed |
148 | 148 | */ |
149 | - public function appLogger($app=null) |
|
149 | + public function appLogger($app = null) |
|
150 | 150 | { |
151 | 151 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.'ServiceLogManager'; |
152 | 152 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param null $app |
156 | 156 | * @return mixed |
157 | 157 | */ |
158 | - public function appMiddleware($app=null) |
|
158 | + public function appMiddleware($app = null) |
|
159 | 159 | { |
160 | 160 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$middleware; |
161 | 161 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param null $app |
165 | 165 | * @return mixed |
166 | 166 | */ |
167 | - public function appMigration($app=null) |
|
167 | + public function appMigration($app = null) |
|
168 | 168 | { |
169 | 169 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$migration; |
170 | 170 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param null $app |
174 | 174 | * @return mixed |
175 | 175 | */ |
176 | - public function appModel($app=null) |
|
176 | + public function appModel($app = null) |
|
177 | 177 | { |
178 | 178 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$model; |
179 | 179 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @param null $app |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public function appException($app=null) |
|
185 | + public function appException($app = null) |
|
186 | 186 | { |
187 | 187 | return $this->appVersion().''.DIRECTORY_SEPARATOR.''.StaticPathList::$exception; |
188 | 188 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * @param null $app |
192 | 192 | * @return mixed |
193 | 193 | */ |
194 | - public function appOptionalEvents($app=null) |
|
194 | + public function appOptionalEvents($app = null) |
|
195 | 195 | { |
196 | 196 | return $this->appVersion().''.DIRECTORY_SEPARATOR.''.StaticPathList::$events; |
197 | 197 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param null $app |
201 | 201 | * @return mixed |
202 | 202 | */ |
203 | - public function appOptionalJob($app=null) |
|
203 | + public function appOptionalJob($app = null) |
|
204 | 204 | { |
205 | 205 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$optional.''.DIRECTORY_SEPARATOR.''.StaticPathList::$job; |
206 | 206 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param null $app |
210 | 210 | * @return mixed |
211 | 211 | */ |
212 | - public function appOptionalListeners($app=null) |
|
212 | + public function appOptionalListeners($app = null) |
|
213 | 213 | { |
214 | 214 | return $this->appVersion().''.DIRECTORY_SEPARATOR.''.StaticPathList::$listeners; |
215 | 215 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param null $app |
219 | 219 | * @return mixed |
220 | 220 | */ |
221 | - public function appOptionalSubscribers($app=null) |
|
221 | + public function appOptionalSubscribers($app = null) |
|
222 | 222 | { |
223 | 223 | return $this->appVersion().''.DIRECTORY_SEPARATOR.''.StaticPathList::$listeners.''.DIRECTORY_SEPARATOR.''.StaticPathList::$subscribers; |
224 | 224 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function appRepository() |
238 | 238 | { |
239 | - $repository = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$repository; |
|
239 | + $repository = $this->app().''.DIRECTORY_SEPARATOR.''.StaticPathList::$repository; |
|
240 | 240 | |
241 | 241 | return $repository; |
242 | 242 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param null $app |
254 | 254 | * @return mixed |
255 | 255 | */ |
256 | - public function appOptionalSource($app=null) |
|
256 | + public function appOptionalSource($app = null) |
|
257 | 257 | { |
258 | 258 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$optional.''.DIRECTORY_SEPARATOR.''.StaticPathList::$sourcePath; |
259 | 259 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param null $app |
263 | 263 | * @return mixed |
264 | 264 | */ |
265 | - public function appOptionalWebservice($app=null) |
|
265 | + public function appOptionalWebservice($app = null) |
|
266 | 266 | { |
267 | 267 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$optional.''.DIRECTORY_SEPARATOR.''.StaticPathList::$webservice; |
268 | 268 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @param null $app |
280 | 280 | * @return mixed |
281 | 281 | */ |
282 | - public function appServiceAnnotations($app=null) |
|
282 | + public function appServiceAnnotations($app = null) |
|
283 | 283 | { |
284 | 284 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$serviceAnnotations; |
285 | 285 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * @param null $app |
289 | 289 | * @return mixed |
290 | 290 | */ |
291 | - public function appServiceContainer($app=null) |
|
291 | + public function appServiceContainer($app = null) |
|
292 | 292 | { |
293 | 293 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.'ServiceContainerController'; |
294 | 294 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param null $app |
298 | 298 | * @return mixed |
299 | 299 | */ |
300 | - public function appServiceEventDispatcher($app=null) |
|
300 | + public function appServiceEventDispatcher($app = null) |
|
301 | 301 | { |
302 | 302 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.'ServiceEventDispatcherManager'; |
303 | 303 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @param null $app |
307 | 307 | * @return mixed |
308 | 308 | */ |
309 | - public function appServiceMiddleware($app=null) |
|
309 | + public function appServiceMiddleware($app = null) |
|
310 | 310 | { |
311 | 311 | return $this->appVersion($app).''.DIRECTORY_SEPARATOR.''.StaticPathList::$serviceMiddleware; |
312 | 312 | } |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | * @param null $app |
334 | 334 | * @return mixed |
335 | 335 | */ |
336 | - public function appVersion($app=null) |
|
336 | + public function appVersion($app = null) |
|
337 | 337 | { |
338 | - if(defined('app')){ |
|
338 | + if (defined('app')) { |
|
339 | 339 | |
340 | 340 | $prefixGroup = Str::slashToBackSlash(StaticPathList::$projectPrefixGroup); |
341 | 341 | |
@@ -379,19 +379,19 @@ discard block |
||
379 | 379 | * @param bool $bool |
380 | 380 | * @return mixed |
381 | 381 | */ |
382 | - public function controller($controller=null,$bool=false) |
|
382 | + public function controller($controller = null, $bool = false) |
|
383 | 383 | { |
384 | 384 | $namespaceController = ($controller===null) ? app()->namespace()->controller() |
385 | - : app()->namespace()->controller($controller,true); |
|
385 | + : app()->namespace()->controller($controller, true); |
|
386 | 386 | |
387 | - if($bool){ |
|
388 | - $namespaceControllerExplode = explode("\\",$namespaceController); |
|
387 | + if ($bool) { |
|
388 | + $namespaceControllerExplode = explode("\\", $namespaceController); |
|
389 | 389 | array_pop($namespaceControllerExplode); |
390 | 390 | |
391 | - $namespaceController = implode("\\",$namespaceControllerExplode); |
|
391 | + $namespaceController = implode("\\", $namespaceControllerExplode); |
|
392 | 392 | } |
393 | 393 | |
394 | - return Utils::getPathFromNamespace($namespaceController,false); |
|
394 | + return Utils::getPathFromNamespace($namespaceController, false); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | * @param $arg |
416 | 416 | * @return mixed |
417 | 417 | */ |
418 | - public function __call($name,$arg) |
|
418 | + public function __call($name, $arg) |
|
419 | 419 | { |
420 | - $appCall='app'.ucfirst($name); |
|
420 | + $appCall = 'app'.ucfirst($name); |
|
421 | 421 | return $this->{$appCall}(); |
422 | 422 | } |
423 | 423 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function execute() |
22 | 22 | { |
23 | 23 | //we check the presence of worker on container. |
24 | - if($this->isWorkerAvailable()){ |
|
24 | + if ($this->isWorkerAvailable()) { |
|
25 | 25 | $this->{$this->getApply()}(); |
26 | 26 | } |
27 | 27 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $this->isWorkerClosure(); |
37 | 37 | |
38 | - if($this->resolve instanceof \Closure){ |
|
38 | + if ($this->resolve instanceof \Closure) { |
|
39 | 39 | $resolve = $this->resolve; |
40 | 40 | echo $resolve($this->getData()).''.PHP_EOL; |
41 | 41 | $this->pause(); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $this->isWorkerObject(); |
53 | 53 | |
54 | - if($this->resolve instanceof WorkerContracts){ |
|
54 | + if ($this->resolve instanceof WorkerContracts) { |
|
55 | 55 | $this->resolve->handle(); |
56 | 56 | echo $this->getWorker().' Worker : Ok'.PHP_EOL; |
57 | 57 | $this->pause($this->resolve->getSleep()); |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | public function isWorkerClosure() |
67 | 67 | { |
68 | 68 | //we check the presence of worker on container. |
69 | - if($this->isWorkerAvailable()){ |
|
69 | + if ($this->isWorkerAvailable()) { |
|
70 | 70 | |
71 | 71 | // if worker comes as an object, this object will be executed. |
72 | 72 | // worker can have a closure function. |
73 | - if(is_callable($worker = $this->worker[$this->getWorker()])) { |
|
73 | + if (is_callable($worker = $this->worker[$this->getWorker()])) { |
|
74 | 74 | $this->resolve = $worker; |
75 | 75 | } |
76 | 76 | } |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | public function isWorkerObject() |
85 | 85 | { |
86 | 86 | //we check the presence of worker on container. |
87 | - if($this->isWorkerAvailable()){ |
|
87 | + if ($this->isWorkerAvailable()) { |
|
88 | 88 | |
89 | 89 | // if worker comes as an object, this object will be executed. |
90 | 90 | // worker can have a closure function. |
91 | - if(!is_callable($worker = $this->worker[$this->getWorker()]) && Utils::isNamespaceExists($worker)) { |
|
92 | - $this->resolve = $this->app->resolve($worker,['data'=>$this->getData()]); |
|
91 | + if (!is_callable($worker = $this->worker[$this->getWorker()]) && Utils::isNamespaceExists($worker)) { |
|
92 | + $this->resolve = $this->app->resolve($worker, ['data'=>$this->getData()]); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param ApplicationContracts $app |
21 | 21 | * @param WorkerManagerContracts $worker |
22 | 22 | */ |
23 | - public function __construct(ApplicationContracts $app,WorkerManagerContracts $worker) |
|
23 | + public function __construct(ApplicationContracts $app, WorkerManagerContracts $worker) |
|
24 | 24 | { |
25 | 25 | parent::__construct($app); |
26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function execute() |
34 | 34 | { |
35 | - while(1){ |
|
35 | + while (1) { |
|
36 | 36 | $this->worker->executeObject(); |
37 | 37 | $this->worker->executeClosure(); |
38 | 38 | } |
@@ -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 | } |
@@ -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 | } |
@@ -38,7 +38,9 @@ |
||
38 | 38 | $this->argument[$key] = ucfirst($key); |
39 | 39 | $this->{$method}(); |
40 | 40 | |
41 | - if($break) break; |
|
41 | + if($break) { |
|
42 | + break; |
|
43 | + } |
|
42 | 44 | } |
43 | 45 | exit(); |
44 | 46 | } |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | * @param string $method |
32 | 32 | * @param bool $break |
33 | 33 | */ |
34 | - private function allWorkers($method='start',$break=false) |
|
34 | + private function allWorkers($method = 'start', $break = false) |
|
35 | 35 | { |
36 | - foreach(app()->get('worker') as $key=>$item){ |
|
36 | + foreach (app()->get('worker') as $key=>$item) { |
|
37 | 37 | $this->argument['worker'] = ucfirst($key); |
38 | 38 | $this->argument[$key] = ucfirst($key); |
39 | 39 | $this->{$method}(); |
40 | 40 | |
41 | - if($break) break; |
|
41 | + if ($break) break; |
|
42 | 42 | } |
43 | 43 | exit(); |
44 | 44 | } |
@@ -48,22 +48,22 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function start() |
50 | 50 | { |
51 | - if(is_null($this->argument['worker'])){ |
|
51 | + if (is_null($this->argument['worker'])) { |
|
52 | 52 | $this->allWorkers(); |
53 | 53 | exit(); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $workerName = $this->projectName().'-'.$this->argument['worker']; |
57 | 57 | app()->terminate('WORKER'); |
58 | - app()->register('WORKER',$workerName); |
|
58 | + app()->register('WORKER', $workerName); |
|
59 | 59 | app()->terminate('PROJECT_NAME'); |
60 | - app()->register('PROJECT_NAME',strtolower($this->projectName())); |
|
61 | - app()->register('WORKER_START',true); |
|
62 | - app()->register('WORKER_STOP',false); |
|
63 | - app()->register('WORKER_STATUS',false); |
|
64 | - app()->register('WORKER_CLEAR',false); |
|
60 | + app()->register('PROJECT_NAME', strtolower($this->projectName())); |
|
61 | + app()->register('WORKER_START', true); |
|
62 | + app()->register('WORKER_STOP', false); |
|
63 | + app()->register('WORKER_STATUS', false); |
|
64 | + app()->register('WORKER_CLEAR', false); |
|
65 | 65 | |
66 | - app()->resolve(WorkerManager::class,['args'=>$this->argument])->execute(); |
|
66 | + app()->resolve(WorkerManager::class, ['args'=>$this->argument])->execute(); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function stop() |
73 | 73 | { |
74 | - if(is_null($this->argument['worker'])){ |
|
74 | + if (is_null($this->argument['worker'])) { |
|
75 | 75 | $this->allWorkers('stop'); |
76 | 76 | exit(); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $workerName = $this->projectName().'-'.$this->argument['worker']; |
80 | 80 | app()->terminate('WORKER'); |
81 | - app()->register('WORKER',$workerName); |
|
81 | + app()->register('WORKER', $workerName); |
|
82 | 82 | app()->terminate('PROJECT_NAME'); |
83 | - app()->register('PROJECT_NAME',strtolower($this->projectName())); |
|
84 | - app()->register('WORKER_START',false); |
|
85 | - app()->register('WORKER_STOP',true); |
|
86 | - app()->register('WORKER_STATUS',false); |
|
87 | - app()->register('WORKER_CLEAR',false); |
|
83 | + app()->register('PROJECT_NAME', strtolower($this->projectName())); |
|
84 | + app()->register('WORKER_START', false); |
|
85 | + app()->register('WORKER_STOP', true); |
|
86 | + app()->register('WORKER_STATUS', false); |
|
87 | + app()->register('WORKER_CLEAR', false); |
|
88 | 88 | |
89 | - app()->resolve(WorkerManager::class,['args'=>$this->argument])->execute(); |
|
89 | + app()->resolve(WorkerManager::class, ['args'=>$this->argument])->execute(); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -94,20 +94,20 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function status() |
96 | 96 | { |
97 | - if(!isset($this->argument['worker'])){ |
|
98 | - $this->allWorkers('status',true); |
|
97 | + if (!isset($this->argument['worker'])) { |
|
98 | + $this->allWorkers('status', true); |
|
99 | 99 | exit(); |
100 | 100 | } |
101 | 101 | |
102 | 102 | $workerName = $this->projectName().'-'.$this->argument['worker']; |
103 | - app()->register('WORKER',$workerName); |
|
104 | - app()->register('PROJECT_NAME',strtolower($this->projectName())); |
|
105 | - app()->register('WORKER_START',false); |
|
106 | - app()->register('WORKER_STOP',false); |
|
107 | - app()->register('WORKER_STATUS',true); |
|
108 | - app()->register('WORKER_CLEAR',false); |
|
109 | - |
|
110 | - app()->resolve(WorkerManager::class,['args'=>$this->argument])->execute(); |
|
103 | + app()->register('WORKER', $workerName); |
|
104 | + app()->register('PROJECT_NAME', strtolower($this->projectName())); |
|
105 | + app()->register('WORKER_START', false); |
|
106 | + app()->register('WORKER_STOP', false); |
|
107 | + app()->register('WORKER_STATUS', true); |
|
108 | + app()->register('WORKER_CLEAR', false); |
|
109 | + |
|
110 | + app()->resolve(WorkerManager::class, ['args'=>$this->argument])->execute(); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function clear() |
117 | 117 | { |
118 | - if(is_null($this->argument['worker'])){ |
|
118 | + if (is_null($this->argument['worker'])) { |
|
119 | 119 | $this->allWorkers('clear'); |
120 | 120 | exit(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $workerName = $this->projectName().'-'.$this->argument['worker']; |
124 | 124 | app()->terminate('WORKER'); |
125 | - app()->register('WORKER',$workerName); |
|
125 | + app()->register('WORKER', $workerName); |
|
126 | 126 | app()->terminate('PROJECT_NAME'); |
127 | - app()->register('PROJECT_NAME',strtolower($this->projectName())); |
|
128 | - app()->register('WORKER_START',false); |
|
129 | - app()->register('WORKER_STOP',false); |
|
130 | - app()->register('WORKER_STATUS',false); |
|
131 | - app()->register('WORKER_CLEAR',true); |
|
127 | + app()->register('PROJECT_NAME', strtolower($this->projectName())); |
|
128 | + app()->register('WORKER_START', false); |
|
129 | + app()->register('WORKER_STOP', false); |
|
130 | + app()->register('WORKER_STATUS', false); |
|
131 | + app()->register('WORKER_CLEAR', true); |
|
132 | 132 | |
133 | - app()->resolve(WorkerManager::class,['args'=>$this->argument])->execute(); |
|
133 | + app()->resolve(WorkerManager::class, ['args'=>$this->argument])->execute(); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function create() |
140 | 140 | { |
141 | - if(!file_exists(app()->path()->workers())){ |
|
141 | + if (!file_exists(app()->path()->workers())) { |
|
142 | 142 | $this->directory['worker'] = app()->path()->workers(); |
143 | 143 | $this->file->makeDirectory($this); |
144 | 144 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $this->argument['workerClass'] = ucfirst($this->argument['worker']).''; |
148 | 148 | $this->argument['projectName'] = strtolower($this->projectName()); |
149 | 149 | |
150 | - $this->touch['worker/worker']= app()->path()->workers().'/'.$this->argument['worker'].'.php'; |
|
150 | + $this->touch['worker/worker'] = app()->path()->workers().'/'.$this->argument['worker'].'.php'; |
|
151 | 151 | |
152 | 152 | |
153 | 153 | $this->file->touch($this); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param ApplicationContracts $app |
26 | 26 | * @param WorkerManagerContracts $worker |
27 | 27 | */ |
28 | - public function __construct(ApplicationContracts $app,WorkerManagerContracts $worker) |
|
28 | + public function __construct(ApplicationContracts $app, WorkerManagerContracts $worker) |
|
29 | 29 | { |
30 | 30 | parent::__construct($app); |
31 | 31 | |
@@ -41,19 +41,19 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function jobProcessor() |
43 | 43 | { |
44 | - if($this->app->get('WORKER_START')===true){ |
|
44 | + if ($this->app->get('WORKER_START')===true) { |
|
45 | 45 | return 'start'; |
46 | 46 | } |
47 | 47 | |
48 | - if($this->app->get('WORKER_STOP')===true){ |
|
48 | + if ($this->app->get('WORKER_STOP')===true) { |
|
49 | 49 | return 'stop'; |
50 | 50 | } |
51 | 51 | |
52 | - if($this->app->get('WORKER_STATUS')===true){ |
|
52 | + if ($this->app->get('WORKER_STATUS')===true) { |
|
53 | 53 | return 'status'; |
54 | 54 | } |
55 | 55 | |
56 | - if($this->app->get('WORKER_CLEAR')===true){ |
|
56 | + if ($this->app->get('WORKER_CLEAR')===true) { |
|
57 | 57 | return 'clear'; |
58 | 58 | } |
59 | 59 | } |
@@ -13,9 +13,9 @@ |
||
13 | 13 | * @param null|string $command |
14 | 14 | * @return mixed|void |
15 | 15 | */ |
16 | - public function command($command=null) |
|
16 | + public function command($command = null) |
|
17 | 17 | { |
18 | - $process = new ProcessHandler($command,root.''); |
|
18 | + $process = new ProcessHandler($command, root.''); |
|
19 | 19 | $process->run(); |
20 | 20 | |
21 | 21 | // executes after the command finishes |