Test Setup Failed
Push — master ( 918bd3...3369db )
by Php Easy Api
03:49
created
src/resta/Container/ContainerResolve.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @throws \ReflectionException
25 25
      */
26
-    public function call($class,$param,callable $callback)
26
+    public function call($class, $param, callable $callback)
27 27
     {
28 28
         // We use the reflection class to solve
29 29
         // the parameters of the class's methods.
30
-        $param = $this->reflectionMethodParameters($class,$param);
30
+        $param = $this->reflectionMethodParameters($class, $param);
31 31
 
32 32
         // the results of a number of processes will be given
33 33
         // before the container pipeline method is given.
34 34
         return $this->app->resolve(ContainerPipelineResolve::class)->handle(
35
-            function() use($class,$param,$callback)
35
+            function() use($class, $param, $callback)
36 36
             {
37 37
                 // as a result
38 38
                 // we return the resolved class to the callback class
39
-                $params = (object)['class'=>$class,'param'=>$param];
40
-                return call_user_func_array($callback,[$params]);
39
+                $params = (object)['class'=>$class, 'param'=>$param];
40
+                return call_user_func_array($callback, [$params]);
41 41
             });
42 42
 
43 43
     }
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
      * @param $parameter
50 50
      * @return array
51 51
      */
52
-    private function checkParameterForContainer($containers,$parameter)
52
+    private function checkParameterForContainer($containers, $parameter)
53 53
     {
54 54
         $containerParameterNameValue = false;
55 55
 
56
-        if(isset($containers[$parameter->getType()->getName()])){
56
+        if (isset($containers[$parameter->getType()->getName()])) {
57 57
             $parameterNameResolve = $parameter->getType()->getName();
58 58
             $containerParameterNameValue = true;
59 59
         }
60 60
 
61
-        if(!$containerParameterNameValue && isset($containers[$parameter->getName()])){
61
+        if (!$containerParameterNameValue && isset($containers[$parameter->getName()])) {
62 62
             $parameterNameResolve = $parameter->getName();
63 63
             $containerParameterNameValue = true;
64 64
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         // if the parameter is an object and
67 67
         // this object is a service container object
68 68
         // then the parameter will bind.
69
-        if($parameter->getType()!==null && $containerParameterNameValue){
69
+        if ($parameter->getType()!==null && $containerParameterNameValue) {
70 70
 
71 71
             // Unpack the container object and
72 72
             // bind it to the param variable.
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
             return [$parameterName=>$parameterResolve];
86 86
         }
87 87
 
88
-        if($parameter->getType()!== NULL && Utils::isNamespaceExists($parameterNameResolve)){
88
+        if ($parameter->getType()!==NULL && Utils::isNamespaceExists($parameterNameResolve)) {
89 89
 
90 90
             // Unpack the container object and
91 91
             // bind it to the param variable.
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
      */
109 109
     private function getReflectionMethod($class)
110 110
     {
111
-        if(!isset($class[0],$class[1])){
111
+        if (!isset($class[0], $class[1])) {
112 112
             exception('containerResolvingMissing')
113 113
                 ->runtime('Container class resolving is missing');
114 114
         }
115 115
 
116
-        [$class,$method] = [$class[0],$class[1]];
116
+        [$class, $method] = [$class[0], $class[1]];
117 117
 
118 118
         return $this->instanceReflection($this->app['reflection']($class))
119 119
             ->reflectionMethodParams($method);
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
      * @param $instance
126 126
      * @return object|null
127 127
      */
128
-    public function instanceReflection($instance=null)
128
+    public function instanceReflection($instance = null)
129 129
     {
130
-        if(is_object($instance) && is_null(static::$reflectionInstance)){
130
+        if (is_object($instance) && is_null(static::$reflectionInstance)) {
131 131
             static::$reflectionInstance = $instance;
132 132
         }
133 133
 
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
      *
144 144
      * @throws \ReflectionException
145 145
      */
146
-    private function reflectionMethodParameters($class,$param)
146
+    private function reflectionMethodParameters($class, $param)
147 147
     {
148 148
         $containers = [];
149 149
 
150 150
         //get service container objects.
151
-        if(isset($this->app['serviceContainer'])){
151
+        if (isset($this->app['serviceContainer'])) {
152 152
             $containers = $this->app['serviceContainer'];
153 153
         }
154 154
 
@@ -161,23 +161,23 @@  discard block
 block discarded – undo
161 161
         // we provide the user with the container method document and take action.
162 162
         // thus, we help the methods to have a cleaner code structure.
163 163
         $this->app->resolve(ContainerMethodDocumentResolver::class,
164
-            ['reflection'=>$this->instanceReflection(),'class'=>$class]);
164
+            ['reflection'=>$this->instanceReflection(), 'class'=>$class]);
165 165
 
166 166
         // we group the parameters into type and
167 167
         // name and bind them with the necessary logic.
168
-        foreach ($parameters as $parameter){
168
+        foreach ($parameters as $parameter) {
169 169
 
170 170
             // if the parameter is an object and
171 171
             // this object is a service container object
172 172
             // then the parameter will bind.
173
-            $checkParameterForContainer = $this->checkParameterForContainer($containers,$parameter);
173
+            $checkParameterForContainer = $this->checkParameterForContainer($containers, $parameter);
174 174
 
175
-            $paramMerge = array_merge($param,$checkParameterForContainer);
175
+            $paramMerge = array_merge($param, $checkParameterForContainer);
176 176
 
177 177
             // we do some useful logic bind for user benefit.
178
-            $param = app()->resolve(GraceContainer::class,[
178
+            $param = app()->resolve(GraceContainer::class, [
179 179
                 'reflection' => $reflection->reflection
180
-            ])->graceContainerBuilder($parameter,$paramMerge);
180
+            ])->graceContainerBuilder($parameter, $paramMerge);
181 181
 
182 182
         }
183 183
 
Please login to merge, or discard this patch.
src/resta/Client/Client.php 2 patches
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @throws ReflectionExceptionAlias
53 53
      */
54
-    public function __construct($clientData=null)
54
+    public function __construct($clientData = null)
55 55
     {
56 56
         //reflection process
57 57
         $this->reflection = app()['reflection']($this);
@@ -74,25 +74,25 @@  discard block
 block discarded – undo
74 74
     private function autoValidate($validate)
75 75
     {
76 76
         //we get the values ​​to auto-validate.
77
-        foreach ($this->{$validate} as $object=>$datas){
77
+        foreach ($this->{$validate} as $object=>$datas) {
78 78
 
79 79
             // the auto-validate value must necessarily represent a class.
80 80
             // otherwise auto-validate is not used.
81
-            if(Utils::isNamespaceExists($object)){
81
+            if (Utils::isNamespaceExists($object)) {
82 82
                 $getObjectInstance = app()->resolve($object);
83 83
 
84 84
                 // we get the index values,
85 85
                 // which are called methods of the auto-validate value that represents the class.
86
-                foreach ($datas as $dataKey=>$data){
86
+                foreach ($datas as $dataKey=>$data) {
87 87
 
88 88
                     // if the methods of the auto-validate class resolved by the container resolve method apply,
89 89
                     // the process of auto-validate automatic implementation will be completed.
90
-                    if(is_numeric($dataKey) && method_exists($getObjectInstance,$data)){
91
-                        if(isset($this->origin[$data])){
92
-                            if(!is_array($this->origin[$data])){
90
+                    if (is_numeric($dataKey) && method_exists($getObjectInstance, $data)) {
91
+                        if (isset($this->origin[$data])) {
92
+                            if (!is_array($this->origin[$data])) {
93 93
                                 $this->origin[$data] = array($this->origin[$data]);
94 94
                             }
95
-                            foreach ($this->origin[$data] as $originData){
95
+                            foreach ($this->origin[$data] as $originData) {
96 96
                                 $getObjectInstance->{$data}($originData);
97 97
                             }
98 98
                         }
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
     {
112 112
         // expected method is executed.
113 113
         // this method is a must for http method values to be found in this property.
114
-        if($this->checkProperties('capsule')){
114
+        if ($this->checkProperties('capsule')) {
115 115
 
116 116
             $caret = $this->capsuleCaret();
117 117
 
118
-            foreach($this->inputs as $input=>$value){
118
+            foreach ($this->inputs as $input=>$value) {
119 119
 
120
-                if(isset($caret[$input]) || (
121
-                        $this->checkProperties('capsule') && !in_array($input,$this->capsule)
122
-                    )){
120
+                if (isset($caret[$input]) || (
121
+                        $this->checkProperties('capsule') && !in_array($input, $this->capsule)
122
+                    )) {
123 123
                     exception('capsuleRequestException')
124 124
                         ->overflow('The '.$input.' value cannot be sent.');
125 125
                 }
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $caret = [];
138 138
 
139
-        foreach($this->inputs as $input=>$item){
140
-            if(in_array('@'.$input,$this->capsule)){
139
+        foreach ($this->inputs as $input=>$item) {
140
+            if (in_array('@'.$input, $this->capsule)) {
141 141
                 $caret[$input] = $item;
142 142
             }
143 143
         }
144 144
 
145 145
         foreach ($this->capsule as $item) {
146
-            if(preg_match('#@.*#is',$item)){
147
-                $this->capsule = array_diff($this->capsule,[$item]);
146
+            if (preg_match('#@.*#is', $item)) {
147
+                $this->capsule = array_diff($this->capsule, [$item]);
148 148
             }
149 149
         }
150 150
 
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
 
164 164
         // Determines which HTTP method
165 165
         // the request object will be exposed to.
166
-        if($this->checkProperties('http')){
166
+        if ($this->checkProperties('http')) {
167 167
 
168 168
             // if the current http method does not exist
169 169
             // in the http object, the exception will be thrown.
170
-            if(!in_array($method,$this->http)){
170
+            if (!in_array($method, $this->http)) {
171 171
 
172 172
                 //exception batMethodCall
173 173
                 exception()->badMethodCall(
174
-                    'Invalid http method process for '.class_basename($this).'.That is accepted http methods ['.implode(",",$this->http).'] ');
174
+                    'Invalid http method process for '.class_basename($this).'.That is accepted http methods ['.implode(",", $this->http).'] ');
175 175
             }
176 176
         }
177 177
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     {
187 187
         // from the properties of the object properties to
188 188
         // the existing variables, control the array and at least one element.
189
-        return (property_exists($this,$properties)
189
+        return (property_exists($this, $properties)
190 190
             && is_array($this->{$properties}) && count($this->{$properties})) ? true : false;
191 191
     }
192 192
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     {
200 200
         // we are saving the expected values ​​for the request in container.
201 201
         // this record can be returned in exception information.
202
-        app()->register('requestExpected',$this->expected);
202
+        app()->register('requestExpected', $this->expected);
203 203
     }
204 204
 
205 205
     /**
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
     public function except($except)
212 212
     {
213 213
         // the except parameter is a callable value.
214
-        if(is_callable($except)){
215
-            $call = call_user_func_array($except,[$this]);
214
+        if (is_callable($except)) {
215
+            $call = call_user_func_array($except, [$this]);
216 216
             $except = $call;
217 217
         }
218 218
 
219 219
         // except with the except exceptions property
220 220
         // and then assigning them to the inputs property.
221
-        $this->except = array_merge($this->except,$except);
222
-        $this->inputs = array_diff_key($this->inputs,array_flip($this->except));
221
+        $this->except = array_merge($this->except, $except);
222
+        $this->inputs = array_diff_key($this->inputs, array_flip($this->except));
223 223
 
224 224
         return $this;
225 225
     }
@@ -233,27 +233,27 @@  discard block
 block discarded – undo
233 233
     {
234 234
         // expected method is executed.
235 235
         // this method is a must for http method values to be found in this property.
236
-        if($this->checkProperties('expected')){
236
+        if ($this->checkProperties('expected')) {
237 237
 
238 238
             // if the expected values are not found in the inputs array,
239 239
             // the exception will be thrown.
240
-            foreach ($this->expected as $expected){
240
+            foreach ($this->expected as $expected) {
241 241
 
242 242
                 $expectedValues = [];
243 243
 
244 244
                 // mandatory expected data for each key can be separated by | operator.
245 245
                 // this is evaluated as "or".
246
-                foreach($expectedData = explode("|",$expected) as $inputs){
247
-                    if(!isset($this->inputs[$inputs])){
246
+                foreach ($expectedData = explode("|", $expected) as $inputs) {
247
+                    if (!isset($this->inputs[$inputs])) {
248 248
                         $expectedValues[] = $inputs;
249 249
                     }
250 250
                 }
251 251
 
252 252
                 // if the expectedData and expectedValues ​​
253 253
                 // array are numerically equal to the expected key, the exception is thrown.
254
-                if(count($expectedData)===count($expectedValues)){
254
+                if (count($expectedData)===count($expectedValues)) {
255 255
                     exception($expected)
256
-                        ->unexpectedValue('You absolutely have to send the value '.implode(" or ",$expectedValues).' for request object');
256
+                        ->unexpectedValue('You absolutely have to send the value '.implode(" or ", $expectedValues).' for request object');
257 257
                 }
258 258
             }
259 259
         }
@@ -268,17 +268,17 @@  discard block
 block discarded – undo
268 268
     {
269 269
         // check the presence of the generator object
270 270
         // and operate the generator over this object.
271
-        if($this->checkProperties('auto_generators')){
271
+        if ($this->checkProperties('auto_generators')) {
272 272
             $generators = $this->getAutoGenerators();
273 273
         }
274 274
 
275 275
         // check the presence of the generator object
276 276
         // and operate the generator over this object.
277
-        if($this->checkProperties('generators')){
278
-            $generators = array_merge(isset($generators) ? $generators: [],$this->getGenerators());
277
+        if ($this->checkProperties('generators')) {
278
+            $generators = array_merge(isset($generators) ? $generators : [], $this->getGenerators());
279 279
         }
280 280
 
281
-        if(isset($generators)){
281
+        if (isset($generators)) {
282 282
             $this->generatorMethod($generators);
283 283
         }
284 284
     }
@@ -293,21 +293,21 @@  discard block
 block discarded – undo
293 293
     private function generatorMethod($generators)
294 294
     {
295 295
         //generator array object
296
-        foreach ($generators as $generator){
296
+        foreach ($generators as $generator) {
297 297
 
298 298
             //generator method name
299 299
             $generatorMethodName = $generator.'Generator';
300 300
 
301 301
             // if the generator method is present,
302 302
             // the fake value is assigned.
303
-            if(method_exists($this,$generatorMethodName)){
303
+            if (method_exists($this, $generatorMethodName)) {
304 304
 
305 305
                 //fake registration
306
-                if(!isset($this->inputs[$generator])){
306
+                if (!isset($this->inputs[$generator])) {
307 307
 
308 308
                     $generatorMethodNameResult = $this->{$generatorMethodName}();
309 309
 
310
-                    if(!is_null($generatorMethodNameResult)){
310
+                    if (!is_null($generatorMethodNameResult)) {
311 311
                         $this->{$generator} = $this->{$generatorMethodName}();
312 312
                         $this->inputs[$generator] = $this->{$generatorMethodName}();
313 313
                         $this->requestData[$generator] = $this->inputs[$generator];
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
                 }
316 316
                 else {
317 317
 
318
-                    if($this->checkProperties('auto_generators_dont_overwrite')
319
-                        && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
318
+                    if ($this->checkProperties('auto_generators_dont_overwrite')
319
+                        && in_array($generator, $this->getAutoGeneratorsDontOverwrite())) {
320 320
                         $this->{$generator} = $this->{$generatorMethodName}();
321 321
                         $this->inputs[$generator] = $this->{$generatorMethodName}();
322 322
                     }
323 323
 
324
-                    if($this->checkProperties('generators_dont_overwrite')
325
-                        && in_array($generator,$this->getGeneratorsDontOverwrite())){
324
+                    if ($this->checkProperties('generators_dont_overwrite')
325
+                        && in_array($generator, $this->getGeneratorsDontOverwrite())) {
326 326
                         $this->{$generator} = $this->{$generatorMethodName}();
327 327
                         $this->inputs[$generator] = $this->{$generatorMethodName}();
328 328
                     }
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
         $list = [];
345 345
 
346 346
         foreach ($this->requestData as $key=>$item) {
347
-            if(property_exists($this,'requestExcept') && !in_array($key,$this->requestExcept)){
347
+            if (property_exists($this, 'requestExcept') && !in_array($key, $this->requestExcept)) {
348 348
                 $list[$key] = $item;
349 349
             }
350 350
 
351
-            if(!property_exists($this,'requestExcept')){
351
+            if (!property_exists($this, 'requestExcept')) {
352 352
                 $list[$key] = $item;
353 353
             }
354 354
         }
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
     {
392 392
         // we use the http method to write
393 393
         // the values to the inputs and origin properties.
394
-        foreach($this->clientData as $key=>$value){
394
+        foreach ($this->clientData as $key=>$value) {
395 395
 
396 396
             //inputs and origin properties
397 397
             $this->inputs[$key] = $value;
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
 
439 439
         // we update the input values ​​after
440 440
         // we receive and check the saved objects.
441
-        foreach ($clientObjects as $key=>$value){
441
+        foreach ($clientObjects as $key=>$value) {
442 442
 
443
-            if(isset($clientObjects['origin'][$key])){
443
+            if (isset($clientObjects['origin'][$key])) {
444 444
 
445 445
                 $this->{$key} = $clientObjects['origin'][$key];
446 446
                 $this->inputs[$key] = $this->{$key};
@@ -467,11 +467,11 @@  discard block
 block discarded – undo
467 467
 
468 468
         // the request update to be performed using
469 469
         // the method name to be used with the http method.
470
-        $this->setRequestInputs($requestMethod,$key);
470
+        $this->setRequestInputs($requestMethod, $key);
471 471
 
472 472
         // the request update to be performed using
473 473
         // the method name to be used without the http method.
474
-        $this->setRequestInputs($key,$key);
474
+        $this->setRequestInputs($key, $key);
475 475
     }
476 476
 
477 477
     /**
@@ -482,20 +482,20 @@  discard block
 block discarded – undo
482 482
      *
483 483
      * @throws ReflectionExceptionAlias
484 484
      */
485
-    private function setRequestInputs($method,$key)
485
+    private function setRequestInputs($method, $key)
486 486
     {
487
-        if(method_exists($this,$method) && $this->reflection->reflectionMethodParams($method)->isProtected){
487
+        if (method_exists($this, $method) && $this->reflection->reflectionMethodParams($method)->isProtected) {
488 488
 
489 489
             //check annotations for method
490
-            $annotation = app()->resolve(ClientAnnotationManager::class,['request'=>$this]);
491
-            $annotation->annotation($method,$key);
490
+            $annotation = app()->resolve(ClientAnnotationManager::class, ['request'=>$this]);
491
+            $annotation->annotation($method, $key);
492 492
 
493
-            if(isset($this->inputs[$key]) && is_array($this->inputs[$key])){
493
+            if (isset($this->inputs[$key]) && is_array($this->inputs[$key])) {
494 494
 
495 495
                 $inputKeys = $this->inputs[$key];
496 496
 
497 497
                 $this->inputs[$key] = [];
498
-                foreach ($inputKeys as $input){
498
+                foreach ($inputKeys as $input) {
499 499
 
500 500
                     $this->{$key}               = $input;
501 501
                     $keyMethod                  = $this->{$method}();
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
                     $this->requestData[$key][]  = $keyMethod;
504 504
                 }
505 505
             }
506
-            else{
507
-                if(isset($this->inputs[$key])){
506
+            else {
507
+                if (isset($this->inputs[$key])) {
508 508
                     $keyMethod = $this->{$method}();
509 509
                     $this->inputs[$key] = $keyMethod;
510 510
                     $this->requestData[$key] = $keyMethod;
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
     {
524 524
         // the auto object validate property is the property
525 525
         // where all of your request values ​​are automatically validated.
526
-        if(property_exists($this,'autoObjectValidate')
527
-            && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)){
526
+        if (property_exists($this, 'autoObjectValidate')
527
+            && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)) {
528 528
             $this->autoValidate('autoObjectValidate');
529 529
         }
530 530
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -318,8 +318,7 @@  discard block
 block discarded – undo
318 318
                         $this->requestData[$generator] = $this->inputs[$generator];
319 319
                         $this->generatorList[] = $generator;
320 320
                     }
321
-                }
322
-                else {
321
+                } else {
323 322
 
324 323
                     if($this->checkProperties('auto_generators_dont_overwrite')
325 324
                         && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
@@ -508,8 +507,7 @@  discard block
 block discarded – undo
508 507
                     $this->inputs[$key][]       = $keyMethod;
509 508
                     $this->requestData[$key][]  = $keyMethod;
510 509
                 }
511
-            }
512
-            else{
510
+            } else{
513 511
                 if(isset($this->inputs[$key])){
514 512
                     $keyMethod = $this->{$method}();
515 513
                     $this->inputs[$key] = $keyMethod;
Please login to merge, or discard this patch.
src/resta/Schedule/ScheduleCommandInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
     /**
8 8
      * @return void
9 9
      */
10
-    public function command() : void ;
10
+    public function command() : void;
11 11
 
12 12
     /**
13 13
      * @param ScheduleInterface $schedule
14 14
      * @return void
15 15
      */
16
-    public function when(ScheduleInterface $schedule) : void ;
16
+    public function when(ScheduleInterface $schedule) : void;
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Foundation/PathManager/StaticPathList.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -7,256 +7,256 @@
 block discarded – undo
7 7
     /**
8 8
      * @var string
9 9
      */
10
-    public static $appDefine='src';
10
+    public static $appDefine = 'src';
11 11
 
12 12
     /**
13 13
      * @var string
14 14
      */
15
-    public static $autoloadNamespace='App';
15
+    public static $autoloadNamespace = 'App';
16 16
 
17 17
     /**
18 18
      * @var string
19 19
      */
20
-    public static $projectPrefixGroup='Api';
20
+    public static $projectPrefixGroup = 'Api';
21 21
 
22 22
     /**
23 23
      * @var string
24 24
      */
25
-    public static $methodPrefix='Action';
25
+    public static $methodPrefix = 'Action';
26 26
 
27 27
     /**
28 28
      * @var string
29 29
      */
30
-    public static $callClassPrefix='Controller';
30
+    public static $callClassPrefix = 'Controller';
31 31
 
32 32
     /**
33 33
      * @var string
34 34
      */
35
-    public static $controllerBundleName='';
35
+    public static $controllerBundleName = '';
36 36
 
37 37
     /**
38 38
      * @var string
39 39
      */
40
-    public static $resourceInController='Resource';
40
+    public static $resourceInController = 'Resource';
41 41
 
42 42
     /**
43 43
      * @var string
44 44
      */
45
-    public static $configurationInController='Config';
45
+    public static $configurationInController = 'Config';
46 46
 
47 47
     /**
48 48
      * @var null
49 49
      */
50
-    public static $appPath=null;
50
+    public static $appPath = null;
51 51
 
52 52
     /**
53 53
      * @var string
54 54
      */
55
-    public static $kernel='Kernel';
55
+    public static $kernel = 'Kernel';
56 56
 
57 57
     /**
58 58
      * @var string
59 59
      */
60
-    public static $repository='Repository';
60
+    public static $repository = 'Repository';
61 61
 
62 62
     /**
63 63
      * @var string
64 64
      */
65
-    public static $listener='Listener';
65
+    public static $listener = 'Listener';
66 66
 
67 67
     /**
68 68
      * @var string
69 69
      */
70
-    public static $serviceAnnotations='ServiceAnnotationsManager';
70
+    public static $serviceAnnotations = 'ServiceAnnotationsManager';
71 71
 
72 72
     /**
73 73
      * @var string
74 74
      */
75
-    public static $serviceMiddleware='ServiceMiddlewareManager';
75
+    public static $serviceMiddleware = 'ServiceMiddlewareManager';
76 76
 
77 77
     /**
78 78
      * @var string
79 79
      */
80
-    public static $storage='Storage';
80
+    public static $storage = 'Storage';
81 81
 
82 82
     /**
83 83
      * @var string
84 84
      */
85
-    public static $controller='Controllers';
85
+    public static $controller = 'Controllers';
86 86
 
87 87
     /**
88 88
      * @var string
89 89
      */
90
-    public static $platform='__Platform';
90
+    public static $platform = '__Platform';
91 91
 
92 92
     /**
93 93
      * @var string
94 94
      */
95
-    public static $sourcePath='Source';
95
+    public static $sourcePath = 'Source';
96 96
 
97 97
     /**
98 98
      * @var string
99 99
      */
100
-    public static $sourceRequest='Client';
100
+    public static $sourceRequest = 'Client';
101 101
 
102 102
     /**
103 103
      * @var string
104 104
      */
105
-    public static $model='Model';
105
+    public static $model = 'Model';
106 106
 
107 107
     /**
108 108
      * @var string
109 109
      */
110
-    public static $builder='Builder';
110
+    public static $builder = 'Builder';
111 111
 
112 112
     /**
113 113
      * @var string
114 114
      */
115
-    public static $migration='Migrations';
115
+    public static $migration = 'Migrations';
116 116
 
117 117
     /**
118 118
      * @var string
119 119
      */
120
-    public static $config='Config';
120
+    public static $config = 'Config';
121 121
 
122 122
     /**
123 123
      * @var string
124 124
      */
125
-    public static $helpers='Helpers';
125
+    public static $helpers = 'Helpers';
126 126
 
127 127
     /**
128 128
      * @var string
129 129
      */
130
-    public static $test='Tests';
130
+    public static $test = 'Tests';
131 131
 
132 132
     /**
133 133
      * @var string
134 134
      */
135
-    public static $workers='Workers';
135
+    public static $workers = 'Workers';
136 136
 
137 137
     /**
138 138
      * @var string
139 139
      */
140
-    public static $schedule='Schedule';
140
+    public static $schedule = 'Schedule';
141 141
 
142 142
 
143 143
     /**
144 144
      * @var string
145 145
      */
146
-    public static $optional='Optional';
146
+    public static $optional = 'Optional';
147 147
 
148 148
     /**
149 149
      * @var string
150 150
      */
151
-    public static $events='Events';
151
+    public static $events = 'Events';
152 152
 
153 153
     /**
154 154
      * @var string
155 155
      */
156
-    public static $listeners='Listeners';
156
+    public static $listeners = 'Listeners';
157 157
 
158 158
     /**
159 159
      * @var string
160 160
      */
161
-    public static $subscribers='Subscribers';
161
+    public static $subscribers = 'Subscribers';
162 162
 
163 163
     /**
164 164
      * @var string
165 165
      */
166
-    public static $exception='Exceptions';
166
+    public static $exception = 'Exceptions';
167 167
 
168 168
     /**
169 169
      * @var string
170 170
      */
171
-    public static $job='Job';
171
+    public static $job = 'Job';
172 172
 
173 173
 
174 174
     /**
175 175
      * @var string
176 176
      */
177
-    public static $webservice='Webservice';
177
+    public static $webservice = 'Webservice';
178 178
 
179 179
     /**
180 180
      * @var string
181 181
      */
182
-    public static $log='Log';
182
+    public static $log = 'Log';
183 183
 
184 184
     /**
185 185
      * @var string
186 186
      */
187
-    public static $resource='Resource';
187
+    public static $resource = 'Resource';
188 188
 
189 189
     /**
190 190
      * @var string
191 191
      */
192
-    public static $cache='Cache';
192
+    public static $cache = 'Cache';
193 193
 
194 194
     /**
195 195
      * @var string
196 196
      */
197
-    public static $language='Language';
197
+    public static $language = 'Language';
198 198
     /**
199 199
      * @var string
200 200
      */
201
-    public static $session='Session';
201
+    public static $session = 'Session';
202 202
 
203 203
     /**
204 204
      * @var string
205 205
      */
206
-    public static $middleware='Middleware';
206
+    public static $middleware = 'Middleware';
207 207
 
208 208
     /**
209 209
      * @var string
210 210
      */
211
-    public static $route='Routes';
211
+    public static $route = 'Routes';
212 212
 
213 213
     /**
214 214
      * @var string
215 215
      */
216
-    public static $request='Client';
216
+    public static $request = 'Client';
217 217
 
218 218
     /**
219 219
      * @var string
220 220
      */
221
-    public static $factory='Factory';
221
+    public static $factory = 'Factory';
222 222
 
223 223
     /**
224 224
      * @var string
225 225
      */
226
-    public static $node='Node';
226
+    public static $node = 'Node';
227 227
 
228 228
     /**
229 229
      * @var string
230 230
      */
231
-    public static $provider='Providers';
231
+    public static $provider = 'Providers';
232 232
 
233 233
     /**
234 234
      * @var string
235 235
      */
236
-    public static $once='Once';
236
+    public static $once = 'Once';
237 237
 
238 238
     /**
239 239
      * @var string
240 240
      */
241
-    public static $command='Command';
241
+    public static $command = 'Command';
242 242
 
243 243
     /**
244 244
      * @var string
245 245
      */
246
-    public static $stub='Stub';
246
+    public static $stub = 'Stub';
247 247
 
248 248
     /**
249 249
      * @var string
250 250
      */
251
-    public static $store='Store';
251
+    public static $store = 'Store';
252 252
 
253 253
     /**
254 254
      * @var string
255 255
      */
256
-    public static $boot='Boot';
256
+    public static $boot = 'Boot';
257 257
 
258 258
     /**
259 259
      * @var string
260 260
      */
261
-    public static $autoService='Autoservice';
261
+    public static $autoService = 'Autoservice';
262 262
 }
263 263
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Schedule/ScheduleManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
     /**
8 8
      * @var array
9 9
      */
10
-    protected static $cronScheduler = ['*','*','*','*','*'];
10
+    protected static $cronScheduler = ['*', '*', '*', '*', '*'];
11 11
 
12 12
     /**
13 13
      * set day for scheduler
Please login to merge, or discard this patch.
src/resta/Schedule/ScheduleInterface.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,42 +8,42 @@
 block discarded – undo
8 8
      * @param integer $day
9 9
      * @return $this
10 10
      */
11
-    public function day($day=1);
11
+    public function day($day = 1);
12 12
 
13 13
     /**
14 14
      * @param integer $hour
15 15
      * @return $this
16 16
      */
17
-    public function everyHour($hour=1);
17
+    public function everyHour($hour = 1);
18 18
     
19 19
     /**
20 20
      * @param int $minute
21 21
      * @return $this
22 22
      */
23
-    public function everyMinute($minute=1);
23
+    public function everyMinute($minute = 1);
24 24
 
25 25
     /**
26 26
      * @param mixed $hour
27 27
      * @return $this
28 28
      */
29
-    public function hour($hour='*');
29
+    public function hour($hour = '*');
30 30
 
31 31
     /**
32 32
      * @param int $minute
33 33
      * @return $this
34 34
      */
35
-    public function minute($minute=1);
35
+    public function minute($minute = 1);
36 36
 
37 37
     /**
38 38
      * @param mixed $month
39 39
      * @return $this
40 40
      */
41
-    public function month($month=1);
41
+    public function month($month = 1);
42 42
 
43 43
     /**
44 44
      * @param mixed $week$month
45 45
      * @return $this
46 46
      */
47
-    public function week($week=1);
47
+    public function week($week = 1);
48 48
 
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Console/Source/Schedule/Schedule.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * @return void
36 36
      */
37
-    public function create(){
37
+    public function create() {
38 38
 
39 39
         $schedulePath = app()->path()->schedule();
40 40
 
41
-        if(!file_exists($schedulePath)){
41
+        if (!file_exists($schedulePath)) {
42 42
             $this->directory['schedule'] = $schedulePath;
43 43
             $this->file->makeDirectory($this);
44 44
         }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $this->argument['scheduleClass'] = ucfirst($this->argument['schedule']).'';
48 48
         $this->argument['projectName'] = strtolower($this->projectName());
49 49
 
50
-        $this->touch['schedule/schedule']= $schedulePath.'/'.$this->argument['schedule'].'.php';
50
+        $this->touch['schedule/schedule'] = $schedulePath.'/'.$this->argument['schedule'].'.php';
51 51
 
52 52
 
53 53
         $this->file->touch($this);
@@ -57,30 +57,30 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function list()
59 59
     {
60
-        exec('crontab -l',$list);
60
+        exec('crontab -l', $list);
61 61
 
62
-        $this->table->setHeaders(['no','minute','hour','day','month','week','schedule','description']);
62
+        $this->table->setHeaders(['no', 'minute', 'hour', 'day', 'month', 'week', 'schedule', 'description']);
63 63
 
64 64
 
65
-        foreach ($list as $key=>$item){
65
+        foreach ($list as $key=>$item) {
66 66
 
67
-            if(preg_match('@.*php api schedule run '.strtolower($this->projectName()).'.*@is',$item,$result)){
68
-                if(isset($result[0])){
67
+            if (preg_match('@.*php api schedule run '.strtolower($this->projectName()).'.*@is', $item, $result)) {
68
+                if (isset($result[0])) {
69 69
 
70 70
                     $cron = [];
71 71
 
72
-                    if(preg_match('@(.*)\scd@',$result[0],$cron)){
73
-                        $cron = (isset($cron[1])) ? explode(' ',$cron[1]) : '';
72
+                    if (preg_match('@(.*)\scd@', $result[0], $cron)) {
73
+                        $cron = (isset($cron[1])) ? explode(' ', $cron[1]) : '';
74 74
 
75 75
                     }
76 76
 
77 77
                     $scheduleName = '';
78 78
 
79
-                    if(preg_match('@schedule\:(.*?)\s@',$result[0],$scheduler)){
79
+                    if (preg_match('@schedule\:(.*?)\s@', $result[0], $scheduler)) {
80 80
                         $scheduleName = (isset($scheduler[1])) ? $scheduler[1] : '';
81 81
 
82 82
                         $schedulerInstance = $this->scheduleInstance(ucfirst($scheduleName));
83
-                        $description = ClosureDispatcher::bind($schedulerInstance)->call(function(){
83
+                        $description = ClosureDispatcher::bind($schedulerInstance)->call(function() {
84 84
                             return $this->description;
85 85
                         });
86 86
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $schedules = Utils::glob(app()->path()->schedule());
112 112
 
113 113
 
114
-        if(isset($schedules[$this->argument['schedule']])){
114
+        if (isset($schedules[$this->argument['schedule']])) {
115 115
 
116 116
             $scheduleNamespace = Utils::getNamespace($schedules[$this->argument['schedule']]);
117 117
             $scheduleInstance = app()->resolve($scheduleNamespace);
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
             $scheduleManager = new ScheduleManager();
120 120
             $scheduleInstance->when($scheduleManager);
121 121
 
122
-            $cronScheduler = implode(' ',$scheduleManager->getCronScheduler());
122
+            $cronScheduler = implode(' ', $scheduleManager->getCronScheduler());
123 123
 
124 124
             $command = $cronScheduler.' cd '.root.' && php api schedule run munch schedule:'.lcfirst($this->argument['schedule']).' >> /dev/null 2>&1';
125 125
 
126
-            if($this->cronjob_exists($command)===false){
126
+            if ($this->cronjob_exists($command)===false) {
127 127
 
128 128
                 $output = shell_exec('crontab -l');
129 129
                 file_put_contents('/tmp/crontab.txt', $output.''.$command.''.PHP_EOL);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     {
142 142
         $schedules = Utils::glob(app()->path()->schedule());
143 143
 
144
-        if(isset($schedules[$this->argument['schedule']])){
144
+        if (isset($schedules[$this->argument['schedule']])) {
145 145
             $scheduleNamespace = Utils::getNamespace($schedules[$this->argument['schedule']]);
146 146
             $scheduleInstance = app()->resolve($scheduleNamespace);
147 147
 
@@ -149,20 +149,20 @@  discard block
 block discarded – undo
149 149
         }
150 150
     }
151 151
 
152
-    private function cronjob_exists($command){
152
+    private function cronjob_exists($command) {
153 153
 
154
-        $cronjob_exists=false;
154
+        $cronjob_exists = false;
155 155
 
156 156
         exec('crontab -l', $crontab);
157 157
 
158 158
 
159
-        if(isset($crontab)&&is_array($crontab)){
159
+        if (isset($crontab) && is_array($crontab)) {
160 160
 
161 161
             $crontab = array_flip($crontab);
162 162
 
163
-            if(isset($crontab[$command])){
163
+            if (isset($crontab[$command])) {
164 164
 
165
-                $cronjob_exists=true;
165
+                $cronjob_exists = true;
166 166
 
167 167
             }
168 168
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     {
179 179
         $schedules = Utils::glob(app()->path()->schedule());
180 180
 
181
-        if(isset($schedules[$schedule])){
181
+        if (isset($schedules[$schedule])) {
182 182
             $scheduleNamespace = Utils::getNamespace($schedules[$schedule]);
183 183
             return $scheduleInstance = app()->resolve($scheduleNamespace);
184 184
         }
Please login to merge, or discard this patch.
src/resta/Console/Source/Track/Track.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function log()
31 31
     {
32
-        if(app()->has('track.path')){
32
+        if (app()->has('track.path')) {
33 33
             $trackPath = app()->get('track.path');
34 34
             $logger = $trackPath($this->argument);
35 35
         }
36
-        else{
36
+        else {
37 37
             $logger = app()->path()->appLog().''.DIRECTORY_SEPARATOR.''.date('Y').''.DIRECTORY_SEPARATOR.''.date('m').''.DIRECTORY_SEPARATOR.''.date('d').'-access.log';
38 38
         }
39 39
 
40
-        if(!file_exists($logger)){
40
+        if (!file_exists($logger)) {
41 41
             echo 'No requests for a log tracker have been detected yet.';
42 42
             echo PHP_EOL;
43 43
             exit();
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
         while (!feof($proc))
54 54
         {
55 55
             $result = fread($proc, 4096);
56
-            if(preg_match('@\{(.*)\}@',$result,$output)){
57
-                $outputArray = json_decode($output[0],1);
56
+            if (preg_match('@\{(.*)\}@', $result, $output)) {
57
+                $outputArray = json_decode($output[0], 1);
58 58
 
59 59
                 $outputArray['trackNumber'] = ++$number;
60 60
 
61
-                if(app()->has('track.log')){
61
+                if (app()->has('track.log')) {
62 62
 
63 63
                     $track = app()->get('track.log');
64
-                    echo $track($outputArray,$this->argument);
64
+                    echo $track($outputArray, $this->argument);
65 65
                 }
66 66
             }
67
-            else{
67
+            else {
68 68
                 echo $result;
69 69
             }
70 70
             @ flush();
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
         if(app()->has('track.path')){
33 33
             $trackPath = app()->get('track.path');
34 34
             $logger = $trackPath($this->argument);
35
-        }
36
-        else{
35
+        } else{
37 36
             $logger = app()->path()->appLog().''.DIRECTORY_SEPARATOR.''.date('Y').''.DIRECTORY_SEPARATOR.''.date('m').''.DIRECTORY_SEPARATOR.''.date('d').'-access.log';
38 37
         }
39 38
 
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
                     $track = app()->get('track.log');
64 63
                     echo $track($outputArray,$this->argument);
65 64
                 }
66
-            }
67
-            else{
65
+            } else{
68 66
                 echo $result;
69 67
             }
70 68
             @ flush();
Please login to merge, or discard this patch.
src/resta/Support/JsonHandler.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
      */
24 24
     private static function checkFile()
25 25
     {
26
-        if(!is_null(self::$singleton)) return self::$singleton;
26
+        if (!is_null(self::$singleton)) return self::$singleton;
27 27
 
28
-        $filePortions = explode(DIRECTORY_SEPARATOR,self::$file);
28
+        $filePortions = explode(DIRECTORY_SEPARATOR, self::$file);
29 29
         $pop = array_pop($filePortions);
30 30
 
31
-        if(file_exists(implode(DIRECTORY_SEPARATOR,$filePortions))
32
-            && preg_match('@[a-zA-Z0-9]+\.json@',$pop)){
31
+        if (file_exists(implode(DIRECTORY_SEPARATOR, $filePortions))
32
+            && preg_match('@[a-zA-Z0-9]+\.json@', $pop)) {
33 33
             self::$singleton = self::$file;
34 34
             return self::$singleton;
35 35
         }
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $file = self::checkFile();
48 48
 
49
-        if(!file_exists($file)){
50
-            files()->put($file,self::encode([]));
49
+        if (!file_exists($file)) {
50
+            files()->put($file, self::encode([]));
51 51
         }
52 52
     }
53 53
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public static function decode($data)
61 61
     {
62
-        return json_decode($data,1);
62
+        return json_decode($data, 1);
63 63
     }
64 64
 
65 65
     /**
@@ -71,26 +71,26 @@  discard block
 block discarded – undo
71 71
      *
72 72
      * @throws FileNotFoundException
73 73
      */
74
-    public static function delete($key,$arrayKey=null)
74
+    public static function delete($key, $arrayKey = null)
75 75
     {
76 76
         $data = self::get();
77 77
 
78
-        if(is_null($arrayKey)){
78
+        if (is_null($arrayKey)) {
79 79
 
80
-            if(isset($data[$key])){
80
+            if (isset($data[$key])) {
81 81
                 unset($data[$key]);
82
-                files()->put(self::checkFile(),self::encode($data),true);
82
+                files()->put(self::checkFile(), self::encode($data), true);
83 83
                 return true;
84 84
             }
85 85
         }
86 86
 
87 87
         // if the data to be deleted
88 88
         // in json data contains a nested array data.
89
-        if(!is_null($arrayKey) && is_string($arrayKey)){
89
+        if (!is_null($arrayKey) && is_string($arrayKey)) {
90 90
 
91
-            if(isset($data[$key][$arrayKey])){
91
+            if (isset($data[$key][$arrayKey])) {
92 92
                 unset($data[$key][$arrayKey]);
93
-                files()->put(self::checkFile(),self::encode($data),true);
93
+                files()->put(self::checkFile(), self::encode($data), true);
94 94
                 return true;
95 95
             }
96 96
         }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public static function encode($data)
108 108
     {
109
-        return json_encode($data,JSON_PRETTY_PRINT);
109
+        return json_encode($data, JSON_PRETTY_PRINT);
110 110
     }
111 111
 
112 112
     /**
@@ -132,18 +132,18 @@  discard block
 block discarded – undo
132 132
      *
133 133
      * @throws FileNotFoundException
134 134
      */
135
-    public static function set($key,$value)
135
+    public static function set($key, $value)
136 136
     {
137 137
         self::createIfNotFileExist();
138 138
         
139 139
         $file = self::get();
140 140
         
141
-        if(isset($file[$key]) && is_array($value)){
142
-            $file[$key] = array_merge($file[$key],$value);
143
-            files()->put(self::checkFile(),self::encode($file));
141
+        if (isset($file[$key]) && is_array($value)) {
142
+            $file[$key] = array_merge($file[$key], $value);
143
+            files()->put(self::checkFile(), self::encode($file));
144 144
         }
145
-        else{
146
-            files()->put(self::checkFile(),self::encode(array_merge($file,[$key=>$value])));
145
+        else {
146
+            files()->put(self::checkFile(), self::encode(array_merge($file, [$key=>$value])));
147 147
         }
148 148
 
149 149
         return self::get();
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
      */
24 24
     private static function checkFile()
25 25
     {
26
-        if(!is_null(self::$singleton)) return self::$singleton;
26
+        if(!is_null(self::$singleton)) {
27
+            return self::$singleton;
28
+        }
27 29
 
28 30
         $filePortions = explode(DIRECTORY_SEPARATOR,self::$file);
29 31
         $pop = array_pop($filePortions);
@@ -141,8 +143,7 @@  discard block
 block discarded – undo
141 143
         if(isset($file[$key]) && is_array($value)){
142 144
             $file[$key] = array_merge($file[$key],$value);
143 145
             files()->put(self::checkFile(),self::encode($file));
144
-        }
145
-        else{
146
+        } else{
146 147
             files()->put(self::checkFile(),self::encode(array_merge($file,[$key=>$value])));
147 148
         }
148 149
 
Please login to merge, or discard this patch.