Passed
Push — master ( f9133e...d6c989 )
by 世昌
02:02
created
suda/src/framework/response/ContentWrapper.php 1 patch
Spacing   +5 added lines, -5 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
     /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public static function isTypeOf($data, string $type) : bool
46 46
     {
47
-        if (is_object($data) && !\in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string','array','NULL'])) {
47
+        if (is_object($data) && !\in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string', 'array', 'NULL'])) {
48 48
             $class = new ReflectionClass($data);
49 49
             $typeRef = new ReflectionClass($type);
50 50
             if ($typeRef->isInterface()) {
Please login to merge, or discard this patch.
suda/src/application/Application.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
         $this->debug->info('===============================');
38 38
         $this->debug->time('loading application');
39 39
         $appLoader->load();
40
-        $this->event->exec('application:load-config', [ $this->config ,$this]);
40
+        $this->event->exec('application:load-config', [$this->config, $this]);
41 41
         $this->debug->timeEnd('loading application');
42 42
         $this->debug->time('loading datasource');
43 43
         $appLoader->loadDataSource();
44 44
         Table::load($this);
45 45
         DataAccess::load($this);
46
-        $this->event->exec('application:load-environment', [ $this->config ,$this]);
46
+        $this->event->exec('application:load-environment', [$this->config, $this]);
47 47
         $this->debug->timeEnd('loading datasource');
48 48
         $this->debug->time('loading route');
49 49
         $appLoader->loadRoute();
50
-        $this->event->exec('application:load-route', [$this->route , $this]);
50
+        $this->event->exec('application:load-route', [$this->route, $this]);
51 51
         $this->debug->timeEnd('loading route');
52 52
         $this->debug->info('-------------------------------');
53 53
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             if (!$response->isSended()) {
100 100
                 $response->end();
101 101
             }
102
-            $this->debug->info('resposned with code '. $response->getStatus());
102
+            $this->debug->info('resposned with code '.$response->getStatus());
103 103
             $this->debug->timeEnd('sending response');
104 104
         } catch (\Throwable $e) {
105 105
             $this->debug->uncaughtException($e);
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     protected function createResponse(?MatchResult $result, Request $request, Response $response)
158 158
     {
159 159
         if (SUDA_DEBUG) {
160
-            $response->setHeader('x-route', $result === null?'default':$result->getName());
160
+            $response->setHeader('x-route', $result === null ? 'default' : $result->getName());
161 161
         }
162 162
         if ($result === null) {
163 163
             $content = $this->defaultResponse($this, $request, $response);
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
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
      * @param \suda\orm\middleware\Middleware|null $middleware
57 57
      * @return DataAccess
58 58
      */
59
-    public static function new(string $object, ?Middleware $middleware = null):DataAccess
59
+    public static function new(string $object, ?Middleware $middleware = null) : DataAccess
60 60
     {
61 61
         return new self($object, $middleware);
62 62
     }
Please login to merge, or discard this patch.
suda/src/orm/middleware/CommonMiddleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@
 block discarded – undo
178 178
      */
179 179
     private function inputSerialize($data)
180 180
     {
181
-        return $data === null? $data : \serialize($data);
181
+        return $data === null ? $data : \serialize($data);
182 182
     }
183 183
 
184 184
     /**
Please login to merge, or discard this patch.
suda/src/orm/struct/TableStructBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
139 139
             if (is_string($doc) && preg_match('/@field\s+(\w+)(?:\((.+?)\))?\s+(.+)?$/im', $doc, $match)) {
140 140
                 $type = strtoupper($match[1]);
141 141
                 $length = static::parseLength($match[2] ?? '');
142
-                return [$type, $length , trim($match[3] ?? '')];
142
+                return [$type, $length, trim($match[3] ?? '')];
143 143
             }
144 144
         }
145 145
         return ['text', null, ''];
Please login to merge, or discard this patch.
suda/src/orm/middleware/ObjectMiddleware.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     public function input(string $name, $data)
52 52
     {
53 53
         if (array_key_exists($name, $this->processor)) {
54
-            if ($this->processor[$name] === ObjectMiddleware::SERIALIZE){
55
-                return $data === null? $data : \serialize($data);
54
+            if ($this->processor[$name] === ObjectMiddleware::SERIALIZE) {
55
+                return $data === null ? $data : \serialize($data);
56 56
             }
57
-            if ($this->processor[$name] === ObjectMiddleware::JSON){
57
+            if ($this->processor[$name] === ObjectMiddleware::JSON) {
58 58
                 return \json_encode($data);
59 59
             }
60 60
         }
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
     public function output(string $name, $data)
72 72
     {
73 73
         if (array_key_exists($name, $this->processor)) {
74
-            if ($this->processor[$name] === ObjectMiddleware::SERIALIZE){
74
+            if ($this->processor[$name] === ObjectMiddleware::SERIALIZE) {
75 75
                 return \unserialize($data) ?: null;
76 76
             }
77
-            if ($this->processor[$name] === ObjectMiddleware::JSON){
77
+            if ($this->processor[$name] === ObjectMiddleware::JSON) {
78 78
                 return \json_decode($data);
79 79
             }
80 80
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         if ($doc = $property->getDocComment()) {
108 108
             if (is_string($doc) && preg_match('/@var\s+(\w+)/i', $doc, $match)) {
109 109
                 $type = \strtolower($match[1]);
110
-                if (\in_array($type, ['boolean', 'bool', 'integer', 'int' , 'float' , 'double', 'string'])) {
110
+                if (\in_array($type, ['boolean', 'bool', 'integer', 'int', 'float', 'double', 'string'])) {
111 111
                     return ObjectMiddleware::RAW;
112 112
                 }
113 113
             }
Please login to merge, or discard this patch.
suda/src/orm/struct/TableStructMiddleware.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
     protected function prepareProcessorSet(string $object)
61 61
     {
62 62
         $reflectObject = new ReflectionClass($object);
63
-        $classDoc = is_string($reflectObject->getDocComment())?$reflectObject->getDocComment():'';
63
+        $classDoc = is_string($reflectObject->getDocComment()) ? $reflectObject->getDocComment() : '';
64 64
         $field = TableClassStructBuilder::readClassDocField($classDoc);
65 65
         if ($field !== null) {
66 66
             $this->createProccorFromStruct();
Please login to merge, or discard this patch.
suda/src/orm/DataAccess.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@
 block discarded – undo
251 251
     protected function createDefaultMiddleware(string $object, TableStruct $struct)
252 252
     {
253 253
         $reflectObject = new ReflectionClass($object);
254
-        $classDoc = is_string($reflectObject->getDocComment())?$reflectObject->getDocComment():'';
254
+        $classDoc = is_string($reflectObject->getDocComment()) ? $reflectObject->getDocComment() : '';
255 255
         if (\preg_match('/@field-(serialize|json)\s+(\w+)/i', $classDoc, $matchs)) {
256 256
             return new TableStructMiddleware($object, $struct);
257 257
         }
Please login to merge, or discard this patch.
suda/src/orm/struct/TableClassStructBuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $this->object = $object;
40 40
         $this->reflectObject = new ReflectionClass($object);
41
-        $this->classDoc = is_string($this->reflectObject->getDocComment())?$this->reflectObject->getDocComment():'';
41
+        $this->classDoc = is_string($this->reflectObject->getDocComment()) ? $this->reflectObject->getDocComment() : '';
42 42
     }
43 43
 
44 44
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param string $classDoc
62 62
      * @return array|null
63 63
      */
64
-    public static function readClassDocField(string $classDoc):?array
64
+    public static function readClassDocField(string $classDoc): ?array
65 65
     {
66 66
         if (preg_match_all('/@field\s+(\w+)\s+(\w+)(?:\((.+?)\))?\s+(.+)?$/im', $classDoc, $match)) {
67 67
             return $match;
Please login to merge, or discard this patch.