Passed
Push — master ( e1b8c4...ea4361 )
by 世昌
01:52
created
suda/src/application/response/provider/type/FileContent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     {
22 22
         if ($content->isFile()) {
23 23
             $response->setType($content->getExtension());
24
-            $response->setHeader('Content-Disposition', 'attachment;filename="' . $content->getBasename().'"');
24
+            $response->setHeader('Content-Disposition', 'attachment;filename="'.$content->getBasename().'"');
25 25
             $response->setHeader('Cache-Control', 'max-age=0');
26 26
             $response->send(file_get_contents($content->getRealPath()));
27 27
         } else {
Please login to merge, or discard this patch.
suda/src/application/filesystem/DirectoryHelper.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -94,11 +94,11 @@  discard block
 block discarded – undo
94 94
      * @param boolean $full
95 95
      * @return \Iterator
96 96
      */
97
-    public static function readFiles(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator
97
+    public static function readFiles(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : \Iterator
98 98
     {
99 99
         $parent = Path::format($path);
100 100
         foreach (static::read($path, $recursive, $regex, false, $mode) as $subpath) {
101
-            $path = $full?$subpath:$parent.DIRECTORY_SEPARATOR.$subpath;
101
+            $path = $full ? $subpath : $parent.DIRECTORY_SEPARATOR.$subpath;
102 102
             if (is_file($path)) {
103 103
                 yield $subpath;
104 104
             }
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
      * @param boolean $full
115 115
      * @return \Iterator
116 116
      */
117
-    public static function readDirs(string $path, bool $recursive=false, ?string $regex=null, bool $full=false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator
117
+    public static function readDirs(string $path, bool $recursive = false, ?string $regex = null, bool $full = false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator
118 118
     {
119 119
         $parent = Path::format($path);
120 120
         foreach (static::read($path, $recursive, $regex, false, $mode) as $subpath) {
121
-            $path = $full?$subpath:$parent.DIRECTORY_SEPARATOR.$subpath;
121
+            $path = $full ? $subpath : $parent.DIRECTORY_SEPARATOR.$subpath;
122 122
             if (is_dir($path)) {
123 123
                 yield $subpath;
124 124
             }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      * @param boolean $full
135 135
      * @return \Iterator
136 136
      */
137
-    public static function read(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator
137
+    public static function read(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): \Iterator
138 138
     {
139 139
         $directory = Path::format($path);
140 140
         if ($directory && \is_dir($directory)) {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     }
151 151
     
152 152
 
153
-    protected static function buildIterator(string $directory, bool $recursive=false, ?string $regex = null, int $mode): \Iterator
153
+    protected static function buildIterator(string $directory, bool $recursive = false, ?string $regex = null, int $mode): \Iterator
154 154
     {
155 155
         $it = new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS);
156 156
         if ($regex !== null) {
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public static function cut(string $path, string $basepath):string
173 173
     {
174
-        $path =  PathTrait::toAbsolutePath($path);
174
+        $path = PathTrait::toAbsolutePath($path);
175 175
         $basepath = PathTrait::toAbsolutePath($basepath);
176 176
         if (strpos($path, $basepath.DIRECTORY_SEPARATOR) === 0) {
177 177
             return substr($path, \strlen($basepath) + 1);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      * @param boolean $move
189 189
      * @return boolean
190 190
      */
191
-    public static function copy(string $path, string $toPath, ?string $regex=null, bool $move = false):bool
191
+    public static function copy(string $path, string $toPath, ?string $regex = null, bool $move = false):bool
192 192
     {
193 193
         $directory = Path::format($path);
194 194
         static::makes($toPath);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      * @param string|null $regex
228 228
      * @return boolean
229 229
      */
230
-    public static function move(string $path, string $toPath, ?string $regex=null):bool
230
+    public static function move(string $path, string $toPath, ?string $regex = null):bool
231 231
     {
232 232
         return static::copy($path, $toPath, $regex, true);
233 233
     }
Please login to merge, or discard this patch.
suda/src/application/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/application/filesystem/FileSystem.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     public static function delete(string $path):bool
36 36
     {
37
-        if (($path=Path::format($path)) !== null) {
37
+        if (($path = Path::format($path)) !== null) {
38 38
             if (is_file($path)) {
39 39
                 return static::deleteFile($path);
40 40
             }
Please login to merge, or discard this patch.
suda/src/application/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/application/route/MatchResult.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@
 block discarded – undo
181 181
             $object = $class->getMethod('instance')->invoke(null);
182 182
             $context->setResponse($object);
183 183
             $class->getMethod('proccess')->invokeArgs($object, [
184
-                new Runnable([$object,'onRequest']),
184
+                new Runnable([$object, 'onRequest']),
185 185
                 $this->getRequest($context),
186 186
                 $this->matcher->getAttribute('buffer', true),
187 187
                 $context->isDebug(),
Please login to merge, or discard this patch.
suda/src/application/route/GroupRoutes.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function add(?string $module = null, string $name, RouteMatcher $router)
59 59
     {
60
-        $module =  $module ?: $this->default;
60
+        $module = $module ?: $this->default;
61 61
         if (\array_key_exists($module, $this->routes)) {
62 62
             $this->routes[$module]->add($name, $router);
63 63
         } else {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @param Request $request
90 90
      * @return MatchResult|null
91 91
      */
92
-    public function match(Request $request):?MatchResult
92
+    public function match(Request $request): ?MatchResult
93 93
     {
94 94
         foreach ($this->routes as $module => $collection) {
95 95
             foreach ($collection as $name => $matcher) {
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
      * @param string $name
109 109
      * @return RouteMatcher|null
110 110
      */
111
-    public function find(?string $module = null, string $name):?RouteMatcher
111
+    public function find(?string $module = null, string $name): ?RouteMatcher
112 112
     {
113
-        $module =  $module ?: $this->default;
113
+        $module = $module ?: $this->default;
114 114
         if (\array_key_exists($module, $this->routes)) {
115 115
             return $this->routes[$module]->get($name);
116 116
         }
Please login to merge, or discard this patch.
suda/src/application/module/NameFinder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
         $rpos = \strrpos($name, ':');
56 56
         if ($rpos > 0) {
57 57
             $module = substr($name, 0, $rpos);
58
-            $name = \substr($name, $rpos+1);
59
-            $moduleFull  = $this->getFullName($module);
58
+            $name = \substr($name, $rpos + 1);
59
+            $moduleFull = $this->getFullName($module);
60 60
             return [$moduleFull, $name];
61 61
         }
62 62
         if ($rpos === 0) {
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         if (\array_key_exists($version, $this->knownsFullName[$name])) {
78 78
             return $this->knownsFullName[$name][$version];
79 79
         }
80
-        return $hasVersion?$name.':'.$version:end($this->knownsFullName[$name]);
80
+        return $hasVersion ? $name.':'.$version : end($this->knownsFullName[$name]);
81 81
     }
82 82
     
83 83
     protected function getLikeName(string $name):string
Please login to merge, or discard this patch.
suda/src/application/module/Module.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
     public function getRoute(string $groupName): GroupRoutes
86 86
     {
87
-        $group = $groupName === 'default' ? '': '-'. $groupName;
88
-        $routeConfig = $this->getConfigFrom('route'.$group, ['group' => $group,]);
89
-        $routes =  new GroupRoutes($groupName);
87
+        $group = $groupName === 'default' ? '' : '-'.$groupName;
88
+        $routeConfig = $this->getConfigFrom('route'.$group, ['group' => $group, ]);
89
+        $routes = new GroupRoutes($groupName);
90 90
         if (\is_array($routeConfig)) {
91 91
             // debug()->debug('load route {group} from {module}',['group'=>$groupName, 'module' => $this->getFullName()]);
92 92
             $prefix = $this->config->get('route.prefix', '');
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function getFullName()
143 143
     {
144
-        return $this->name .':'. $this->version;
144
+        return $this->name.':'.$this->version;
145 145
     }
146 146
 
147 147
     /**
Please login to merge, or discard this patch.