Test Setup Failed
Push — master ( a0b736...8111b0 )
by Php Easy Api
07:24 queued 03:09
created
src/resta/Console/ConsoleProvider.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
     {
28 28
         // we check that they are in
29 29
         // the console to run the console commands in the kernel.
30
-        if(Utils::isNamespaceExists($this->consoleClassNamespace)){
30
+        if (Utils::isNamespaceExists($this->consoleClassNamespace)) {
31 31
             return call_user_func($callback);
32 32
         }
33 33
 
34 34
         // if the kernel console is not found
35 35
         // then we check the existence of the specific application command and run it if it is.
36
-        return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(),$this))->handle();
36
+        return (new CustomConsoleProcess($this->getConsoleArgumentsWithKey(), $this))->handle();
37 37
 
38 38
     }
39 39
 
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
      * @param array $args
44 44
      * @return void|mixed
45 45
      */
46
-    protected function consoleEventHandler($args=array())
46
+    protected function consoleEventHandler($args = array())
47 47
     {
48
-        if(isset($this->app['eventDispatcher'])){
48
+        if (isset($this->app['eventDispatcher'])) {
49 49
 
50 50
             $listeners = event()->getListeners();
51 51
 
52
-            if(isset($args['event']) && isset($listeners['console'])){
52
+            if (isset($args['event']) && isset($listeners['console'])) {
53 53
 
54
-                if(strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])){
54
+                if (strtolower($args['event'])!=='default' && isset($listeners['console'][strtolower($args['event'])])) {
55 55
 
56 56
                     $event = $listeners['console'][strtolower($args['event'])];
57
-                    return call_user_func_array($event,['app'=>$this->app,'args'=>$args,]);
57
+                    return call_user_func_array($event, ['app'=>$this->app, 'args'=>$args, ]);
58 58
                 }
59 59
             }
60 60
 
61
-            if(isset($listeners['console']['default'])){
61
+            if (isset($listeners['console']['default'])) {
62 62
 
63 63
                 $event = $listeners['console']['default'];
64
-                return call_user_func_array($event,['args'=>$args,'app'=>$this->app]);
64
+                return call_user_func_array($event, ['args'=>$args, 'app'=>$this->app]);
65 65
             }
66 66
         }
67 67
 
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 
80 80
         //If the console executor is a custom console application; in this case we look at the kernel directory inside the application.
81 81
         //If the console class is not available on the kernel of resta, then the system will run the command class in the application.
82
-        return $this->checkConsoleNamespace(function(){
82
+        return $this->checkConsoleNamespace(function() {
83 83
 
84
-            if($this->isRunnableKernelCommandList()){
84
+            if ($this->isRunnableKernelCommandList()) {
85 85
                 exception()->badMethodCall('this command is not runnable');
86 86
             }
87 87
 
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
             $consoleArguments = $this->getConsoleArgumentsWithKey();
90 90
 
91 91
             // we get the instance data of the kernel command class of the system.
92
-            $commander = (new $this->consoleClassNamespace($consoleArguments,$this));
92
+            $commander = (new $this->consoleClassNamespace($consoleArguments, $this));
93 93
 
94 94
             // we check the command rules of each command class.
95
-            $this->prepareCommander($commander,function($commander){
95
+            $this->prepareCommander($commander, function($commander) {
96 96
                 return $commander->{$this->getConsoleClassMethod()}();
97 97
             });
98 98
 
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
     public function handle()
111 111
     {
112 112
         //get is running console
113
-        if($this->app->runningInConsole()){
113
+        if ($this->app->runningInConsole()) {
114 114
 
115 115
             error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
116 116
 
117 117
             //run console process
118
-            if(count($this->getArguments())){
118
+            if (count($this->getArguments())) {
119 119
                 return $this->consoleProcess();
120 120
             }
121 121
 
@@ -131,24 +131,24 @@  discard block
 block discarded – undo
131 131
      * @param callable $callback
132 132
      * @return mixed
133 133
      */
134
-    protected function prepareCommander(ConsoleOutputterContracts $commander,callable $callback)
134
+    protected function prepareCommander(ConsoleOutputterContracts $commander, callable $callback)
135 135
     {
136 136
         // closure binding custom command,move custom namespace as specific
137 137
         // call prepare commander firstly for checking command builder
138
-        $closureCommand = app()->resolve(ClosureDispatcher::class,['bind'=>$commander]);
138
+        $closureCommand = app()->resolve(ClosureDispatcher::class, ['bind'=>$commander]);
139 139
 
140 140
         //assign commander method name
141 141
         $closureCommand->prepareBind['methodName'] = $this->getConsoleClassMethod();
142 142
 
143 143
         $prepareCommander = $commander->prepareCommander($closureCommand);
144 144
 
145
-        if(!$prepareCommander['status']){
145
+        if (!$prepareCommander['status']) {
146 146
             echo $commander->exception($prepareCommander);
147 147
             die();
148 148
         }
149 149
 
150 150
         //callback custom console
151
-        return call_user_func_array($callback,[$commander]);
151
+        return call_user_func_array($callback, [$commander]);
152 152
     }
153 153
 
154 154
     /**
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
         $commandList = $this->app->commandList();
162 162
 
163 163
         //is runnable kernel command conditions
164
-        return !array_key_exists($this->consoleClassNamespace,$commandList) OR
165
-            (array_key_exists($this->consoleClassNamespace,$commandList) AND
164
+        return !array_key_exists($this->consoleClassNamespace, $commandList) OR
165
+            (array_key_exists($this->consoleClassNamespace, $commandList) AND
166 166
                 !$commandList[$this->consoleClassNamespace]['isRunnable']);
167 167
     }
168 168
 }
169 169
\ No newline at end of file
Please login to merge, or discard this patch.