@@ -6,7 +6,7 @@ |
||
6 | 6 | define('SUDA_DEBUG', true); |
7 | 7 | define('SUDA_DEBUG_LEVEL', 'info'); |
8 | 8 | |
9 | -require_once __DIR__ .'/../vendor/autoload.php'; |
|
9 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
10 | 10 | require_once SUDA_SYSTEM.'/loader/main.php'; |
11 | 11 | |
12 | 12 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $subfix = $this->config['subfix'] ?? '.tpl.html'; |
22 | 22 | $path = $this |
23 | 23 | ->getResource($this->module) |
24 | - ->getResourcePath($this->getTemplatePath() . '/' . $this->name . $subfix); |
|
24 | + ->getResourcePath($this->getTemplatePath().'/'.$this->name.$subfix); |
|
25 | 25 | $this->loadDynamicTemplateConfig($path.'.ini'); |
26 | 26 | return $path; |
27 | 27 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function getPath() |
48 | 48 | { |
49 | - $output = $this->config['output'] ?? $this->application->getDataPath() . '/template/' . $this->uriName; |
|
49 | + $output = $this->config['output'] ?? $this->application->getDataPath().'/template/'.$this->uriName; |
|
50 | 50 | FileSystem::make($output); |
51 | - return $output . '/' . $this->name . '.php'; |
|
51 | + return $output.'/'.$this->name.'.php'; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function getRenderedString() |
74 | 74 | { |
75 | - $this->application->debug()->time('render ' . $this->name); |
|
75 | + $this->application->debug()->time('render '.$this->name); |
|
76 | 76 | $code = parent::getRenderedString(); |
77 | - $time = $this->application->debug()->timeEnd('render ' . $this->name); |
|
77 | + $time = $this->application->debug()->timeEnd('render '.$this->name); |
|
78 | 78 | $this->application->debug()->recordTiming('render', $time); |
79 | 79 | return $code; |
80 | 80 | } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | protected function compile() |
87 | 87 | { |
88 | 88 | if ($this->isCompiled() === false) { |
89 | - $this->application->debug()->time('compile ' . $this->name); |
|
89 | + $this->application->debug()->time('compile '.$this->name); |
|
90 | 90 | $result = parent::compile(); |
91 | - $this->application->debug()->timeEnd('compile ' . $this->name); |
|
91 | + $this->application->debug()->timeEnd('compile '.$this->name); |
|
92 | 92 | return $result; |
93 | 93 | } |
94 | 94 | return true; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | return $this->application->getUrl($this->request, $name, $values ?? [], true, $this->module, $this->group); |
114 | 114 | } elseif (is_string($defaultName)) { |
115 | - $parameter = is_array($name)?array_merge($query, $name):$query; |
|
115 | + $parameter = is_array($name) ?array_merge($query, $name) : $query; |
|
116 | 116 | return $this->application->getUrl( |
117 | 117 | $this->request, |
118 | 118 | $defaultName, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $this->group |
123 | 123 | ); |
124 | 124 | } |
125 | - return '#' . $defaultName; |
|
125 | + return '#'.$defaultName; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | $replace = []; |
71 | 71 | $attach = []; |
72 | 72 | foreach ($context as $key => $val) { |
73 | - $replaceKey = '{' . $key . '}'; |
|
73 | + $replaceKey = '{'.$key.'}'; |
|
74 | 74 | if ($this->canBeStringValue($val) && strpos($message, $replaceKey) !== false) { |
75 | - $replace['{' . $key . '}'] = $val; |
|
75 | + $replace['{'.$key.'}'] = $val; |
|
76 | 76 | } else { |
77 | 77 | $attach[$key] = $val; |
78 | 78 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); |
139 | 139 | $pos = min($pow, count($human) - 1); |
140 | 140 | $bytes /= (1 << (10 * $pos)); |
141 | - return round($bytes, $precision) . ' ' . $human[$pos]; |
|
141 | + return round($bytes, $precision).' '.$human[$pos]; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | /** |
@@ -47,7 +47,7 @@ |
||
47 | 47 | { |
48 | 48 | $this->count++; |
49 | 49 | $query = $connection->prefix($statement->getString()); |
50 | - $this->debug->recordTiming('query', $timeSpend, $this->count . ' queries'); |
|
50 | + $this->debug->recordTiming('query', $timeSpend, $this->count.' queries'); |
|
51 | 51 | $status = $result ? 'OK' : 'Err'; |
52 | 52 | if ($result) { |
53 | 53 | $effect = $statement->getStatement()->rowCount(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . '/loader.php'; |
|
2 | +require_once __DIR__.'/loader.php'; |
|
3 | 3 | |
4 | 4 | use suda\framework\debug\log\logger\NullLogger; |
5 | 5 | use Swoole\Http\Server; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | // 初始化系统加载器 |
19 | 19 | $loader = new Loader; |
20 | 20 | $loader->register(); |
21 | -$loader->addIncludePath(SUDA_SYSTEM . '/src', 'suda'); |
|
21 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
22 | 22 | // 创建应用 |
23 | 23 | $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_APP_MANIFEST, SUDA_DATA); |
24 | 24 | // 不复制资源 |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | 'log_file' => $logger->getConfig('save-dump-path').'/swoole.log', |
43 | 43 | ]); |
44 | 44 | |
45 | -$application->config()->set('save-dump-path', SUDA_DEBUG_LOG_PATH . '/dump'); |
|
45 | +$application->config()->set('save-dump-path', SUDA_DEBUG_LOG_PATH.'/dump'); |
|
46 | 46 | $application->config()->set('response-timing', SUDA_DEBUG); |
47 | 47 | |
48 | 48 | $application->setDebug(new Debugger($application, new NullLogger())); |
49 | 49 | |
50 | -$http->on('request', function ($request, $response) use ($application, $logger) { |
|
50 | +$http->on('request', function($request, $response) use ($application, $logger) { |
|
51 | 51 | // 拷贝副本 |
52 | 52 | $runApplication = clone $application; |
53 | 53 | $runLogger = clone $logger; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @var array |
13 | 13 | */ |
14 | - private $locales=[]; |
|
14 | + private $locales = []; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * 包含本地化语言数组 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function format(string $text, array $param) |
52 | 52 | { |
53 | - return preg_replace_callback('/(?<!\$)\$(\{)?(\d+|\w+?\b)(?(1)\})/', function ($match) use ($param) { |
|
53 | + return preg_replace_callback('/(?<!\$)\$(\{)?(\d+|\w+?\b)(?(1)\})/', function($match) use ($param) { |
|
54 | 54 | $key = $match[2]; |
55 | 55 | if (array_key_exists($key, $param)) { |
56 | 56 | return strval($param[$key]); |
@@ -43,7 +43,7 @@ discard block |
||
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; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param string $uri |
161 | 161 | * @return array|null |
162 | 162 | */ |
163 | - public function match(string $method, string $uri):?array |
|
163 | + public function match(string $method, string $uri): ?array |
|
164 | 164 | { |
165 | 165 | if (count($this->methods) > 0 && !in_array($method, $this->methods)) { |
166 | 166 | return null; |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | ); |
72 | 72 | $exported = []; |
73 | 73 | foreach ($props as $value) { |
74 | - $name = dechex($value->getModifiers()) . '$' . $value->getName(); |
|
74 | + $name = dechex($value->getModifiers()).'$'.$value->getName(); |
|
75 | 75 | $value->setAccessible(true); |
76 | 76 | $exported[$name] = new DebugObject($value->getValue($object), $this->context); |
77 | 77 | } |
78 | 78 | return $exported; |
79 | 79 | } catch (ReflectionException $e) { |
80 | - return 'Err:' . $e->getMessage(); |
|
80 | + return 'Err:'.$e->getMessage(); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function jsonSerialize() |
87 | 87 | { |
88 | 88 | if (is_object($this->value)) { |
89 | - if ($this->value instanceof self){ |
|
89 | + if ($this->value instanceof self) { |
|
90 | 90 | return [ |
91 | 91 | '_type' => self::class, |
92 | 92 | '_properties' => $this->value, |
@@ -120,7 +120,7 @@ |
||
120 | 120 | * @return Iterator |
121 | 121 | */ |
122 | 122 | protected function getCallbackIterator(string $name, bool $reverse = false): Iterator { |
123 | - return $reverse?new ArrayIterator(array_reverse($this->queue[$name])):new ArrayIterator($this->queue[$name]); |
|
123 | + return $reverse ? new ArrayIterator(array_reverse($this->queue[$name])) : new ArrayIterator($this->queue[$name]); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |