Passed
Push — master ( c16597...d252dc )
by 世昌
02:55
created
suda/src/orm/statement/PrepareTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             $fields = $reads;
31 31
         } else {
32 32
             $field = [];
33
-            $prefix = strlen($table) ?"`{$table}`." :'';
33
+            $prefix = strlen($table) ? "`{$table}`." : '';
34 34
             foreach ($reads as $want) {
35 35
                 $field[] = $prefix."`$want`";
36 36
             }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         list($inSQL, $binders) = $this->prepareInParameter($values, $name);
104 104
         $sql = $name.' IN ('.$inSQL.')';
105
-        return [$sql,$binders];
105
+        return [$sql, $binders];
106 106
     }
107 107
 
108 108
     /**
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     protected function prepareQueryMark(string $sql, array $parameter)
155 155
     {
156 156
         $binders = [];
157
-        $query = preg_replace_callback('/\?/', function ($match) use (&$binders, $parameter) {
157
+        $query = preg_replace_callback('/\?/', function($match) use (&$binders, $parameter) {
158 158
             $index = count($binders);
159 159
             if (array_key_exists($index, $parameter)) {
160 160
                 $name = Binder::index($index);
Please login to merge, or discard this patch.
suda/src/orm/DataSource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
      * @return Connection
116 116
      * @throws SQLException
117 117
      */
118
-    public static function new(string $type, array $config, ?string $name = null): Connection
118
+    public static function new(string $type, array $config, ?string $name = null) : Connection
119 119
     {
120 120
         if (array_key_exists($type, static::$type)) {
121 121
             return new static::$type[$type]($config, $name);
Please login to merge, or discard this patch.
suda/src/framework/loader/Loader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param string $className
42 42
      * @return string|null
43 43
      */
44
-    public function getClassPath(string $className):?string
44
+    public function getClassPath(string $className): ?string
45 45
     {
46 46
         // 搜索路径
47 47
         foreach ($this->includePath as $includeNamespace => $includePaths) {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param string $filename
59 59
      * @return string|null
60 60
      */
61
-    public function import(string $filename):?string
61
+    public function import(string $filename): ?string
62 62
     {
63 63
         if ($filename = static::realPath($filename)) {
64 64
             @require_once $filename;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param string $className
102 102
      * @return string|null
103 103
      */
104
-    protected function getClassPathByAlias(string $includePath, string $className):?string
104
+    protected function getClassPathByAlias(string $includePath, string $className): ?string
105 105
     {
106 106
         $namepath = static::formatSeparator($className);
107 107
         $className = static::realName($className);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      * @param string $className
127 127
      * @return string|null
128 128
      */
129
-    protected function getClassPathByName(string $includeNamespace, string $includePath, string $className):?string
129
+    protected function getClassPathByName(string $includeNamespace, string $includePath, string $className): ?string
130 130
     {
131 131
         if (is_numeric($includeNamespace)) {
132 132
             $path = $includePath.DIRECTORY_SEPARATOR.static::formatSeparator($className).'.php';
Please login to merge, or discard this patch.
suda/src/framework/runnable/target/MethodTarget.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->method = $method;
61 61
         $static = $this->isStatic() ? '->' : '::';
62 62
         $name = is_object($object) ? get_class($object) : $object;
63
-        $this->name = $name . $static . $method;
63
+        $this->name = $name.$static.$method;
64 64
     }
65 65
 
66 66
     /**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         if (null === $this->requireFile) {
122 122
             $this->requireFile = $requireFile;
123
-            $this->name = $this->name . '@' . $requireFile;
123
+            $this->name = $this->name.'@'.$requireFile;
124 124
         }
125 125
         return $this;
126 126
     }
Please login to merge, or discard this patch.
suda/src/framework/runnable/target/TargetBuilder.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
         $methodStart = $splitLength ?: strpos($command, '::') ?: $dynmicsMethod;
63 63
         $parameter = self::buildParameter($parameter);
64 64
         if ($methodStart > 0) {
65
-            $splitLength = $splitLength > 0 ? 1:2;
65
+            $splitLength = $splitLength > 0 ? 1 : 2;
66 66
             $methodName = substr($command, $methodStart + $splitLength);
67 67
             $command = substr($command, 0, $methodStart);
68 68
             list($className, $constructParameter) = self::splitParameter($command);
69 69
             $constructParameter = self::buildParameter($constructParameter);
70
-            $target = new MethodTarget($className, $dynmicsMethod? $constructParameter :null, $methodName, $parameter);
70
+            $target = new MethodTarget($className, $dynmicsMethod ? $constructParameter : null, $methodName, $parameter);
71 71
         } else {
72 72
             $target = new FunctionTarget(self::buildName($command), $parameter);
73 73
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         if (preg_match('/^[\w\\\\\/.]+$/', $name) !== 1) {
100 100
             throw new InvalidNameException(sprintf('invaild name: %s ', $name));
101 101
         }
102
-        return  str_replace(['.','/'], '\\', $name);
102
+        return  str_replace(['.', '/'], '\\', $name);
103 103
     }
104 104
 
105 105
     private static function splitParameter(string $command):array
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             $parameter = substr($command, $paramStart + 1, strlen($command) - $paramStart - 2);
111 111
             $command = substr($command, 0, $paramStart);
112 112
         }
113
-        return [$command,$parameter];
113
+        return [$command, $parameter];
114 114
     }
115 115
 
116 116
     private static function buildParameter(?string $parameter)
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
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param string $filename
62 62
      * @return string|null
63 63
      */
64
-    public static function get(string $filename):?string;
64
+    public static function get(string $filename): ?string;
65 65
 
66 66
 
67 67
     /**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @param int $mode
85 85
      * @return Iterator
86 86
      */
87
-    public static function readFiles(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : Iterator;
87
+    public static function readFiles(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY) : Iterator;
88 88
 
89 89
     /**
90 90
      * 读目录下文件夹
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @param int $mode
97 97
      * @return Iterator
98 98
      */
99
-    public static function readDirs(string $path, bool $recursive=false, ?string $regex=null, bool $full=false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): Iterator;
99
+    public static function readDirs(string $path, bool $recursive = false, ?string $regex = null, bool $full = false, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): Iterator;
100 100
 
101 101
     /**
102 102
      * 读目录,包括文件,文件夹
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param int $mode
109 109
      * @return Iterator
110 110
      */
111
-    public static function read(string $path, bool $recursive=false, ?string $regex=null, bool $full=true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): Iterator;
111
+    public static function read(string $path, bool $recursive = false, ?string $regex = null, bool $full = true, int $mode = RecursiveIteratorIterator::LEAVES_ONLY): Iterator;
112 112
 
113 113
     /**
114 114
      * 截断部分目录
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param boolean $move
129 129
      * @return boolean
130 130
      */
131
-    public static function copyDir(string $path, string $toPath, ?string $regex=null, bool $move = false):bool;
131
+    public static function copyDir(string $path, string $toPath, ?string $regex = null, bool $move = false):bool;
132 132
     
133 133
     /**
134 134
      * 移动文件夹
@@ -138,5 +138,5 @@  discard block
 block discarded – undo
138 138
      * @param string|null $regex
139 139
      * @return boolean
140 140
      */
141
-    public static function moveDir(string $path, string $toPath, ?string $regex=null):bool;
141
+    public static function moveDir(string $path, string $toPath, ?string $regex = null):bool;
142 142
 }
Please login to merge, or discard this patch.
suda/src/framework/Debugger.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,18 +91,18 @@
 block discarded – undo
91 91
      */
92 92
     public static function createDefaultLogger(): LoggerInterface
93 93
     {
94
-        $dataPath = SUDA_DATA . '/logs';
94
+        $dataPath = SUDA_DATA.'/logs';
95 95
         FileSystem::make($dataPath);
96 96
         if (is_writable(dirname($dataPath))) {
97
-            FileSystem::make($dataPath . '/zip');
98
-            FileSystem::make($dataPath . '/dump');
97
+            FileSystem::make($dataPath.'/zip');
98
+            FileSystem::make($dataPath.'/dump');
99 99
             return new FileLogger(
100 100
                 [
101 101
                     'log-level' => SUDA_DEBUG_LEVEL,
102 102
                     'save-path' => $dataPath,
103
-                    'save-zip-path' => $dataPath . '/zip',
103
+                    'save-zip-path' => $dataPath.'/zip',
104 104
                     'log-format' => '%message%',
105
-                    'save-pack-path' => $dataPath . '/dump',
105
+                    'save-pack-path' => $dataPath.'/dump',
106 106
                 ]
107 107
             );
108 108
         }
Please login to merge, or discard this patch.
suda/src/framework/route/uri/MatcherHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         // 添加 * ? 匹配
37 37
         $url = str_replace(['\*', '\?'], ['[^/]*?', '[^/]'], $url);
38 38
         // 编译页面参数
39
-        $url = preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function ($match) use (&$parameters) {
39
+        $url = preg_replace_callback('/\{(\w+)(?:\:([^}]+?))?\}/', function($match) use (&$parameters) {
40 40
             $name = $match[1];
41 41
             $type = 'string';
42 42
             $extra = '';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $url = static::parseIgnorableParameter($url, $matcher, $parameter, $mapper);
71 71
         $url = static::replaceParameter($url, $matcher, $parameter, $mapper);
72 72
         if (count($query) && $allowQuery) {
73
-            return $url . '?' . http_build_query($query, 'v', '&', PHP_QUERY_RFC3986);
73
+            return $url.'?'.http_build_query($query, 'v', '&', PHP_QUERY_RFC3986);
74 74
         }
75 75
         return $url;
76 76
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         array $parameter,
89 89
         array $mapper
90 90
     ): string {
91
-        return preg_replace_callback('/\[(.+?)\]/', function ($match) use ($matcher, $parameter, $mapper) {
91
+        return preg_replace_callback('/\[(.+?)\]/', function($match) use ($matcher, $parameter, $mapper) {
92 92
             if (preg_match('/\{(\w+).+?\}/', $match[1])) {
93 93
                 $count = 0;
94 94
                 $subUrl = static::replaceParameter($match[1], $matcher, $parameter, $mapper, true, $count);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     ) {
142 142
         return preg_replace_callback(
143 143
             '/\{(\w+).+?\}/',
144
-            function ($match) use ($matcher, $parameter, $mapper, $ignore, &$count) {
144
+            function($match) use ($matcher, $parameter, $mapper, $ignore, &$count) {
145 145
                 if (array_key_exists($match[1], $mapper)) {
146 146
                     $count++;
147 147
                     return $mapper[$match[1]]->packValue($parameter[$match[1]]);
Please login to merge, or discard this patch.
suda/src/application/loader/ApplicationLoader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         foreach ($this->application->getModules() as $name => $module) {
54 54
             if ($module->getStatus() === Module::REACHABLE) {
55
-                call_user_func([$this->moduleLoader[$name],'toReachable']);
55
+                call_user_func([$this->moduleLoader[$name], 'toReachable']);
56 56
             }
57 57
         }
58 58
     }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function getDataSourceGroup(string $groupName):DataSource
95 95
     {
96
-        $group = $groupName === 'default' ? '': '-'. $groupName;
96
+        $group = $groupName === 'default' ? '' : '-'.$groupName;
97 97
         $dataSourceConfigPath = $this->application->getResource()->getConfigResourcePath('config/data-source'.$group);
98 98
         $dataSource = new DataSource;
99 99
         $observer = new DebugObserver($this->application->debug());
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
     protected function registerModule()
160 160
     {
161
-        $extractPath = SUDA_DATA .'/extract-module';
161
+        $extractPath = SUDA_DATA.'/extract-module';
162 162
         FileSystem::make($extractPath);
163 163
         foreach ($this->application->getModulePaths() as $path) {
164 164
             $this->registerModuleFrom($path, $extractPath);
Please login to merge, or discard this patch.