Passed
Push — sudav3 ( ac6dc6...d2f44f )
by 世昌
02:12
created
suda/src/framework/filesystem/FileHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function delete(string $filename):bool
27 27
     {
28
-        if (($path=Path::format($filename)) !== null) {
28
+        if (($path = Path::format($filename)) !== null) {
29 29
             if (!is_writable($path)) {
30 30
                 return false;
31 31
             }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      */    
44 44
     public static function move(string $src, string $dest):bool
45 45
     {
46
-        if (($path=Path::format($src)) !== null && is_writable(dirname($dest))) {
46
+        if (($path = Path::format($src)) !== null && is_writable(dirname($dest))) {
47 47
             return rename($path, $dest);
48 48
         }
49 49
         return false;
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public static function copy(string $src, string $dest):bool
60 60
     {
61
-        if (($path=Path::format($src)) !== null && is_writable(dirname($dest))) {
61
+        if (($path = Path::format($src)) !== null && is_writable(dirname($dest))) {
62 62
             return copy($path, $dest);
63 63
         }
64 64
         return false;
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      * @param string $name
87 87
      * @return string|null
88 88
      */
89
-    public static function get(string $filename):?string
89
+    public static function get(string $filename): ?string
90 90
     {
91
-        if (is_readable($filename) && ($path=Path::format($filename)) !== null) {
91
+        if (is_readable($filename) && ($path = Path::format($filename)) !== null) {
92 92
             return file_get_contents($path);
93 93
         }
94 94
         return null;
Please login to merge, or discard this patch.
suda/src/framework/filesystem/FileSystemInterface.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param string $name
57 57
      * @return string|null
58 58
      */
59
-    public static function get(string $filename):?string;
59
+    public static function get(string $filename): ?string;
60 60
 
61 61
 
62 62
     /**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @param boolean $full
78 78
      * @return \Iterator
79 79
      */
80
-    public static function readFiles(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator;
80
+    public static function readFiles(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator;
81 81
     
82 82
     /**
83 83
      * 读目录下文件夹
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @param boolean $full
89 89
      * @return \Iterator
90 90
      */
91
-    public static function readDirs(string $path, bool $recursive=false, ?string $regex=null, bool $full=false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator;
91
+    public static function readDirs(string $path, bool $recursive = false, ?string $regex = null, bool $full = false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator;
92 92
     
93 93
     /**
94 94
      * 读目录,包括文件,文件夹
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @param boolean $full
100 100
      * @return \Iterator
101 101
      */
102
-    public static function read(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator;
102
+    public static function read(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator;
103 103
 
104 104
     /**
105 105
      * 截断部分目录
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      * @param boolean $move
120 120
      * @return boolean
121 121
      */
122
-    public static function copyDir(string $path, string $toPath, ?string $regex=null, bool $move = false):bool;
122
+    public static function copyDir(string $path, string $toPath, ?string $regex = null, bool $move = false):bool;
123 123
     
124 124
     /**
125 125
      * 移动文件夹
@@ -129,5 +129,5 @@  discard block
 block discarded – undo
129 129
      * @param string|null $regex
130 130
      * @return boolean
131 131
      */
132
-    public static function moveDir(string $path, string $toPath, ?string $regex=null):bool;
132
+    public static function moveDir(string $path, string $toPath, ?string $regex = null):bool;
133 133
 }
Please login to merge, or discard this patch.
suda/src/framework/config/PathResolver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class PathResolver
9 9
 {
10
-    public static function resolve(string $path):?string
10
+    public static function resolve(string $path): ?string
11 11
     {
12 12
         if (file_exists($path)) {
13 13
             return $path;
14 14
         }
15 15
         $basepath = dirname($path).'/'.pathinfo($path, PATHINFO_FILENAME);
16 16
         
17
-        return static::resolveYaml($basepath) ?? static::resolveExtensions($basepath, ['json','php','ini']);
17
+        return static::resolveYaml($basepath) ?? static::resolveExtensions($basepath, ['json', 'php', 'ini']);
18 18
     }
19 19
 
20
-    protected static function resolveYaml(string $basepath):?string
20
+    protected static function resolveYaml(string $basepath): ?string
21 21
     {
22 22
         if (file_exists($conf = $basepath.'.yml') || file_exists($conf = $basepath.'.yaml')) {
23 23
             if (function_exists('yaml_parse') || class_exists('Spyc')) {
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         return null;
28 28
     }
29 29
 
30
-    protected static function resolveExtensions(string $basepath, array $extensions):?string
30
+    protected static function resolveExtensions(string $basepath, array $extensions): ?string
31 31
     {
32 32
         foreach ($extensions as $ext) {
33 33
             if (file_exists($conf = $basepath.'.'.$ext)) {
Please login to merge, or discard this patch.
suda/src/framework/config/ContentLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@
 block discarded – undo
45 45
 
46 46
     protected static function parseValue(string $content, array $extra = []):string
47 47
     {
48
-        return preg_replace_callback('/\$\{(.+?)\}/', function ($matchs) use ($extra) {
48
+        return preg_replace_callback('/\$\{(.+?)\}/', function($matchs) use ($extra) {
49 49
             $name = $matchs[1];
50 50
             if (($value = ArrayDotAccess::get($extra, $name, null)) !== null) {
51 51
             } elseif (defined($name)) {
52 52
                 $value = constant($name);
53 53
             }
54
-            return is_string($value)?trim(json_encode($value), '"'):$value;
54
+            return is_string($value) ?trim(json_encode($value), '"') : $value;
55 55
         }, $content);
56 56
     }
57 57
 }
Please login to merge, or discard this patch.
suda/src/framework/route/RouteMatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function __construct(array $methods, string $uri, array $attribute = [])
44 44
     {
45
-        array_walk($methods, function ($value) {
45
+        array_walk($methods, function($value) {
46 46
             return strtoupper($value);
47 47
         });
48 48
         $this->methods = $methods;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param Request $request
159 159
      * @return array|null
160 160
      */
161
-    public function match(Request $request):?array
161
+    public function match(Request $request): ?array
162 162
     {
163 163
         if (count($this->methods) > 0 && !\in_array($request->getMethod(), $this->methods)) {
164 164
             return null;
Please login to merge, or discard this patch.
suda/src/framework/route/RouteCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
      * @param string $name
70 70
      * @return RouteMatcher|null
71 71
      */
72
-    public function get(string $name):?RouteMatcher
72
+    public function get(string $name): ?RouteMatcher
73 73
     {
74 74
         return $this->collection[$name] ?? null;
75 75
     }
Please login to merge, or discard this patch.
suda/src/framework/debug/log/logger/ConsoleLogger.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
 {
11 11
     public function log($level, string $message, array $context = [])
12 12
     {
13
-        print date('Y-m-d H:i:s') .' ' . $this->interpolate($message, $context) . PHP_EOL;
13
+        print date('Y-m-d H:i:s').' '.$this->interpolate($message, $context).PHP_EOL;
14 14
     }
15 15
     public function interpolate(string $message, array $context)
16 16
     {
17 17
         $replace = [];
18 18
         foreach ($context as $key => $val) {
19
-            $replace['{' . $key . '}'] = $val;
19
+            $replace['{'.$key.'}'] = $val;
20 20
         }
21 21
         return strtr($message, $replace);
22 22
     }
Please login to merge, or discard this patch.
suda/src/framework/debug/ConfigInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace suda\framework\debug;
3 3
 
4
-interface ConfigInterface  {
4
+interface ConfigInterface {
5 5
     public function applyConfig(array $config);
6 6
 }
Please login to merge, or discard this patch.
suda/src/framework/debug/ConfigTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     }
21 21
     public function getConfig(string $name) {
22 22
         $defaultConfig = $this->getDefaultConfig();
23
-        return $this->config[$name] ?? $defaultConfig[$name];;
23
+        return $this->config[$name] ?? $defaultConfig[$name]; ;
24 24
     }
25 25
 
26 26
     abstract public function getDefaultConfig():array;
Please login to merge, or discard this patch.