Passed
Push — master ( d0c9dc...facce7 )
by Php Easy Api
04:43
created
src/resta/Support/VersionManager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public static function getSupportedVersions()
18 18
     {
19
-        if(self::checkSupportedVersions()){
20
-            static::$supportedVersions = array_merge(static::$supportedVersions,static::supportedVersions());
19
+        if (self::checkSupportedVersions()) {
20
+            static::$supportedVersions = array_merge(static::$supportedVersions, static::supportedVersions());
21 21
         }
22 22
         return static::$supportedVersions;
23 23
     }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     private static function checkSupportedVersions()
31 31
     {
32
-        return method_exists(static::class,'supportedVersions')
32
+        return method_exists(static::class, 'supportedVersions')
33 33
             && is_array(static::supportedVersions());
34 34
     }
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
src/resta/Support/Command.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
      * @param $command
20 20
      * @param $args
21 21
      */
22
-    public function __construct($command,$args)
22
+    public function __construct($command, $args)
23 23
     {
24 24
         $this->arguments[]  = 'php';
25 25
         $this->arguments[]  = 'api';
26
-        $this->arguments    = array_merge($this->arguments,explode(" ",$command));
26
+        $this->arguments    = array_merge($this->arguments, explode(" ", $command));
27 27
         $this->arguments[]  = strtolower(app);
28 28
         $this->arguments[]  = $args;
29 29
     }
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function handle()
37 37
     {
38
-        $process = new ProcessHandler($this->arguments,root.'');
38
+        $process = new ProcessHandler($this->arguments, root.'');
39 39
         $process->start();
40 40
 
41 41
         foreach ($process as $type => $data) {
42
-            if ($process::OUT !== $type) {
42
+            if ($process::OUT!==$type) {
43 43
                 return false;
44 44
             }
45 45
             return true;
Please login to merge, or discard this patch.
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/Macro.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
      * @param callable $callback
42 42
      * @return mixed
43 43
      */
44
-    public function get($method,callable $callback)
44
+    public function get($method, callable $callback)
45 45
     {
46
-        if($this->isMacro){
47
-            if(method_exists($resolve = $this->app->resolve($this->macro),$method)){
46
+        if ($this->isMacro) {
47
+            if (method_exists($resolve = $this->app->resolve($this->macro), $method)) {
48 48
                 return $resolve->macro($this->class);
49 49
             }
50 50
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         // if the macro class is a valid object,
63 63
         // then this macro will return a boolean value if it has the specified methode.
64
-        if($this->checkMacroConditions()){
64
+        if ($this->checkMacroConditions()) {
65 65
 
66 66
             $this->isMacro  = true;
67 67
             $this->class    = $class;
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
      * @param $method
79 79
      * @return mixed
80 80
      */
81
-    public function with($macro,$concrete,$method)
81
+    public function with($macro, $concrete, $method)
82 82
     {
83
-        if($this->macro === null){
84
-            return $this($macro)->isMacro($concrete)->get($method,function() use($concrete){
83
+        if ($this->macro===null) {
84
+            return $this($macro)->isMacro($concrete)->get($method, function() use($concrete){
85 85
                 return $concrete;
86 86
             });
87 87
         }
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
      * @param null $macro
94 94
      * @return $this
95 95
      */
96
-    public function __invoke($macro=null)
96
+    public function __invoke($macro = null)
97 97
     {
98
-        if($macro!==null){
98
+        if ($macro!==null) {
99 99
             $this->macro = $macro;
100 100
         }
101 101
         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/BootStaticManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@
 block discarded – undo
14 14
      *
15 15
      * @param null $path
16 16
      */
17
-    public static function setPath($path=null)
17
+    public static function setPath($path = null)
18 18
     {
19
-        if(!is_null($path)){
19
+        if (!is_null($path)) {
20 20
             self::$requestPath = $path;
21 21
         }
22 22
     }
Please login to merge, or discard this patch.