Passed
Push — master ( 0f9bce...241f41 )
by Php Easy Api
02:49
created
src/resta/Support/ReflectionProcess.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function __construct($namespace = null)
32 32
     {
33
-        if($namespace!==null){
33
+        if ($namespace!==null) {
34 34
             $this->namespace = $namespace;
35 35
         }
36 36
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function __invoke($namespace = null)
43 43
     {
44
-        if($namespace!==null){
44
+        if ($namespace!==null) {
45 45
             $this->namespace = $namespace;
46 46
         }
47 47
         return $this;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function getReflectionClass()
56 56
     {
57
-        if(!isset(static::$singletons['reflectionClass'])){
57
+        if (!isset(static::$singletons['reflectionClass'])) {
58 58
             static::$singletons['reflectionClass'] = new \ReflectionClass($this->namespace);
59 59
         }
60 60
         return static::$singletons['reflectionClass'];
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function getReflectionMethod($method)
70 70
     {
71
-        return new \ReflectionMethod($this->namespace,$method);
71
+        return new \ReflectionMethod($this->namespace, $method);
72 72
     }
73 73
 
74 74
     /**
Please login to merge, or discard this patch.
src/resta/Support/Dependencies.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
     /**
8 8
      * @var array $bootLoaders
9 9
      */
10
-    protected static $bootLoaders = ['url','logger'];
10
+    protected static $bootLoaders = ['url', 'logger'];
11 11
 
12 12
     /**
13 13
      * load bootstrapper dependencies
14 14
      *
15 15
      * @param array $loaders
16 16
      */
17
-    public static function bootLoader($loaders=array())
17
+    public static function bootLoader($loaders = array())
18 18
     {
19 19
         app()->loadIfNotExistBoot($loaders);
20 20
     }
Please login to merge, or discard this patch.
src/resta/Support/Traits/Macroable.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
      * @param $class
23 23
      * @return mixed
24 24
      */
25
-   public function macro($class)
26
-   {
27
-       $this->class  = $class;
28
-       $this->macro = $this;
25
+    public function macro($class)
26
+    {
27
+        $this->class  = $class;
28
+        $this->macro = $this;
29 29
 
30
-       return $this;
31
-   }
30
+        return $this;
31
+    }
32 32
 
33 33
     /**
34 34
      * get macro property
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
      * @param $name
37 37
      * @return mixed
38 38
      */
39
-   public function __get($name)
40
-   {
41
-       return ClosureDispatcher::bind($this->class)->call(function() use($name){
42
-          return $this->{$name};
43
-       });
44
-   }
39
+    public function __get($name)
40
+    {
41
+        return ClosureDispatcher::bind($this->class)->call(function() use($name){
42
+            return $this->{$name};
43
+        });
44
+    }
45 45
 }
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      */
25 25
    public function macro($class)
26 26
    {
27
-       $this->class  = $class;
27
+       $this->class = $class;
28 28
        $this->macro = $this;
29 29
 
30 30
        return $this;
Please login to merge, or discard this patch.
src/resta/Support/Str.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public static function after($subject, $search)
37 37
     {
38
-        return $search === '' ? $subject : array_reverse(explode($search, $subject, 2))[0];
38
+        return $search==='' ? $subject : array_reverse(explode($search, $subject, 2))[0];
39 39
     }
40 40
 
41 41
     /**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $languageSpecific = static::languageSpecificCharsArray($language);
51 51
 
52
-        if (! is_null($languageSpecific)) {
52
+        if (!is_null($languageSpecific)) {
53 53
             $value = str_replace($languageSpecific[0], $languageSpecific[1], $value);
54 54
         }
55 55
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public static function before($subject, $search)
71 71
     {
72
-        return $search === '' ? $subject : explode($search, $subject)[0];
72
+        return $search==='' ? $subject : explode($search, $subject)[0];
73 73
     }
74 74
 
75 75
     /**
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public static function contains($haystack, $needles)
98 98
     {
99
-        foreach ((array) $needles as $needle) {
100
-            if ($needle !== '' && mb_strpos($haystack, $needle) !== false) {
99
+        foreach ((array)$needles as $needle) {
100
+            if ($needle!=='' && mb_strpos($haystack, $needle)!==false) {
101 101
                 return true;
102 102
             }
103 103
         }
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public static function endsWith($haystack, $needles)
116 116
     {
117
-        foreach ((array) $needles as $needle) {
118
-            if (mb_substr($haystack, -mb_strlen($needle)) === (string) $needle) {
117
+        foreach ((array)$needles as $needle) {
118
+            if (mb_substr($haystack, -mb_strlen($needle))===(string)$needle) {
119 119
                 return true;
120 120
             }
121 121
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public static function is($pattern, $value)
148 148
     {
149
-        $patterns = is_array($pattern) ? $pattern : (array) $pattern;
149
+        $patterns = is_array($pattern) ? $pattern : (array)$pattern;
150 150
 
151 151
         if (empty($patterns)) {
152 152
             return false;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             // If the given value is an exact match we can of course return true right
157 157
             // from the beginning. Otherwise, we will translate asterisks and do an
158 158
             // actual pattern match against the two strings to see if they match.
159
-            if ($pattern == $value) {
159
+            if ($pattern==$value) {
160 160
                 return true;
161 161
             }
162 162
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
             // pattern such as "library/*", making any string check convenient.
168 168
             $pattern = str_replace('\*', '.*', $pattern);
169 169
 
170
-            if (preg_match('#^'.$pattern.'\z#u', $value) === 1) {
170
+            if (preg_match('#^'.$pattern.'\z#u', $value)===1) {
171 171
                 return true;
172 172
             }
173 173
         }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public static function limit($value, $limit = 100, $end = '...')
214 214
     {
215
-        if (mb_strwidth($value, 'UTF-8') <= $limit) {
215
+        if (mb_strwidth($value, 'UTF-8')<=$limit) {
216 216
             return $value;
217 217
         }
218 218
 
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
      * @param string $case
239 239
      * @return string
240 240
      */
241
-    public static function crop($value,$crop,$case='lower')
241
+    public static function crop($value, $crop, $case = 'lower')
242 242
     {
243
-        return static::$case(str_replace($crop,'',$value));
243
+        return static::$case(str_replace($crop, '', $value));
244 244
     }
245 245
 
246 246
     /**
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     {
256 256
         preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches);
257 257
 
258
-        if (! isset($matches[0]) || static::length($value) === static::length($matches[0])) {
258
+        if (!isset($matches[0]) || static::length($value)===static::length($matches[0])) {
259 259
             return $value;
260 260
         }
261 261
 
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
     {
285 285
         $string = '';
286 286
 
287
-        while (($len = strlen($string)) < $length) {
288
-            $size = $length - $len;
287
+        while (($len = strlen($string))<$length) {
288
+            $size = $length-$len;
289 289
 
290 290
             $bytes = random_bytes($size);
291 291
 
@@ -322,14 +322,14 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public static function replaceFirst($search, $replace, $subject)
324 324
     {
325
-        if ($search == '') {
325
+        if ($search=='') {
326 326
             return $subject;
327 327
         }
328 328
 
329 329
         $position = mb_strpos($subject, $search);
330 330
 
331
-        if ($position !== false) {
332
-            return mb_substr($subject, 0, $position).$replace.mb_substr($subject, $position + mb_strlen($search));
331
+        if ($position!==false) {
332
+            return mb_substr($subject, 0, $position).$replace.mb_substr($subject, $position+mb_strlen($search));
333 333
         }
334 334
 
335 335
         return $subject;
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
     {
348 348
         $position = mb_strrpos($subject, $search);
349 349
 
350
-        if ($position !== false) {
351
-            return mb_substr($subject, 0, $position).$replace.mb_substr($subject, $position + mb_strlen($search));
350
+        if ($position!==false) {
351
+            return mb_substr($subject, 0, $position).$replace.mb_substr($subject, $position+mb_strlen($search));
352 352
         }
353 353
 
354 354
         return $subject;
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
         $title = static::ascii($title, $language);
404 404
 
405 405
         // Convert all dashes/underscores into separator
406
-        $flip = $separator == '-' ? '_' : '-';
406
+        $flip = $separator=='-' ? '_' : '-';
407 407
 
408 408
         $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);
409 409
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
             return static::$snakeCache[$key][$delimiter];
435 435
         }
436 436
 
437
-        if (! ctype_lower($value)) {
437
+        if (!ctype_lower($value)) {
438 438
             $value = preg_replace('/\s+/u', '', ucwords($value));
439 439
 
440 440
             $value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value));
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
      */
453 453
     public static function startsWith($haystack, $needles)
454 454
     {
455
-        foreach ((array) $needles as $needle) {
456
-            if ($needle !== '' && mb_substr($haystack, 0, mb_strlen($needle)) === (string) $needle) {
455
+        foreach ((array)$needles as $needle) {
456
+            if ($needle!=='' && mb_substr($haystack, 0, mb_strlen($needle))===(string)$needle) {
457 457
                 return true;
458 458
             }
459 459
         }
@@ -652,14 +652,14 @@  discard block
 block discarded – undo
652 652
     {
653 653
         static $languageSpecific;
654 654
 
655
-        if (! isset($languageSpecific)) {
655
+        if (!isset($languageSpecific)) {
656 656
             $languageSpecific = [
657 657
                 'bg' => [
658 658
                     ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'],
659 659
                     ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'],
660 660
                 ],
661 661
                 'de' => [
662
-                    ['ä',  'ö',  'ü',  'Ä',  'Ö',  'Ü'],
662
+                    ['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'],
663 663
                     ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'],
664 664
                 ],
665 665
             ];
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
      */
675 675
     public static function slashToBackSlash($data)
676 676
     {
677
-        return str_replace("\\","/",$data);
677
+        return str_replace("\\", "/", $data);
678 678
     }
679 679
 
680 680
     /**
@@ -682,25 +682,25 @@  discard block
 block discarded – undo
682 682
      * @param string $explode
683 683
      * @return array
684 684
      */
685
-    public static function stringToArray($string,$explode=".")
685
+    public static function stringToArray($string, $explode = ".")
686 686
     {
687
-        return explode($explode,$string);
687
+        return explode($explode, $string);
688 688
     }
689 689
 
690 690
     /**
691 691
      * @param null $removeCharacter
692 692
      * @return null|string|string[]
693 693
      */
694
-    public static function removeCharacterFromUri($removeCharacter=null)
694
+    public static function removeCharacterFromUri($removeCharacter = null)
695 695
     {
696
-        if($removeCharacter!==null){
696
+        if ($removeCharacter!==null) {
697 697
             $query = request()->query->all();
698 698
 
699
-            if(count($query)=='1' && isset($query[$removeCharacter])){
700
-                return preg_replace('@'.$removeCharacter.'=(.*)|\?@is','',fullUrl());
699
+            if (count($query)=='1' && isset($query[$removeCharacter])) {
700
+                return preg_replace('@'.$removeCharacter.'=(.*)|\?@is', '', fullUrl());
701 701
             }
702 702
 
703
-            return preg_replace('@'.$removeCharacter.'=\d+\&|\&'.$removeCharacter.'=\d+@is','',fullUrl());
703
+            return preg_replace('@'.$removeCharacter.'=\d+\&|\&'.$removeCharacter.'=\d+@is', '', fullUrl());
704 704
         }
705 705
 
706 706
     }
Please login to merge, or discard this patch.
src/resta/Support/YamlManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@
 block discarded – undo
36 36
         return $this->yaml;
37 37
     }
38 38
 
39
-    public function set($data=array())
39
+    public function set($data = array())
40 40
     {
41 41
         //we merge the data in yaml with new data.
42
-        $newYamlData = array_merge($this->yaml,$data);
42
+        $newYamlData = array_merge($this->yaml, $data);
43 43
 
44 44
         //we dump new data.
45 45
         $yaml = Yaml::dump($newYamlData);
Please login to merge, or discard this patch.
src/resta/Support/App.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
139 139
     {
140 140
         $locale = (count($arg)=="0") ? config('app.locale','en') : current($arg);
141 141
 
142
-       return app()->resolve(Date::class)->setLocale($locale);
142
+        return app()->resolve(Date::class)->setLocale($locale);
143 143
     }
144 144
 
145 145
     /**
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -210,7 +210,9 @@  discard block
 block discarded – undo
210 210
         $repositoryAdapterName  = $repositoryName.'Adapter';
211 211
         $repositoryNamespace    = app()->namespace()->repository().'\\'.$repositoryName.'\\'.$repositoryAdapterName;
212 212
 
213
-        if($namespace) return $repositoryNamespace;
213
+        if($namespace) {
214
+            return $repositoryNamespace;
215
+        }
214 216
 
215 217
         //and eventually we conclude the adapter class of the repository package as an instance.
216 218
         return app()->resolve($repositoryNamespace)->adapter();
@@ -270,8 +272,7 @@  discard block
 block discarded – undo
270 272
         foreach ($saltRouteParameters as $key=>$value){
271 273
             if(isset($serviceConfRouteParameters[$key])){
272 274
                 $list[$serviceConfRouteParameters[$key]]=$value;
273
-            }
274
-            else{
275
+            } else{
275 276
                 $list[$key]=$value;
276 277
             }
277 278
         }
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -21,36 +21,36 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * @var array
23 23
      */
24
-    protected static $instance=[];
24
+    protected static $instance = [];
25 25
 
26 26
     /**
27 27
      * @param $service
28 28
      * @param $arg
29 29
      * @return mixed
30 30
      */
31
-    public static function annotationsLoaders($service,$arg)
31
+    public static function annotationsLoaders($service, $arg)
32 32
     {
33 33
         //factory runner
34
-        if($service=="factory"){
34
+        if ($service=="factory") {
35 35
             return self::factory();
36 36
         }
37 37
         //if $name starts with $needles for repository
38
-        if(Str::endsWith($service,'Repository')){
38
+        if (Str::endsWith($service, 'Repository')) {
39 39
             return self::repository($service);
40 40
         }
41 41
 
42 42
         //if $name starts with $needles for source
43
-        if(Str::endsWith($service,'Source')){
44
-            return self::source($service,$arg);
43
+        if (Str::endsWith($service, 'Source')) {
44
+            return self::source($service, $arg);
45 45
         }
46 46
 
47 47
         //if $name starts with $needles for model
48
-        if(Str::endsWith($service,'Builder')){
48
+        if (Str::endsWith($service, 'Builder')) {
49 49
             return self::Builder(ucfirst($service));
50 50
         }
51 51
 
52 52
 
53
-        if(method_exists(new self,$service)){
53
+        if (method_exists(new self, $service)) {
54 54
             return self::$service($arg);
55 55
         }
56 56
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     private static function builder($service)
80 80
     {
81 81
         //we are making a namespace assignment for the builder.
82
-        $builder=app()->namespace()->builder().'\\'.$service;
82
+        $builder = app()->namespace()->builder().'\\'.$service;
83 83
 
84 84
         //we are getting builder instance.
85 85
         return app()->resolve($builder);
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
      * @param array $bind
108 108
      * @return mixed
109 109
      */
110
-    public function container($instance,$class,$bind=array())
110
+    public function container($instance, $class, $bind = array())
111 111
     {
112
-        if(!property_exists($instance->container(),$class)){
112
+        if (!property_exists($instance->container(), $class)) {
113 113
             throw new \InvalidArgumentException('container object false for ('.$class.') object');
114 114
         }
115 115
 
116
-        $container=$instance->container()->{$class};
116
+        $container = $instance->container()->{$class};
117 117
 
118
-        if(!is_array($instance->container()->{$class}) AND Utils::isNamespaceExists($container)){
119
-            return $instance->resolve($container,$bind);
118
+        if (!is_array($instance->container()->{$class}) AND Utils::isNamespaceExists($container)) {
119
+            return $instance->resolve($container, $bind);
120 120
         }
121 121
         return $instance->container()->{$class};
122 122
     }
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function createAppInstance($object)
128 128
     {
129
-        if(!defined('appInstance')){
130
-            define('appInstance',(base64_encode(serialize($object))));
129
+        if (!defined('appInstance')) {
130
+            define('appInstance', (base64_encode(serialize($object))));
131 131
         }
132 132
     }
133 133
 
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
      * @param array $arg
136 136
      * @return mixed
137 137
      */
138
-    private static function date($arg=array())
138
+    private static function date($arg = array())
139 139
     {
140
-        $locale = (count($arg)=="0") ? config('app.locale','en') : current($arg);
140
+        $locale = (count($arg)=="0") ? config('app.locale', 'en') : current($arg);
141 141
 
142 142
        return app()->resolve(Date::class)->setLocale($locale);
143 143
     }
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
     {
158 158
         //we save an instance for the entire application
159 159
         //and add it to the helper file to be accessed from anywhere in the application.
160
-        if(!isset(self::$instance['appInstance'])){
161
-            self::$instance['appInstance']=unserialize(base64_decode(appInstance));
160
+        if (!isset(self::$instance['appInstance'])) {
161
+            self::$instance['appInstance'] = unserialize(base64_decode(appInstance));
162 162
             return self::$instance['appInstance'];
163 163
         }
164 164
         return self::$instance['appInstance'];
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
      */
186 186
     private static function queue()
187 187
     {
188
-        if(!isset(self::$instance['queue'])){
188
+        if (!isset(self::$instance['queue'])) {
189 189
 
190
-            self::$instance['queue']=(new Queue());
190
+            self::$instance['queue'] = (new Queue());
191 191
             return self::$instance['queue'];
192 192
 
193 193
         }
@@ -199,18 +199,18 @@  discard block
 block discarded – undo
199 199
      * @param bool $namespace
200 200
      * @return string
201 201
      */
202
-    public static function repository($service,$namespace=false)
202
+    public static function repository($service, $namespace = false)
203 203
     {
204 204
         //I can get the repository name from the magic method as a salt repository,
205 205
         //after which we will edit it as an adapter namespace.
206
-        $repositoryName=ucfirst(preg_replace('@Repository@is','',$service));
206
+        $repositoryName = ucfirst(preg_replace('@Repository@is', '', $service));
207 207
 
208 208
         //If we then configure the name of the simple repository to be an adapter
209 209
         //then we will give the user an example of the adapter class in each repository call.
210 210
         $repositoryAdapterName  = $repositoryName.'Adapter';
211 211
         $repositoryNamespace    = app()->namespace()->repository().'\\'.$repositoryName.'\\'.$repositoryAdapterName;
212 212
 
213
-        if($namespace) return $repositoryNamespace;
213
+        if ($namespace) return $repositoryNamespace;
214 214
 
215 215
         //and eventually we conclude the adapter class of the repository package as an instance.
216 216
         return app()->resolve($repositoryNamespace)->adapter();
@@ -221,17 +221,17 @@  discard block
 block discarded – undo
221 221
      * @param $arg
222 222
      * @return mixed
223 223
      */
224
-    private static function source($service,$arg)
224
+    private static function source($service, $arg)
225 225
     {
226 226
         //get Source path
227
-        $service=ucfirst($service);
228
-        $getCalledClass=str_replace('\\'.class_basename($arg[0]),'',get_class($arg[0]));
229
-        $getCalledClass=class_basename($getCalledClass);
227
+        $service = ucfirst($service);
228
+        $getCalledClass = str_replace('\\'.class_basename($arg[0]), '', get_class($arg[0]));
229
+        $getCalledClass = class_basename($getCalledClass);
230 230
 
231
-        $service=str_replace($getCalledClass,'',$service);
231
+        $service = str_replace($getCalledClass, '', $service);
232 232
 
233 233
         //run service for endpoint
234
-        $serviceSource=StaticPathModel::appSourceEndpoint().'\\'.$getCalledClass.'\\'.$service.'\Main';
234
+        $serviceSource = StaticPathModel::appSourceEndpoint().'\\'.$getCalledClass.'\\'.$service.'\Main';
235 235
         return app()->resolve($serviceSource);
236 236
     }
237 237
 
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
      */
241 241
     public static function redis()
242 242
     {
243
-        if(!isset(self::$instance['redis'])){
243
+        if (!isset(self::$instance['redis'])) {
244 244
 
245
-            self::$instance['redis']=(new Redis())->client();
245
+            self::$instance['redis'] = (new Redis())->client();
246 246
             return self::$instance['redis'];
247 247
 
248 248
         }
@@ -253,30 +253,30 @@  discard block
 block discarded – undo
253 253
      * @param null $param
254 254
      * @return array|null|string
255 255
      */
256
-    public function route($param=null)
256
+    public function route($param = null)
257 257
     {
258
-        $kernel=self::getAppInstance()->kernel;
258
+        $kernel = self::getAppInstance()->kernel;
259 259
 
260
-        $saltRouteParameters=$kernel->routeParameters;
261
-        $urlMethod=strtolower($kernel->urlComponent['method']);
260
+        $saltRouteParameters = $kernel->routeParameters;
261
+        $urlMethod = strtolower($kernel->urlComponent['method']);
262 262
 
263
-        $serviceConfRouteParameters=[];
264
-        if(isset($kernel->serviceConf['routeParameters'][$urlMethod])){
265
-            $serviceConfRouteParameters=$kernel->serviceConf['routeParameters'][$urlMethod];
263
+        $serviceConfRouteParameters = [];
264
+        if (isset($kernel->serviceConf['routeParameters'][$urlMethod])) {
265
+            $serviceConfRouteParameters = $kernel->serviceConf['routeParameters'][$urlMethod];
266 266
         }
267 267
 
268
-        $list=[];
268
+        $list = [];
269 269
 
270
-        foreach ($saltRouteParameters as $key=>$value){
271
-            if(isset($serviceConfRouteParameters[$key])){
272
-                $list[$serviceConfRouteParameters[$key]]=$value;
270
+        foreach ($saltRouteParameters as $key=>$value) {
271
+            if (isset($serviceConfRouteParameters[$key])) {
272
+                $list[$serviceConfRouteParameters[$key]] = $value;
273 273
             }
274
-            else{
275
-                $list[$key]=$value;
274
+            else {
275
+                $list[$key] = $value;
276 276
             }
277 277
         }
278 278
 
279
-        if($param===null){
279
+        if ($param===null) {
280 280
             return $list;
281 281
         }
282 282
 
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
      * @param array $select
289 289
      * @return mixed|string
290 290
      */
291
-    public function translator($data,$select=array())
291
+    public function translator($data, $select = array())
292 292
     {
293
-        $lang=(new Lingua(path()->appLanguage()));
293
+        $lang = (new Lingua(path()->appLanguage()));
294 294
 
295
-        $defaultLocale=config('app.locale');
295
+        $defaultLocale = config('app.locale');
296 296
 
297
-        if(count($select)){
298
-            return $lang->include(['default'])->locale($defaultLocale)->get($data,$select);
297
+        if (count($select)) {
298
+            return $lang->include(['default'])->locale($defaultLocale)->get($data, $select);
299 299
         }
300 300
 
301 301
         return $lang->include(['default'])->locale($defaultLocale)->get($data);
Please login to merge, or discard this patch.
src/resta/Support/Utils.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@
 block discarded – undo
241 241
         $rootDelete=str_replace(root.''.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'','',$namespace);
242 242
 
243 243
         return 'App\\'.self::generatorNamespace(
244
-          explode(''.DIRECTORY_SEPARATOR.'',$rootDelete)
244
+            explode(''.DIRECTORY_SEPARATOR.'',$rootDelete)
245 245
         );
246 246
 
247 247
     }
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * @var array $bool
12 12
      */
13
-    private static $bool=[];
13
+    private static $bool = [];
14 14
 
15 15
     /**
16 16
      * @var array
17 17
      */
18
-    private static $recursiveArray= [];
18
+    private static $recursiveArray = [];
19 19
 
20 20
     /**
21 21
      * @return \DI\Container
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
      * @throws \DI\DependencyException
34 34
      * @throws \DI\NotFoundException
35 35
      */
36
-    public static function resolve($class=null)
36
+    public static function resolve($class = null)
37 37
     {
38 38
         //class resolve
39
-        if($class!==null){
39
+        if ($class!==null) {
40 40
             $container = self::callBuild();
41 41
             return $container->get($class);
42 42
         }
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
      * @param bool $shift
48 48
      * @return array
49 49
      */
50
-    public static function upperCase($argument,$shift=true)
50
+    public static function upperCase($argument, $shift = true)
51 51
     {
52
-        if($shift){
52
+        if ($shift) {
53 53
             array_shift($argument);
54 54
         }
55 55
 
56
-        return array_map(function($argument){
56
+        return array_map(function($argument) {
57 57
             return ucfirst($argument);
58 58
         },$argument);
59 59
     }
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public static function strtolower($argument)
79 79
     {
80
-        if(!is_array($argument)){
80
+        if (!is_array($argument)) {
81 81
             return strtolower($argument);
82 82
         }
83
-        return array_map(function($argument){
83
+        return array_map(function($argument) {
84 84
             return strtolower($argument);
85 85
         },$argument);
86 86
     }
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
      * @param array $data
90 90
      * @return string
91 91
      */
92
-    public static function generatorNamespace($data=array())
92
+    public static function generatorNamespace($data = array())
93 93
     {
94
-        return str_replace('.php','',implode("\\",$data));
94
+        return str_replace('.php', '', implode("\\", $data));
95 95
     }
96 96
 
97 97
     /**
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
      * @param bool $extension
100 100
      * @return mixed
101 101
      */
102
-    public static function getPathFromNamespace($class,$extension=true)
102
+    public static function getPathFromNamespace($class, $extension = true)
103 103
     {
104
-        if($extension){
105
-            $default=root.'/'.str_replace("\\","/",$class).'.php';
104
+        if ($extension) {
105
+            $default = root.'/'.str_replace("\\", "/", $class).'.php';
106 106
         }
107
-        else{
108
-            $default=root.'/'.str_replace("\\","/",$class).'';
107
+        else {
108
+            $default = root.'/'.str_replace("\\", "/", $class).'';
109 109
         }
110 110
 
111
-        return str_replace("/App",'/src/app',$default);
111
+        return str_replace("/App", '/src/app', $default);
112 112
     }
113 113
 
114 114
     /**
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
      * @param $method
126 126
      * @return bool
127 127
      */
128
-    public static function existMethod($class,$method)
128
+    public static function existMethod($class, $method)
129 129
     {
130
-        return method_exists($class,$method);
130
+        return method_exists($class, $method);
131 131
     }
132 132
 
133 133
     /**
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
      * @param $second
136 136
      * @return bool
137 137
      */
138
-    public static function isArrayEqual($first,$second)
138
+    public static function isArrayEqual($first, $second)
139 139
     {
140
-        return (count( $first ) == count( $second ) && !array_diff( $first, $second ));
140
+        return (count($first)==count($second) && !array_diff($first, $second));
141 141
     }
142 142
 
143 143
     /**
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
      * @param bool $filename
155 155
      * @return array
156 156
      */
157
-    public static function glob($path,$filename=false)
157
+    public static function glob($path, $filename = false)
158 158
     {
159 159
         $configList = [];
160 160
 
161 161
         foreach (glob($path.'/*.php') as $config) {
162 162
 
163
-            $configArray=str_replace(".php","",explode("/",$config));
164
-            $configList[end($configArray)]=$config;
163
+            $configArray = str_replace(".php", "", explode("/", $config));
164
+            $configList[end($configArray)] = $config;
165 165
         }
166 166
 
167
-        if($filename===true){
167
+        if ($filename===true) {
168 168
             return array_keys($configList);
169 169
         }
170 170
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      * @param string $seperator
194 194
      * @return mixed
195 195
      */
196
-    public static function getJustClassName($namespace,$seperator="\\")
196
+    public static function getJustClassName($namespace, $seperator = "\\")
197 197
     {
198 198
         $path = explode($seperator, $namespace);
199 199
         return array_pop($path);
@@ -204,15 +204,15 @@  discard block
 block discarded – undo
204 204
      * @param array $param
205 205
      * @return bool
206 206
      */
207
-    public static function changeClass($class,$param=array())
207
+    public static function changeClass($class, $param = array())
208 208
     {
209
-        $executionPath=$class;
209
+        $executionPath = $class;
210 210
         $dt = fopen($executionPath, "r");
211 211
         $content = fread($dt, filesize($executionPath));
212 212
         fclose($dt);
213 213
 
214
-        foreach ($param as $key=>$value){
215
-            $content=str_replace($key,$value,$content);
214
+        foreach ($param as $key=>$value) {
215
+            $content = str_replace($key, $value, $content);
216 216
         }
217 217
 
218 218
         $dt = fopen($executionPath, "w");
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
      * @param $callback
228 228
      * @return mixed
229 229
      */
230
-    public static function returnCallback($data,$callback)
230
+    public static function returnCallback($data, $callback)
231 231
     {
232
-        return call_user_func_array($callback,[$data]);
232
+        return call_user_func_array($callback, [$data]);
233 233
     }
234 234
 
235 235
     /**
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public static function getNamespace($namespace)
240 240
     {
241
-        $rootDelete=str_replace(root.''.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'','',$namespace);
241
+        $rootDelete = str_replace(root.''.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'', '', $namespace);
242 242
 
243 243
         return 'App\\'.self::generatorNamespace(
244
-          explode(''.DIRECTORY_SEPARATOR.'',$rootDelete)
244
+          explode(''.DIRECTORY_SEPARATOR.'', $rootDelete)
245 245
         );
246 246
 
247 247
     }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      */
253 253
     public static function callbackProcess($callback)
254 254
     {
255
-        return (is_callable($callback)) ? call_user_func_array($callback,[app()]) : $callback;
255
+        return (is_callable($callback)) ? call_user_func_array($callback, [app()]) : $callback;
256 256
     }
257 257
 
258 258
     /**
@@ -260,29 +260,29 @@  discard block
 block discarded – undo
260 260
      * @param $array2
261 261
      * @return bool
262 262
      */
263
-    public static function array_diff_key_recursive ($array1, $array2)
263
+    public static function array_diff_key_recursive($array1, $array2)
264 264
     {
265
-        if(count($array1)!==count($array2)) self::$bool[]=false;
265
+        if (count($array1)!==count($array2)) self::$bool[] = false;
266 266
 
267
-        foreach ($array1 as $array1_key=>$array1_value){
267
+        foreach ($array1 as $array1_key=>$array1_value) {
268 268
 
269
-            if(!is_array($array1_value)){
270
-                if(!array_key_exists($array1_key,$array2)) self::$bool[]=false;
269
+            if (!is_array($array1_value)) {
270
+                if (!array_key_exists($array1_key, $array2)) self::$bool[] = false;
271 271
             }
272
-            else{
273
-                if(!array_key_exists($array1_key,$array2)) self::$bool[]=false;
272
+            else {
273
+                if (!array_key_exists($array1_key, $array2)) self::$bool[] = false;
274 274
 
275
-                if(!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) $array2[$array1_key]=[];
275
+                if (!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) $array2[$array1_key] = [];
276 276
 
277
-                if(isset($array1_value[0])) $array1_value=$array1_value[0];
277
+                if (isset($array1_value[0])) $array1_value = $array1_value[0];
278 278
 
279
-                if(isset($array2[$array1_key][0])) $array2[$array1_key]=$array2[$array1_key][0];
279
+                if (isset($array2[$array1_key][0])) $array2[$array1_key] = $array2[$array1_key][0];
280 280
 
281
-                self::array_diff_key_recursive($array1_value,$array2[$array1_key]);
281
+                self::array_diff_key_recursive($array1_value, $array2[$array1_key]);
282 282
             }
283 283
         }
284 284
 
285
-        if(in_array(false,self::$bool)){
285
+        if (in_array(false, self::$bool)) {
286 286
             return false;
287 287
         }
288 288
         return true;
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      */
295 295
     public static function slashToBackSlash($data)
296 296
     {
297
-        return str_replace("/","\\",$data);
297
+        return str_replace("/", "\\", $data);
298 298
     }
299 299
 
300 300
     /**
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
      * @param null $key
303 303
      * @return null
304 304
      */
305
-    public static function trace($debug=0,$key=null)
305
+    public static function trace($debug = 0, $key = null)
306 306
     {
307
-        $trace=debug_backtrace();
307
+        $trace = debug_backtrace();
308 308
 
309
-        if($key===null){
309
+        if ($key===null) {
310 310
             return $trace[$debug] ?? null;
311 311
         }
312 312
         return $trace[$debug][$key] ?? null;
@@ -321,13 +321,13 @@  discard block
 block discarded – undo
321 321
     public  static function chmod_r($dir, $dirPermissions, $filePermissions)
322 322
     {
323 323
         $dp = opendir($dir);
324
-        while($file = readdir($dp)) {
325
-            if (($file == ".") || ($file == ".."))
324
+        while ($file = readdir($dp)) {
325
+            if (($file==".") || ($file==".."))
326 326
                 continue;
327 327
 
328 328
             $fullPath = $dir."/".$file;
329 329
 
330
-            if(is_dir($fullPath)) {
330
+            if (is_dir($fullPath)) {
331 331
                 chmod($fullPath, $dirPermissions);
332 332
                 self::chmod_r($fullPath, $dirPermissions, $filePermissions);
333 333
             } else {
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      */
344 344
     public static function getServiceConf()
345 345
     {
346
-        if(property_exists(core(),'serviceConf') && defined('methodName')){
346
+        if (property_exists(core(), 'serviceConf') && defined('methodName')) {
347 347
             return core()->serviceConf;
348 348
         }
349 349
         return [];
@@ -359,17 +359,17 @@  discard block
 block discarded – undo
359 359
      */
360 360
     public static function getAllFilesInDirectory($dir, $recursive = true, $basedir = '', $include_dirs = false)
361 361
     {
362
-        if ($dir == '') {return array();} else {$results = array(); $subresults = array();}
363
-        if (!is_dir($dir)) {$dir = dirname($dir);} // so a files path can be sent
364
-        if ($basedir == '') {$basedir = realpath($dir).DIRECTORY_SEPARATOR;}
362
+        if ($dir=='') {return array(); } else {$results = array(); $subresults = array(); }
363
+        if (!is_dir($dir)) {$dir = dirname($dir); } // so a files path can be sent
364
+        if ($basedir=='') {$basedir = realpath($dir).DIRECTORY_SEPARATOR; }
365 365
 
366 366
         $files = scandir($dir);
367
-        foreach ($files as $key => $value){
368
-            if ( ($value != '.') && ($value != '..') ) {
367
+        foreach ($files as $key => $value) {
368
+            if (($value!='.') && ($value!='..')) {
369 369
                 $path = realpath($dir.DIRECTORY_SEPARATOR.$value);
370 370
                 if (is_dir($path)) {
371 371
                     // optionally include directories in file list
372
-                    if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path);}
372
+                    if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path); }
373 373
                     // optionally get file list for all subdirectories
374 374
                     if ($recursive) {
375 375
                         $subdirresults = self::getAllFilesInDirectory($path, $recursive, $basedir, $include_dirs);
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             }
383 383
         }
384 384
         // merge the subarray to give the list of files then subdirectory files
385
-        if (count($subresults) > 0) {$results = array_merge($subresults, $results);}
385
+        if (count($subresults)>0) {$results = array_merge($subresults, $results); }
386 386
         return $results;
387 387
     }
388 388
 
@@ -391,18 +391,18 @@  discard block
 block discarded – undo
391 391
      * @param null $reelPath
392 392
      * @return array
393 393
      */
394
-    public static function getPathWithPhpExtension($files,$reelPath=null)
394
+    public static function getPathWithPhpExtension($files, $reelPath = null)
395 395
     {
396 396
         $pathWithPhpList = [];
397 397
 
398
-        foreach ($files as $file){
398
+        foreach ($files as $file) {
399 399
 
400
-            if(preg_match('@(.*).php@is',$file,$pathWithPhp)){
400
+            if (preg_match('@(.*).php@is', $file, $pathWithPhp)) {
401 401
 
402
-                if($reelPath===null){
402
+                if ($reelPath===null) {
403 403
                     $pathWithPhpList[] = $pathWithPhp[0];
404 404
                 }
405
-                else{
405
+                else {
406 406
                     $pathWithPhpList[] = $reelPath.'/'.$pathWithPhp[0];
407 407
                 }
408 408
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
      */
436 436
     public static function resolverClass($class)
437 437
     {
438
-        if(self::isNamespaceExists($class)){
438
+        if (self::isNamespaceExists($class)) {
439 439
             return app()->resolve($class);
440 440
         }
441 441
 
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
      */
448 448
     public static function getRequestPathInfo()
449 449
     {
450
-        if(is_null(BootStaticManager::getRequestPath())){
451
-            return explode("/",request()->getPathInfo());
450
+        if (is_null(BootStaticManager::getRequestPath())) {
451
+            return explode("/", request()->getPathInfo());
452 452
         }
453 453
         return BootStaticManager::getRequestPath();
454 454
     }
Please login to merge, or discard this patch.
Braces   +24 added lines, -14 removed lines patch added patch discarded remove patch
@@ -103,8 +103,7 @@  discard block
 block discarded – undo
103 103
     {
104 104
         if($extension){
105 105
             $default=root.'/'.str_replace("\\","/",$class).'.php';
106
-        }
107
-        else{
106
+        } else{
108 107
             $default=root.'/'.str_replace("\\","/",$class).'';
109 108
         }
110 109
 
@@ -262,21 +261,32 @@  discard block
 block discarded – undo
262 261
      */
263 262
     public static function array_diff_key_recursive ($array1, $array2)
264 263
     {
265
-        if(count($array1)!==count($array2)) self::$bool[]=false;
264
+        if(count($array1)!==count($array2)) {
265
+            self::$bool[]=false;
266
+        }
266 267
 
267 268
         foreach ($array1 as $array1_key=>$array1_value){
268 269
 
269 270
             if(!is_array($array1_value)){
270
-                if(!array_key_exists($array1_key,$array2)) self::$bool[]=false;
271
-            }
272
-            else{
273
-                if(!array_key_exists($array1_key,$array2)) self::$bool[]=false;
271
+                if(!array_key_exists($array1_key,$array2)) {
272
+                    self::$bool[]=false;
273
+                }
274
+            } else{
275
+                if(!array_key_exists($array1_key,$array2)) {
276
+                    self::$bool[]=false;
277
+                }
274 278
 
275
-                if(!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) $array2[$array1_key]=[];
279
+                if(!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) {
280
+                    $array2[$array1_key]=[];
281
+                }
276 282
 
277
-                if(isset($array1_value[0])) $array1_value=$array1_value[0];
283
+                if(isset($array1_value[0])) {
284
+                    $array1_value=$array1_value[0];
285
+                }
278 286
 
279
-                if(isset($array2[$array1_key][0])) $array2[$array1_key]=$array2[$array1_key][0];
287
+                if(isset($array2[$array1_key][0])) {
288
+                    $array2[$array1_key]=$array2[$array1_key][0];
289
+                }
280 290
 
281 291
                 self::array_diff_key_recursive($array1_value,$array2[$array1_key]);
282 292
             }
@@ -322,8 +332,9 @@  discard block
 block discarded – undo
322 332
     {
323 333
         $dp = opendir($dir);
324 334
         while($file = readdir($dp)) {
325
-            if (($file == ".") || ($file == ".."))
326
-                continue;
335
+            if (($file == ".") || ($file == "..")) {
336
+                            continue;
337
+            }
327 338
 
328 339
             $fullPath = $dir."/".$file;
329 340
 
@@ -401,8 +412,7 @@  discard block
 block discarded – undo
401 412
 
402 413
                 if($reelPath===null){
403 414
                     $pathWithPhpList[] = $pathWithPhp[0];
404
-                }
405
-                else{
415
+                } else{
406 416
                     $pathWithPhpList[] = $reelPath.'/'.$pathWithPhp[0];
407 417
                 }
408 418
 
Please login to merge, or discard this patch.
src/resta/Support/ClosureDispatcher.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@
 block discarded – undo
33 33
      */
34 34
     public function call(\Closure $closure)
35 35
     {
36
-        if(!is_null($this->bind))
37
-            $closure = \Closure::bind($closure, $this->bind, $this->bind);
36
+        if(!is_null($this->bind)) {
37
+                    $closure = \Closure::bind($closure, $this->bind, $this->bind);
38
+        }
38 39
         return $closure();
39 40
     }
40 41
 }
41 42
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      */
36 36
     public function call(\Closure $closure)
37 37
     {
38
-        if(!is_null($this->bind))
38
+        if (!is_null($this->bind))
39 39
             $closure = \Closure::bind($closure, $this->bind, $this->bind);
40 40
         return $closure();
41 41
     }
Please login to merge, or discard this patch.
bootstrap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 //root definer: application root path
4
-define("root",str_replace("\\","/",realpath(__DIR__.'/')));
4
+define("root", str_replace("\\", "/", realpath(__DIR__.'/')));
5 5
 
6 6
 /**
7 7
  * resta system composer vendor autoload.
Please login to merge, or discard this patch.