Test Setup Failed
Push — master ( 008233...9946a0 )
by Php Easy Api
03:59
created
src/resta/Exception/ExceptionExtender.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
      * @param ApplicationContracts $app
23 23
      * @param array $result
24 24
      */
25
-    public function __construct(ApplicationContracts $app,$result=array())
25
+    public function __construct(ApplicationContracts $app, $result = array())
26 26
     {
27 27
         parent::__construct($app);
28 28
 
29 29
         $this->result = $result;
30 30
 
31
-        foreach($this->extender as $item){
32
-            if(method_exists($this,$item)){
31
+        foreach ($this->extender as $item) {
32
+            if (method_exists($this, $item)) {
33 33
                 $this->{$item}();
34 34
             }
35 35
         }
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
     {
45 45
         // we will look at the requestExpected container value to show
46 46
         // the expected values ​​for the request object in the exception output.
47
-        if(app()->has('requestExpected') && config('app.requestWithError')===true){
48
-            if($requestExpected = app()->get('requestExpected')){
47
+        if (app()->has('requestExpected') && config('app.requestWithError')===true) {
48
+            if ($requestExpected = app()->get('requestExpected')) {
49 49
                 $this->result['request']['expected'] = $requestExpected;
50 50
             }
51 51
         }
Please login to merge, or discard this patch.
src/resta/Exception/ErrorProvider.php 2 patches
Spacing   +74 added lines, -75 removed lines patch added patch discarded remove patch
@@ -48,34 +48,34 @@  discard block
 block discarded – undo
48 48
     {
49 49
         $exception = $this->exception;
50 50
 
51
-        if(isset(core()->exceptiontrace))
51
+        if (isset(core()->exceptiontrace))
52 52
         {
53 53
             $this->data['status'] = (int)core()->exceptiontrace['callNamespace']->getCode();
54 54
         }
55 55
         else {
56 56
 
57
-            $this->data['status']=(int)$exception::exceptionTypeCodes($this->data['errType']);
57
+            $this->data['status'] = (int)$exception::exceptionTypeCodes($this->data['errType']);
58 58
         }
59 59
 
60 60
         $this->app->terminate('responseSuccess');
61 61
         $this->app->terminate('responseStatus');
62
-        $this->app->register('responseSuccess',(bool)false);
63
-        $this->app->register('responseStatus',$this->data['status']);
62
+        $this->app->register('responseSuccess', (bool)false);
63
+        $this->app->register('responseStatus', $this->data['status']);
64 64
 
65 65
 
66
-        $optionalException = str_replace("\\","\\\\",$this->app->namespace()->exception());
66
+        $optionalException = str_replace("\\", "\\\\", $this->app->namespace()->exception());
67 67
 
68
-        if(preg_match('@'.$optionalException.'@is',$this->data['errType'])){
68
+        if (preg_match('@'.$optionalException.'@is', $this->data['errType'])) {
69 69
 
70 70
             //linux test
71 71
             $trace = $this->data['errContext']['trace'];
72
-            if(preg_match('@Stack trace:\n#0(.*)\n#1@is',$trace,$traceArray)){
72
+            if (preg_match('@Stack trace:\n#0(.*)\n#1@is', $trace, $traceArray)) {
73 73
 
74
-                $traceFile = str_replace(root,'',$traceArray[1]);
74
+                $traceFile = str_replace(root, '', $traceArray[1]);
75 75
 
76
-                if(preg_match('@(.*)\((\d+)\)@is',$traceFile,$traceResolve)){
77
-                    $this->data['errFile']=$traceResolve[1];
78
-                    $this->data['errLine']=(int)$traceResolve[2];
76
+                if (preg_match('@(.*)\((\d+)\)@is', $traceFile, $traceResolve)) {
77
+                    $this->data['errFile'] = $traceResolve[1];
78
+                    $this->data['errLine'] = (int)$traceResolve[2];
79 79
                 }
80 80
             }
81 81
 
@@ -83,15 +83,15 @@  discard block
 block discarded – undo
83 83
             $this->data['errType'] = class_basename($this->data['errType']);
84 84
         }
85 85
 
86
-        if(is_array($meta = config('response.meta'))){
86
+        if (is_array($meta = config('response.meta'))) {
87 87
 
88 88
             //set as the success object is false
89 89
             $this->data['appExceptionSuccess'] = [];
90 90
         }
91
-        else{
91
+        else {
92 92
 
93 93
             //set as the success object is false
94
-            $this->data['appExceptionSuccess'] = ['success'=>(bool)false,'status'=>$this->data['status']];
94
+            $this->data['appExceptionSuccess'] = ['success'=>(bool)false, 'status'=>$this->data['status']];
95 95
         }
96 96
     }
97 97
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
         //This function can be used for defining your own way of handling errors during runtime,
114 114
         //for example in applications in which you need to do cleanup of data/files when a critical error happens,
115 115
         //or when you need to trigger an error under certain conditions (using trigger_error()).
116
-        set_error_handler([$this,'setErrorHandler']);
116
+        set_error_handler([$this, 'setErrorHandler']);
117 117
 
118 118
         //Registers a callback to be executed after script execution finishes or exit() is called.
119 119
         //Multiple calls to register_shutdown_function() can be made, and each will be called in the same order as
120 120
         //they were registered. If you call exit() within one registered shutdown function,
121 121
         //processing will stop completely and no other registered shutdown functions will be called.
122
-        register_shutdown_function([$this,'fatalErrorShutdownHandler']);
122
+        register_shutdown_function([$this, 'fatalErrorShutdownHandler']);
123 123
     }
124 124
 
125 125
     /**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * @param null|string $errLine
132 132
      * @param null|string $errContext
133 133
      */
134
-    public function setErrorHandler($errNo=null, $errStr=null, $errFile=null, $errLine=null, $errContext=null)
134
+    public function setErrorHandler($errNo = null, $errStr = null, $errFile = null, $errLine = null, $errContext = null)
135 135
     {
136 136
         // in case of a deficiency,
137 137
         // we need to boot our general needs to be needed for the exception.
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         //get lang message for exception
159 159
         $this->getLangMessageForException();
160 160
 
161
-        if(property_exists(core(),'exceptiontrace')){
161
+        if (property_exists(core(), 'exceptiontrace')) {
162 162
 
163 163
             $customExceptionTrace   = core()->exceptiontrace;
164 164
             $this->data['errFile']  = $customExceptionTrace['file'];
@@ -167,38 +167,37 @@  discard block
 block discarded – undo
167 167
 
168 168
         $environment = $this->getEnvironmentStatus();
169 169
 
170
-        $vendorDirectory = str_replace(root.''.DIRECTORY_SEPARATOR.'','',$this->data['errFile']);
170
+        $vendorDirectory = str_replace(root.''.DIRECTORY_SEPARATOR.'', '', $this->data['errFile']);
171 171
 
172
-        if(Str::startsWith($vendorDirectory,'vendor')
173
-            && Str::startsWith($vendorDirectory,'vendor/php-resta')===false)
172
+        if (Str::startsWith($vendorDirectory, 'vendor')
173
+            && Str::startsWith($vendorDirectory, 'vendor/php-resta')===false)
174 174
         {
175 175
             $externalMessage = ($environment==="production") ?
176
-                'An unexpected external error has occurred' :
177
-                $this->data['errStrReal'];
176
+                'An unexpected external error has occurred' : $this->data['errStrReal'];
178 177
 
179
-            $this->result = $this->getAppException($environment,$externalMessage);
178
+            $this->result = $this->getAppException($environment, $externalMessage);
180 179
 
181 180
 
182 181
             //Get or Set the HTTP response code
183 182
             http_response_code(500);
184 183
             $this->app->terminate('responseStatus');
185
-            $this->app->register('responseStatus',500);
184
+            $this->app->register('responseStatus', 500);
186 185
 
187 186
 
188 187
         }
189
-        else{
188
+        else {
190 189
 
191
-            $this->result = $this->getAppException($environment,$this->data['errStrReal']);
190
+            $this->result = $this->getAppException($environment, $this->data['errStrReal']);
192 191
 
193 192
             //Get or Set the HTTP response code
194 193
             http_response_code($this->data['status']);
195 194
         }
196 195
 
197 196
 
198
-        if($environment==="production"){
197
+        if ($environment==="production") {
199 198
 
200
-            $productionLogMessage = $this->getAppException('local',$this->data['errStrReal']);
201
-            $this->app->register('productionLogMessage',core()->out->outputFormatter($productionLogMessage));
199
+            $productionLogMessage = $this->getAppException('local', $this->data['errStrReal']);
200
+            $this->app->register('productionLogMessage', core()->out->outputFormatter($productionLogMessage));
202 201
         }
203 202
 
204 203
         // exception extender The exception information
@@ -211,11 +210,11 @@  discard block
 block discarded – undo
211 210
 
212 211
         $restaOutHandle = null;
213 212
 
214
-        if(!defined('responseApp')){
215
-            $restaOutHandle=core()->out->handle();
213
+        if (!defined('responseApp')) {
214
+            $restaOutHandle = core()->out->handle();
216 215
         }
217 216
 
218
-        if($restaOutHandle===null){
217
+        if ($restaOutHandle===null) {
219 218
 
220 219
             //header set and symfony response call
221 220
             header('Content-type:application/json;charset=utf-8');
@@ -223,7 +222,7 @@  discard block
 block discarded – undo
223 222
             echo json_encode(core()->out->outputFormatter($this->result));
224 223
             exit();
225 224
         }
226
-        else{
225
+        else {
227 226
             echo $restaOutHandle;
228 227
             exit();
229 228
         }
@@ -233,7 +232,7 @@  discard block
 block discarded – undo
233 232
      * @param $environment
234 233
      * @return mixed
235 234
      */
236
-    private function getAppException($environment,$message)
235
+    private function getAppException($environment, $message)
237 236
     {
238 237
         return $this->data['appExceptionSuccess']+$this->data['exception']::$environment(
239 238
                 $this->data['errNo'],
@@ -268,13 +267,13 @@  discard block
 block discarded – undo
268 267
 
269 268
         $this->inStackTrace($last_error);
270 269
 
271
-        if(!is_null($last_error)){
270
+        if (!is_null($last_error)) {
272 271
 
273
-            if(!defined('methodName')){
274
-                define('methodName',null);
272
+            if (!defined('methodName')) {
273
+                define('methodName', null);
275 274
             }
276 275
 
277
-            if(isset(core()->exceptionFile)){
276
+            if (isset(core()->exceptionFile)) {
278 277
                 $last_error['file'] = core()->exceptionFile;
279 278
                 $last_error['line'] = core()->exceptionLine;
280 279
             }
@@ -294,12 +293,12 @@  discard block
 block discarded – undo
294 293
      */
295 294
     public function inStackTrace($error)
296 295
     {
297
-        if(isset(core()->urlComponent)){
298
-            if(!preg_match('@'.core()->urlComponent['project'].'@',$error['file']) && !isset(core()->exceptionFile)){
299
-                if(preg_match('@ in\s(.*?)\n@is',$error['message'],$result)){
300
-                    $errorMessage = explode(":",$result[1]);
301
-                    $this->app->register('exceptionFile',$errorMessage[0]);
302
-                    $this->app->register('exceptionLine',$errorMessage[1]);
296
+        if (isset(core()->urlComponent)) {
297
+            if (!preg_match('@'.core()->urlComponent['project'].'@', $error['file']) && !isset(core()->exceptionFile)) {
298
+                if (preg_match('@ in\s(.*?)\n@is', $error['message'], $result)) {
299
+                    $errorMessage = explode(":", $result[1]);
300
+                    $this->app->register('exceptionFile', $errorMessage[0]);
301
+                    $this->app->register('exceptionLine', $errorMessage[1]);
303 302
                 }
304 303
             }
305 304
         }
@@ -312,48 +311,48 @@  discard block
 block discarded – undo
312 311
     {
313 312
         $clone = clone $this;
314 313
 
315
-        if(property_exists(core(),'exceptionTranslate')){
314
+        if (property_exists(core(), 'exceptionTranslate')) {
316 315
 
317
-            $langMessage=trans('exception.'.core()->exceptionTranslate);
316
+            $langMessage = trans('exception.'.core()->exceptionTranslate);
318 317
 
319
-            if(!is_null($langMessage) && property_exists(core(),'exceptionTranslateParams')){
318
+            if (!is_null($langMessage) && property_exists(core(), 'exceptionTranslateParams')) {
320 319
 
321
-                if(count(core()->exceptionTranslateParams[core()->exceptionTranslate])){
322
-                    foreach (core()->exceptionTranslateParams[core()->exceptionTranslate] as $key=>$value){
323
-                        $langMessage=preg_replace('@\('.$key.'\)@is',$value,$langMessage);
320
+                if (count(core()->exceptionTranslateParams[core()->exceptionTranslate])) {
321
+                    foreach (core()->exceptionTranslateParams[core()->exceptionTranslate] as $key=>$value) {
322
+                        $langMessage = preg_replace('@\('.$key.'\)@is', $value, $langMessage);
324 323
                     }
325 324
                 }
326 325
             }
327 326
 
328
-            if($langMessage!==null){
329
-                $this->data['errStrReal']=$langMessage;
327
+            if ($langMessage!==null) {
328
+                $this->data['errStrReal'] = $langMessage;
330 329
             }
331 330
         }
332 331
 
333
-        if(class_exists($this->data['errorClassNamespace'])
332
+        if (class_exists($this->data['errorClassNamespace'])
334 333
             &&
335
-            (Str::startsWith($this->data['errorClassNamespace'],'App')
336
-                || Str::startsWith($this->data['errorClassNamespace'],__NAMESPACE__))){
334
+            (Str::startsWith($this->data['errorClassNamespace'], 'App')
335
+                || Str::startsWith($this->data['errorClassNamespace'], __NAMESPACE__))) {
337 336
 
338 337
             ClosureDispatcher::bind($this->data['errorClassNamespace'])->call(function() use ($clone) {
339
-                if(property_exists($this,'lang')){
340
-                    $clone->lang=$this->lang;
338
+                if (property_exists($this, 'lang')) {
339
+                    $clone->lang = $this->lang;
341 340
                 }
342 341
             });
343 342
         }
344 343
 
345
-        $this->data['lang']=$lang=$clone->lang;
344
+        $this->data['lang'] = $lang = $clone->lang;
346 345
 
347
-        if($lang!==null){
348
-            $langMessage=trans('exception.'.$lang);
346
+        if ($lang!==null) {
347
+            $langMessage = trans('exception.'.$lang);
349 348
         }
350
-        else{
351
-            $langMessage=null;
349
+        else {
350
+            $langMessage = null;
352 351
         }
353 352
 
354 353
 
355
-        if($langMessage!==null){
356
-            $this->data['errStrReal']=$langMessage;
354
+        if ($langMessage!==null) {
355
+            $this->data['errStrReal'] = $langMessage;
357 356
         }
358 357
     }
359 358
 
@@ -366,22 +365,22 @@  discard block
 block discarded – undo
366 365
     {
367 366
         // catch exception via preg match
368 367
         // and then clear the Uncaught statement from inside.
369
-        if(preg_match('@(.*?):@is',$this->data['errStrReal'],$errArr)){
368
+        if (preg_match('@(.*?):@is', $this->data['errStrReal'], $errArr)) {
370 369
 
371
-            $this->data['errType']=trim(str_replace('Uncaught','',$errArr[1]));
372
-            $this->data['errorClassNamespace']=$this->data['errType'];
370
+            $this->data['errType'] = trim(str_replace('Uncaught', '', $errArr[1]));
371
+            $this->data['errorClassNamespace'] = $this->data['errType'];
373 372
         }
374 373
 
375
-        if(preg_match('@Uncaught@is',$this->data['errStrReal'])
376
-            && preg_match('@(.*?):(.*?)\sin\s@is',$this->data['errStrReal'],$errStrRealArray)){
377
-            $this->data['errStrReal']=trim($errStrRealArray[2]);
374
+        if (preg_match('@Uncaught@is', $this->data['errStrReal'])
375
+            && preg_match('@(.*?):(.*?)\sin\s@is', $this->data['errStrReal'], $errStrRealArray)) {
376
+            $this->data['errStrReal'] = trim($errStrRealArray[2]);
378 377
         }
379 378
 
380
-        if($this->data['errType']==="Undefined"){
381
-            $this->data['errStrReal']=$this->data['errStrReal'];
379
+        if ($this->data['errType']==="Undefined") {
380
+            $this->data['errStrReal'] = $this->data['errStrReal'];
382 381
         }
383
-        else{
384
-            $this->data['errContext']['trace']=$this->data['errStrReal'];
382
+        else {
383
+            $this->data['errContext']['trace'] = $this->data['errStrReal'];
385 384
         }
386 385
     }
387 386
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@  discard block
 block discarded – undo
51 51
         if(isset(core()->exceptiontrace))
52 52
         {
53 53
             $this->data['status'] = (int)core()->exceptiontrace['callNamespace']->getCode();
54
-        }
55
-        else {
54
+        } else {
56 55
 
57 56
             $this->data['status']=(int)$exception::exceptionTypeCodes($this->data['errType']);
58 57
         }
@@ -87,8 +86,7 @@  discard block
 block discarded – undo
87 86
 
88 87
             //set as the success object is false
89 88
             $this->data['appExceptionSuccess'] = [];
90
-        }
91
-        else{
89
+        } else{
92 90
 
93 91
             //set as the success object is false
94 92
             $this->data['appExceptionSuccess'] = ['success'=>(bool)false,'status'=>$this->data['status']];
@@ -185,8 +183,7 @@  discard block
 block discarded – undo
185 183
             $this->app->register('responseStatus',500);
186 184
 
187 185
 
188
-        }
189
-        else{
186
+        } else{
190 187
 
191 188
             $this->result = $this->getAppException($environment,$this->data['errStrReal']);
192 189
 
@@ -222,8 +219,7 @@  discard block
 block discarded – undo
222 219
 
223 220
             echo json_encode(core()->out->outputFormatter($this->result));
224 221
             exit();
225
-        }
226
-        else{
222
+        } else{
227 223
             echo $restaOutHandle;
228 224
             exit();
229 225
         }
@@ -346,8 +342,7 @@  discard block
 block discarded – undo
346 342
 
347 343
         if($lang!==null){
348 344
             $langMessage=trans('exception.'.$lang);
349
-        }
350
-        else{
345
+        } else{
351 346
             $langMessage=null;
352 347
         }
353 348
 
@@ -379,8 +374,7 @@  discard block
 block discarded – undo
379 374
 
380 375
         if($this->data['errType']==="Undefined"){
381 376
             $this->data['errStrReal']=$this->data['errStrReal'];
382
-        }
383
-        else{
377
+        } else{
384 378
             $this->data['errContext']['trace']=$this->data['errStrReal'];
385 379
         }
386 380
     }
Please login to merge, or discard this patch.
src/resta/Console/ConsoleArguments.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function getArguments()
17 17
     {
18 18
         //if there is no arguments constant
19
-        if(!defined('arguments'))  define ('arguments',['api']);
19
+        if (!defined('arguments'))  define('arguments', ['api']);
20 20
 
21 21
         //get psr standard console arguments
22 22
         return core()->consoleArguments = Utils::upperCase(arguments);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function getConsoleClassRealArguments()
51 51
     {
52
-        return array_slice($this->getArguments(),2);
52
+        return array_slice($this->getArguments(), 2);
53 53
     }
54 54
 
55 55
     /**
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
         $listKey = [];
66 66
         $listKey['project'] = null;
67 67
 
68
-        if(property_exists($this,'consoleClassNamespace')){
68
+        if (property_exists($this, 'consoleClassNamespace')) {
69 69
             $listKey['class'] = strtolower(class_basename($this->consoleClassNamespace));
70 70
             $listKey['classMethod'] = strtolower($this->getConsoleClassMethod());
71 71
         }
72 72
 
73
-        foreach($getConsoleClassRealArguments as $key=>$value){
73
+        foreach ($getConsoleClassRealArguments as $key=>$value) {
74 74
 
75
-            if($key=="0"){
75
+            if ($key=="0") {
76 76
                 $listKey['project'] = $value;
77 77
             }
78
-            else{
78
+            else {
79 79
 
80
-                $colonExplode = explode(":",$value);
80
+                $colonExplode = explode(":", $value);
81 81
                 $listKey[strtolower($colonExplode[0])] = ucfirst($colonExplode[1]);
82 82
             }
83 83
         }
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 
110 110
         $this->getConsoleArgumentsWithKey();
111 111
 
112
-        if(isset($arguments[2])){
112
+        if (isset($arguments[2])) {
113 113
             $app = $arguments[2];
114 114
         }
115 115
 
116
-        if(!defined('group')){
117
-            define('group',StaticPathList::$projectPrefixGroup);
116
+        if (!defined('group')) {
117
+            define('group', StaticPathList::$projectPrefixGroup);
118 118
         }
119 119
 
120
-        if(!defined('app') and isset($arguments[2])) define('app',isset($app) ? $app : null);
120
+        if (!defined('app') and isset($arguments[2])) define('app', isset($app) ? $app : null);
121 121
     }
122 122
 }
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
     public function getArguments()
17 17
     {
18 18
         //if there is no arguments constant
19
-        if(!defined('arguments'))  define ('arguments',['api']);
19
+        if(!defined('arguments')) {
20
+            define ('arguments',['api']);
21
+        }
20 22
 
21 23
         //get psr standard console arguments
22 24
         return core()->consoleArguments = Utils::upperCase(arguments);
@@ -74,8 +76,7 @@  discard block
 block discarded – undo
74 76
 
75 77
             if($key=="0"){
76 78
                 $listKey['project'] = $value;
77
-            }
78
-            else{
79
+            } else{
79 80
 
80 81
                 $colonExplode = explode(":",$value);
81 82
                 $listKey[strtolower($colonExplode[0])] = ucfirst($colonExplode[1]);
@@ -117,6 +118,8 @@  discard block
 block discarded – undo
117 118
             define('group',StaticPathList::$projectPrefixGroup);
118 119
         }
119 120
 
120
-        if(!defined('app') and isset($arguments[2])) define('app',isset($app) ? $app : null);
121
+        if(!defined('app') and isset($arguments[2])) {
122
+            define('app',isset($app) ? $app : null);
123
+        }
121 124
     }
122 125
 }
123 126
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Contracts/ConsoleOutputterContracts.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,6 +14,6 @@
 block discarded – undo
14 14
      * @param array $commander
15 15
      * @return mixed
16 16
      */
17
-    public function exception($commander=array());
17
+    public function exception($commander = array());
18 18
 
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
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,10 +110,10 @@  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
             //run console process
116
-            if(count($this->getArguments())){
116
+            if (count($this->getArguments())) {
117 117
                 return $this->consoleProcess();
118 118
             }
119 119
 
@@ -129,24 +129,24 @@  discard block
 block discarded – undo
129 129
      * @param callable $callback
130 130
      * @return mixed
131 131
      */
132
-    protected function prepareCommander(ConsoleOutputterContracts $commander,callable $callback)
132
+    protected function prepareCommander(ConsoleOutputterContracts $commander, callable $callback)
133 133
     {
134 134
         // closure binding custom command,move custom namespace as specific
135 135
         // call prepare commander firstly for checking command builder
136
-        $closureCommand = app()->resolve(ClosureDispatcher::class,['bind'=>$commander]);
136
+        $closureCommand = app()->resolve(ClosureDispatcher::class, ['bind'=>$commander]);
137 137
 
138 138
         //assign commander method name
139 139
         $closureCommand->prepareBind['methodName'] = $this->getConsoleClassMethod();
140 140
 
141 141
         $prepareCommander = $commander->prepareCommander($closureCommand);
142 142
 
143
-        if(!$prepareCommander['status']){
143
+        if (!$prepareCommander['status']) {
144 144
             echo $commander->exception($prepareCommander);
145 145
             die();
146 146
         }
147 147
 
148 148
         //callback custom console
149
-        return call_user_func_array($callback,[$commander]);
149
+        return call_user_func_array($callback, [$commander]);
150 150
     }
151 151
 
152 152
     /**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
         $commandList = $this->app->commandList();
160 160
 
161 161
         //is runnable kernel command conditions
162
-        return !array_key_exists($this->consoleClassNamespace,$commandList) OR
163
-            (array_key_exists($this->consoleClassNamespace,$commandList) AND
162
+        return !array_key_exists($this->consoleClassNamespace, $commandList) OR
163
+            (array_key_exists($this->consoleClassNamespace, $commandList) AND
164 164
                 !$commandList[$this->consoleClassNamespace]['isRunnable']);
165 165
     }
166 166
 }
167 167
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Contracts/ExceptionContracts.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,83 +8,83 @@
 block discarded – undo
8 8
      * @param null|string $msg
9 9
      * @return mixed
10 10
      */
11
-    public function invalidArgument($msg=null);
11
+    public function invalidArgument($msg = null);
12 12
 
13 13
     /**
14 14
      * @param null|string $msg
15 15
      * @return mixed
16 16
      */
17
-    public function badFunctionCall($msg=null);
17
+    public function badFunctionCall($msg = null);
18 18
 
19 19
     /**
20 20
      * @param null|string $msg
21 21
      * @return mixed
22 22
      */
23
-    public function badMethodCall($msg=null);
23
+    public function badMethodCall($msg = null);
24 24
 
25 25
     /**
26 26
      * @param null|string $msg
27 27
      * @return mixed
28 28
      */
29
-    public function domain($msg=null);
29
+    public function domain($msg = null);
30 30
 
31 31
     /**
32 32
      * @param null|string $msg
33 33
      * @return mixed
34 34
      */
35
-    public function length($msg=null);
35
+    public function length($msg = null);
36 36
 
37 37
     /**
38 38
      * @param null|string $msg
39 39
      * @return mixed
40 40
      */
41
-    public function logic($msg=null);
41
+    public function logic($msg = null);
42 42
 
43 43
     /**
44 44
      * @param null|string $msg
45 45
      * @return mixed
46 46
      */
47
-    public function notFoundException($msg=null);
47
+    public function notFoundException($msg = null);
48 48
 
49 49
     /**
50 50
      * @param null|string $msg
51 51
      * @return mixed
52 52
      */
53
-    public function fileNotFoundException($msg=null);
53
+    public function fileNotFoundException($msg = null);
54 54
 
55 55
     /**
56 56
      * @param null|string $msg
57 57
      * @return mixed
58 58
      */
59
-    public function outOfRange($msg=null);
59
+    public function outOfRange($msg = null);
60 60
 
61 61
     /**
62 62
      * @param null|string $msg
63 63
      * @return mixed
64 64
      */
65
-    public function overflow($msg=null);
65
+    public function overflow($msg = null);
66 66
 
67 67
     /**
68 68
      * @param null|string $msg
69 69
      * @return mixed
70 70
      */
71
-    public function range($msg=null);
71
+    public function range($msg = null);
72 72
 
73 73
     /**
74 74
      * @param null|string $msg
75 75
      * @return mixed
76 76
      */
77
-    public function runtime($msg=null);
77
+    public function runtime($msg = null);
78 78
 
79 79
     /**
80 80
      * @param null|string $msg
81 81
      * @return mixed
82 82
      */
83
-    public function underflow($msg=null);
83
+    public function underflow($msg = null);
84 84
 
85 85
     /**
86 86
      * @param null|string $msg
87 87
      * @return mixed
88 88
      */
89
-    public function unexpectedValue($msg=null);
89
+    public function unexpectedValue($msg = null);
90 90
 }
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Exception/ExceptionManager.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @param null|string $msg
28 28
      */
29
-    public function invalidArgument($msg=null)
29
+    public function invalidArgument($msg = null)
30 30
     {
31 31
         throw new InvalidArgumentException($msg);
32 32
     }
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @param null|string $msg
38 38
      */
39
-    public function badFunctionCall($msg=null)
39
+    public function badFunctionCall($msg = null)
40 40
     {
41 41
         throw new BadFunctionCallException($msg);
42 42
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      *
47 47
      * @param null|string $msg
48 48
      */
49
-    public function badMethodCall($msg=null)
49
+    public function badMethodCall($msg = null)
50 50
     {
51 51
         throw new BadMethodCallException($msg);
52 52
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @param null|string $msg
58 58
      */
59
-    public function domain($msg=null)
59
+    public function domain($msg = null)
60 60
     {
61 61
         throw new DomainException($msg);
62 62
     }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @param null|string $msg
68 68
      */
69
-    public function length($msg=null)
69
+    public function length($msg = null)
70 70
     {
71 71
         throw new LengthException($msg);
72 72
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      *
77 77
      * @param null|string $msg
78 78
      */
79
-    public function logic($msg=null)
79
+    public function logic($msg = null)
80 80
     {
81 81
         throw new LogicException($msg);
82 82
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @return mixed|void
89 89
      *
90 90
      */
91
-    public function notFoundException($msg=null)
91
+    public function notFoundException($msg = null)
92 92
     {
93 93
         return $this->notFound($msg);
94 94
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @return mixed|void
101 101
      *
102 102
      */
103
-    public function fileNotFoundException($msg=null)
103
+    public function fileNotFoundException($msg = null)
104 104
     {
105 105
         return $this->fileNotFound($msg);
106 106
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      *
111 111
      * @param null|string $msg
112 112
      */
113
-    public function outOfRange($msg=null)
113
+    public function outOfRange($msg = null)
114 114
     {
115 115
         throw new OutOfRangeException($msg);
116 116
     }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      *
121 121
      * @param null|string $msg
122 122
      */
123
-    public function overflow($msg=null)
123
+    public function overflow($msg = null)
124 124
     {
125 125
         throw new OverflowException($msg);
126 126
     }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      *
131 131
      * @param null|string $msg
132 132
      */
133
-    public function range($msg=null)
133
+    public function range($msg = null)
134 134
     {
135 135
         throw new RangeException($msg);
136 136
     }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      *
141 141
      * @param null|string $msg
142 142
      */
143
-    public function runtime($msg=null)
143
+    public function runtime($msg = null)
144 144
     {
145 145
         throw new RuntimeException($msg);
146 146
     }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      *
151 151
      * @param null|string $msg
152 152
      */
153
-    public function underflow($msg=null)
153
+    public function underflow($msg = null)
154 154
     {
155 155
         throw new UnderflowException($msg);
156 156
     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      *
161 161
      * @param null|string $msg
162 162
      */
163
-    public function unexpectedValue($msg=null)
163
+    public function unexpectedValue($msg = null)
164 164
     {
165 165
         throw new UnexpectedValueException($msg);
166 166
     }
Please login to merge, or discard this patch.
src/resta/Support/FileSystem.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $path = realpath($path) ?: $path;
131 131
         $tempPath = tempnam(dirname($path), basename($path));
132 132
         // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600...
133
-        chmod($tempPath, 0777 - umask());
133
+        chmod($tempPath, 0777-umask());
134 134
         file_put_contents($tempPath, $content);
135 135
         rename($tempPath, $path);
136 136
     }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $success = true;
190 190
         foreach ($paths as $path) {
191 191
             try {
192
-                if (! @unlink($path)) {
192
+                if (!@unlink($path)) {
193 193
                     $success = false;
194 194
                 }
195 195
             } catch (ErrorException $e) {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function link($target, $link)
234 234
     {
235
-        if (! windows_os()) {
235
+        if (!windows_os()) {
236 236
             return symlink($target, $link);
237 237
         }
238 238
         $mode = $this->isDirectory($target) ? 'J' : 'H';
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     public function files($directory, $hidden = false)
394 394
     {
395 395
         return iterator_to_array(
396
-            Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(),
396
+            Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->depth(0)->sortByName(),
397 397
             false
398 398
         );
399 399
     }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
     public function allFiles($directory, $hidden = false)
409 409
     {
410 410
         return iterator_to_array(
411
-            Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(),
411
+            Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->sortByName(),
412 412
             false
413 413
         );
414 414
     }
@@ -455,10 +455,10 @@  discard block
 block discarded – undo
455 455
      */
456 456
     public function moveDirectory($from, $to, $overwrite = false)
457 457
     {
458
-        if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) {
458
+        if ($overwrite && $this->isDirectory($to) && !$this->deleteDirectory($to)) {
459 459
             return false;
460 460
         }
461
-        return @rename($from, $to) === true;
461
+        return @rename($from, $to)===true;
462 462
     }
463 463
 
464 464
     /**
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
      */
472 472
     public function copyDirectory($directory, $destination, $options = null)
473 473
     {
474
-        if (! $this->isDirectory($directory)) {
474
+        if (!$this->isDirectory($directory)) {
475 475
             return false;
476 476
         }
477 477
         $options = $options ?: FilesystemIterator::SKIP_DOTS;
478 478
         // If the destination directory does not actually exist, we will go ahead and
479 479
         // create it recursively, which just gets the destination prepared to copy
480 480
         // the files over. Once we make the directory we'll proceed the copying.
481
-        if (! $this->isDirectory($destination)) {
481
+        if (!$this->isDirectory($destination)) {
482 482
             $this->makeDirectory($destination, 0777, true);
483 483
         }
484 484
         $items = new FilesystemIterator($directory, $options);
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             $target = $destination.'/'.$item->getBasename();
490 490
             if ($item->isDir()) {
491 491
                 $path = $item->getPathname();
492
-                if (! $this->copyDirectory($path, $target, $options)) {
492
+                if (!$this->copyDirectory($path, $target, $options)) {
493 493
                     return false;
494 494
                 }
495 495
             }
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
             // location and keep looping. If for some reason the copy fails we'll bail out
498 498
             // and return false, so the developer is aware that the copy process failed.
499 499
             else {
500
-                if (! $this->copy($item->getPathname(), $target)) {
500
+                if (!$this->copy($item->getPathname(), $target)) {
501 501
                     return false;
502 502
                 }
503 503
             }
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
      */
517 517
     public function deleteDirectory($directory, $preserve = false)
518 518
     {
519
-        if (! $this->isDirectory($directory)) {
519
+        if (!$this->isDirectory($directory)) {
520 520
             return false;
521 521
         }
522 522
         $items = new FilesystemIterator($directory);
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
             // If the item is a directory, we can just recurse into the function and
525 525
             // delete that sub-directory otherwise we'll just delete the file and
526 526
             // keep iterating through each file until the directory is cleaned.
527
-            if ($item->isDir() && ! $item->isLink()) {
527
+            if ($item->isDir() && !$item->isLink()) {
528 528
                 $this->deleteDirectory($item->getPathname());
529 529
             }
530 530
             // If the item is just a file, we can go ahead and delete it since we're
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
                 $this->delete($item->getPathname());
535 535
             }
536 536
         }
537
-        if (! $preserve) {
537
+        if (!$preserve) {
538 538
             @rmdir($directory);
539 539
         }
540 540
         return true;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     public function deleteDirectories($directory)
550 550
     {
551 551
         $allDirectories = $this->directories($directory);
552
-        if (! empty($allDirectories)) {
552
+        if (!empty($allDirectories)) {
553 553
             foreach ($allDirectories as $directoryName) {
554 554
                 $this->deleteDirectory($directoryName);
555 555
             }
Please login to merge, or discard this patch.