Test Setup Failed
Push — master ( 79a996...894c42 )
by Php Easy Api
04:27
created
src/resta/Worker/WorkerManager.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/resta/Worker/DefaultJob.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/resta/Worker/WorkerManagerAbstract.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,8 +112,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/resta/Console/Source/Worker/Worker.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.