Passed
Push — dev ( 6b4bd1...b901d7 )
by 世昌
02:22
created
suda/src/framework/http/stream/StringStream.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@
 block discarded – undo
9 9
 class StringStream implements Stream
10 10
 {
11 11
     /**
12
-    * 设置偏移
13
-    *
14
-    * @var int
15
-    */
12
+     * 设置偏移
13
+     *
14
+     * @var int
15
+     */
16 16
     protected $offset = 0;
17 17
 
18 18
     /**
Please login to merge, or discard this patch.
suda/src/application/LanguageBag.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      *
12 12
      * @var array
13 13
      */
14
-    private $locales=[];
14
+    private $locales = [];
15 15
 
16 16
     /**
17 17
      * 包含本地化语言数组
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public static function format(string $string, array $param)
51 51
     {
52
-        return preg_replace_callback('/(?<!\$)\$(\{)?(\d+|\w+?\b)(?(1)\})/', function ($match) use ($param) {
52
+        return preg_replace_callback('/(?<!\$)\$(\{)?(\d+|\w+?\b)(?(1)\})/', function($match) use ($param) {
53 53
             $key = $match[2];
54 54
             if (array_key_exists($key, $param)) {
55 55
                 return strval($param[$key]);
Please login to merge, or discard this patch.
suda/src/framework/response/ContentWrapper.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
 class ContentWrapper
18 18
 {
19 19
     protected $types = [
20
-       [ JsonContentWrapper::class , ['array', JsonSerializable::class],],
21
-       [ HtmlContentWrapper::class , ['boolean', 'integer','double', 'string'],],
22
-       [ NullContentWrapper::class , ['NULL'],],
23
-       [ FileContentWrapper::class , [SplFileObject::class],],
20
+        [ JsonContentWrapper::class , ['array', JsonSerializable::class],],
21
+        [ HtmlContentWrapper::class , ['boolean', 'integer','double', 'string'],],
22
+        [ NullContentWrapper::class , ['NULL'],],
23
+        [ FileContentWrapper::class , [SplFileObject::class],],
24 24
     ];
25 25
 
26 26
     /**
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class ContentWrapper
18 18
 {
19 19
     protected $types = [
20
-       [ JsonContentWrapper::class , ['array', JsonSerializable::class],],
21
-       [ HtmlContentWrapper::class , ['boolean', 'integer','double', 'string'],],
22
-       [ NullContentWrapper::class , ['NULL'],],
23
-       [ FileContentWrapper::class , [SplFileObject::class],],
20
+       [JsonContentWrapper::class, ['array', JsonSerializable::class], ],
21
+       [HtmlContentWrapper::class, ['boolean', 'integer', 'double', 'string'], ],
22
+       [NullContentWrapper::class, ['NULL'], ],
23
+       [FileContentWrapper::class, [SplFileObject::class], ],
24 24
     ];
25 25
 
26 26
     /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public static function isTypeOf($data, string $type) : bool
46 46
     {
47 47
         if (is_object($data)
48
-            && !in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string','array','NULL'])) {
48
+            && !in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string', 'array', 'NULL'])) {
49 49
             try {
50 50
                 $class = new ReflectionClass($data);
51 51
                 $typeRef = new ReflectionClass($type);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      * @param $content
101 101
      * @return ContentWrapperInterface|null
102 102
      */
103
-    private function matchWrapper($content):?ContentWrapperInterface
103
+    private function matchWrapper($content): ?ContentWrapperInterface
104 104
     {
105 105
         foreach ($this->types as $typeConfig) {
106 106
             list($wrapper, $types) = $typeConfig;
Please login to merge, or discard this patch.
suda/src/framework/http/HTTPResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@
 block discarded – undo
230 230
     protected function closeOutputBuffer(bool $flush)
231 231
     {
232 232
         while (ob_get_level() > 0) {
233
-            $flush?ob_end_flush():ob_end_clean();
233
+            $flush ?ob_end_flush() : ob_end_clean();
234 234
         }
235 235
     }
236 236
 
Please login to merge, or discard this patch.
suda/src/application/database/DataAccess.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
      * @return DataAccess
60 60
      * @throws ReflectionException
61 61
      */
62
-    public static function new(string $object, ?Middleware $middleware = null):DataAccess
62
+    public static function new(string $object, ?Middleware $middleware = null) : DataAccess
63 63
     {
64 64
         return new self($object, $middleware);
65 65
     }
Please login to merge, or discard this patch.
suda/src/application/ApplicationBase.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @param string $name
78 78
      * @return Module|null
79 79
      */
80
-    public function find(string $name):?Module
80
+    public function find(string $name): ?Module
81 81
     {
82 82
         return $this->module->get($name);
83 83
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 $this->modulePaths[] = Resource::getPathByRelativePath($path, $this->path);
112 112
             }
113 113
         } else {
114
-            $this->modulePaths = [ Resource::getPathByRelativePath('modules', $this->path) ];
114
+            $this->modulePaths = [Resource::getPathByRelativePath('modules', $this->path)];
115 115
         }
116 116
     }
117 117
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     protected function className(string $name)
136 136
     {
137
-        return str_replace(['.','/'], '\\', $name);
137
+        return str_replace(['.', '/'], '\\', $name);
138 138
     }
139 139
 
140 140
     /**
Please login to merge, or discard this patch.
suda/src/framework/Config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @param array|Config $extra
112 112
      * @return array|null
113 113
      */
114
-    public static function loadConfig(string $path, $extra = []):?array
114
+    public static function loadConfig(string $path, $extra = []): ?array
115 115
     {
116 116
         if (!file_exists($path)) {
117 117
             $path = PathResolver::resolve($path);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         }
122 122
         if ($path) {
123 123
             $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
124
-            if (in_array($ext, ['yaml','yml','json','php','ini'])) {
124
+            if (in_array($ext, ['yaml', 'yml', 'json', 'php', 'ini'])) {
125 125
                 return ContentLoader::{'load'.ucfirst($ext)}($path, $extra);
126 126
             }
127 127
             return ContentLoader::loadJson($path, $extra);
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
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function __construct(array $methods, string $uri, array $attribute = [])
45 45
     {
46
-        array_walk($methods, function ($value) {
46
+        array_walk($methods, function($value) {
47 47
             return strtoupper($value);
48 48
         });
49 49
         $this->methods = $methods;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      * @param Request $request
160 160
      * @return array|null
161 161
      */
162
-    public function match(Request $request):?array
162
+    public function match(Request $request): ?array
163 163
     {
164 164
         if (count($this->methods) > 0 && !in_array($request->getMethod(), $this->methods)) {
165 165
             return null;
Please login to merge, or discard this patch.
suda/src/framework/route/uri/UriMatcher.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
      * @param boolean $ignoreCase
47 47
      * @return array|null
48 48
      */
49
-    public function match(string $url, bool $ignoreCase = true):?array
49
+    public function match(string $url, bool $ignoreCase = true): ?array
50 50
     {
51
-        $match = '#^'. $this->match.'$#'. ($ignoreCase?'i':'');
51
+        $match = '#^'.$this->match.'$#'.($ignoreCase ? 'i' : '');
52 52
         $parameter = [];
53 53
         if (preg_match($match, $url, $parameter, PREG_UNMATCHED_AS_NULL) > 0) {
54 54
             return array_slice($parameter, 1);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         return $parameters;
80 80
     }
81 81
 
82
-    public function getParameter(string $name):?Parameter
82
+    public function getParameter(string $name): ?Parameter
83 83
     {
84 84
         foreach ($this->parameter as $parameter) {
85 85
             if ($parameter->getIndexName() === $name) {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @param integer $index
130 130
      * @return Parameter|null
131 131
      */
132
-    public function getParameterByIndex(int $index):?Parameter
132
+    public function getParameterByIndex(int $index): ?Parameter
133 133
     {
134 134
         foreach ($this->parameter as $parameter) {
135 135
             if ($parameter->getIndex() === $index) {
Please login to merge, or discard this patch.