Passed
Push — sudav3 ( ac6dc6...d2f44f )
by 世昌
02:12
created
suda/src/framework/debug/log/logger/FileLogger.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             throw new FileLoggerException(__CLASS__.':'.sprintf('cannot create log file'));
71 71
         }
72 72
         $this->latest = $this->getConfig('save-path').'/'.$this->getConfig('file-name');
73
-        \register_shutdown_function([$this,'save']);
73
+        \register_shutdown_function([$this, 'save']);
74 74
     }
75 75
 
76 76
     public function getDefaultConfig():array
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
     protected function packLogFile()
90 90
     {
91 91
         $logFile = $this->latest;
92
-        $path = preg_replace('/[\\\\]+/', '/', $this->getConfig('save-zip-path') .'/'.date('Y-m-d').'.zip');
92
+        $path = preg_replace('/[\\\\]+/', '/', $this->getConfig('save-zip-path').'/'.date('Y-m-d').'.zip');
93 93
         $zip = $this->getZipArchive($path);
94 94
         if ($zip !== null) {
95
-            if ($zip->addFile($logFile, date('Y-m-d'). '-'. $zip->numFiles .'.log')) {
95
+            if ($zip->addFile($logFile, date('Y-m-d').'-'.$zip->numFiles.'.log')) {
96 96
                 array_push($this->removeFiles, $logFile);
97 97
             }
98 98
             if (\is_dir($this->getConfig('save-pack-path'))) {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             $zip->close();
107 107
         } else {
108 108
             if (is_file($logFile) && file_exists($logFile)) {
109
-                rename($logFile, $this->getConfig('save-path') . '/' . date('Y-m-d'). '-'. substr(md5_file($logFile), 0, 8).'.log');
109
+                rename($logFile, $this->getConfig('save-path').'/'.date('Y-m-d').'-'.substr(md5_file($logFile), 0, 8).'.log');
110 110
             }
111 111
         }
112 112
     }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
             } elseif (null === $val) {
205 205
                 $val = 'null';
206 206
             }
207
-            $replace['{' . $key . '}'] = $val;
207
+            $replace['{'.$key.'}'] = $val;
208 208
         }
209 209
         return strtr($message, $replace);
210 210
     }
Please login to merge, or discard this patch.
suda/src/framework/debug/attach/DumpInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  */
7 7
 interface DumpInterface 
8 8
 {
9
-    public static function parameterToString($object, int $deep=2);
9
+    public static function parameterToString($object, int $deep = 2);
10 10
     public static function dumpThrowable(\Throwable $e);
11
-    public static function dumpTrace(array $backtrace, bool $str=true, string $perfix='');
11
+    public static function dumpTrace(array $backtrace, bool $str = true, string $perfix = '');
12 12
 }
Please login to merge, or discard this patch.
suda/src/framework/debug/attach/AttachTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
     protected function analyse(array $context)
22 22
     {
23 23
         $replace = [];
24
-        $attach = [] ;
24
+        $attach = [];
25 25
         foreach ($context as $key => $val) {
26 26
             if ($this->isReplacedObj($val)) {
27
-                $replace['{' . $key . '}'] = $val;
27
+                $replace['{'.$key.'}'] = $val;
28 28
             } else {
29 29
                 $attach[$key] = $val;
30 30
             }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
     protected function isReplacedObj($val) : bool
36 36
     {
37
-        return !is_array($val) && (!is_object($val) || method_exists($val, '__toString')) && ! $val instanceof \Throwable;
37
+        return !is_array($val) && (!is_object($val) || method_exists($val, '__toString')) && !$val instanceof \Throwable;
38 38
     }
39 39
 
40 40
     public function interpolate(string $message, array $context, array $attribute)
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         list($attach, $replace) = $this->analyse($context);
43 43
         $attribute = array_merge($this->attribute, $attribute);
44 44
         foreach ($attribute as $key => $val) {
45
-            $replace['%' . $key . '%'] = $val;
45
+            $replace['%'.$key.'%'] = $val;
46 46
         }
47 47
         $message = strtr($message, $replace);
48 48
         $attachInfo = '';
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
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
      * @param boolean $ignoreCase
48 48
      * @return array|null
49 49
      */
50
-    public function match(string $url, bool $ignoreCase = true):?array
50
+    public function match(string $url, bool $ignoreCase = true): ?array
51 51
     {
52
-        $match = '#^'. $this->match.'$#'. ($ignoreCase?'i':'');
52
+        $match = '#^'.$this->match.'$#'.($ignoreCase ? 'i' : '');
53 53
         $parameter = [];
54 54
         if (preg_match($match, $url, $parameter, PREG_UNMATCHED_AS_NULL) > 0) {
55 55
             return array_slice($parameter, 1);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         return $parameters;
79 79
     }
80 80
 
81
-    public function getParameter(string $name):?Parameter
81
+    public function getParameter(string $name): ?Parameter
82 82
     {
83 83
         foreach ($this->parameter as $parameter) {
84 84
             if ($parameter->getIndexName() === $name) {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param integer $index
129 129
      * @return \suda\framework\route\uri\parameter\Parameter|null
130 130
      */
131
-    public function getParameterByIndex(int $index):?Parameter
131
+    public function getParameterByIndex(int $index): ?Parameter
132 132
     {
133 133
         foreach ($this->parameter as $parameter) {
134 134
             if ($parameter->getIndex() === $index) {
Please login to merge, or discard this patch.
suda/src/application/template/ModuleTemplateCompiler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@
 block discarded – undo
20 20
     protected $tag = [
21 21
         'raw' => ['{{!', '}}', '<?php echo $code; ?>'],
22 22
         'comment' => ['{--', '--}', '<?php /* $code */ ?>'],
23
-        'echo' => [ '{{', '}}', '<?php echo htmlspecialchars($this->application->_($code), ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>' ],
23
+        'echo' => ['{{', '}}', '<?php echo htmlspecialchars($this->application->_($code), ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>'],
24 24
         'string' => ['{=', '}', '<?php echo htmlspecialchars($this->application->_("$code"), ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>'],
25
-        'raw-string' => ['@{', '}', '<?php echo htmlspecialchars($code, ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>' ],
26
-        'event' => ['{:', '}', '<?php $this->application->event()->exec("$code", [$this]); ?>' ],
25
+        'raw-string' => ['@{', '}', '<?php echo htmlspecialchars($code, ENT_SUBSTITUTE | ENT_QUOTES | ENT_HTML5); ?>'],
26
+        'event' => ['{:', '}', '<?php $this->application->event()->exec("$code", [$this]); ?>'],
27 27
     ];
28 28
 
29 29
     public function __construct()
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/Config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @param array|\suda\framework\Config $extra
113 113
      * @return array|null
114 114
      */
115
-    public static function loadConfig(string $path, $extra = []):?array
115
+    public static function loadConfig(string $path, $extra = []): ?array
116 116
     {
117 117
         if (!file_exists($path)) {
118 118
             $path = PathResolver::resolve($path);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         }
123 123
         if ($path) {
124 124
             $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
125
-            if (in_array($ext, ['yaml','yml','json','php','ini'])) {
125
+            if (in_array($ext, ['yaml', 'yml', 'json', 'php', 'ini'])) {
126 126
                 return ContentLoader::{'load'.ucfirst($ext)}($path, $extra);
127 127
             }
128 128
             return ContentLoader::loadJson($path, $extra);
Please login to merge, or discard this patch.
suda/src/application/template/compiler/Command.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
     
121 121
     protected function parseStatic($content)
122 122
     {
123
-        $content = strlen(trim($content)) === 0 ?'()':$content;
123
+        $content = strlen(trim($content)) === 0 ? '()' : $content;
124 124
         return '<?php echo $this->getStaticPrefix'.$content.'; ?>';
125 125
     }
126 126
 
Please login to merge, or discard this patch.
suda/src/orm/connection/creator/MySQLTableCreator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
         $table = $this->connection->rawTableName($this->name);
71 71
         $sql = "CREATE TABLE IF NOT EXISTS `{$table}` (\r\n\t";
72 72
         $sql .= implode(",\r\n\t", array_filter($content, 'strlen'));
73
-        $auto = null === $this->auto?'':'AUTO_INCREMENT='.$this->auto;
74
-        $collate = null === $this->collate?'':'COLLATE '.$this->collate;
73
+        $auto = null === $this->auto ? '' : 'AUTO_INCREMENT='.$this->auto;
74
+        $collate = null === $this->collate ? '' : 'COLLATE '.$this->collate;
75 75
         $sql .= "\r\n) ENGINE={$this->engine} {$collate} {$auto} DEFAULT CHARSET={$this->charset};";
76 76
         return $sql;
77 77
     }
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 
136 136
     protected function createField(Field $field)
137 137
     {
138
-        $type = $field->getLength()? strtoupper($field->getValueType()).'('.$field->getLength().')':strtoupper($field->getValueType());
139
-        $auto = $field->getAuto() ?'AUTO_INCREMENT':'';
140
-        $null = $field->isNullable() ?'NULL':'NOT NULL';
141
-        $attr = $field->getAttribute() ?strtoupper($field->getAttribute()):'';
142
-        $comment = $field->getComment() ?('COMMENT \''.addcslashes($field->getComment(), '\'').'\''):'';
138
+        $type = $field->getLength() ? strtoupper($field->getValueType()).'('.$field->getLength().')' : strtoupper($field->getValueType());
139
+        $auto = $field->getAuto() ? 'AUTO_INCREMENT' : '';
140
+        $null = $field->isNullable() ? 'NULL' : 'NOT NULL';
141
+        $attr = $field->getAttribute() ?strtoupper($field->getAttribute()) : '';
142
+        $comment = $field->getComment() ? ('COMMENT \''.addcslashes($field->getComment(), '\'').'\'') : '';
143 143
         // default设置
144 144
         if ($field->hasDefault()) {
145 145
             if (null === $field->getDefault()) {
Please login to merge, or discard this patch.