@@ -15,13 +15,13 @@ |
||
15 | 15 | |
16 | 16 | protected function parseStatic($content) |
17 | 17 | { |
18 | - $content = strlen(trim($content)) === 0 ?'()':$content; |
|
18 | + $content = strlen(trim($content)) === 0 ? '()' : $content; |
|
19 | 19 | return '<?php echo $this->getStaticModulePrefix'.$content.'; ?>'; |
20 | 20 | } |
21 | 21 | |
22 | 22 | protected function parseFile($content) |
23 | 23 | { |
24 | - $content = strlen(trim($content)) === 0 ?'()':$content; |
|
24 | + $content = strlen(trim($content)) === 0 ? '()' : $content; |
|
25 | 25 | return '<?php echo $this->getModulePrefix'.$content.'; ?>'; |
26 | 26 | } |
27 | 27 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | protected function getModuleStaticOutpath(?string $module) |
97 | 97 | { |
98 | 98 | $config = $this->getModuleConfig($module); |
99 | - $path = $config['assets-path'].'/'. $this->getModuleUriName($module) .'/'.$config['static']; |
|
99 | + $path = $config['assets-path'].'/'.$this->getModuleUriName($module).'/'.$config['static']; |
|
100 | 100 | FileSystem::make($path); |
101 | 101 | return $path; |
102 | 102 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | $this->prepareStaticModuleSource($module); |
126 | 126 | $config = TemplateUtil::getConfig($this->application, $module); |
127 | - return $this->getModuleStaticAssetRoot($module) .'/'.$this->getModuleUriName($module). '/'.$config['static']; |
|
127 | + return $this->getModuleStaticAssetRoot($module).'/'.$this->getModuleUriName($module).'/'.$config['static']; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | protected function getModulePrefix(?string $module = null) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | if ($module === null) { |
133 | 133 | $module = $this->module; |
134 | 134 | } |
135 | - return $this->getModuleAssetRoot($module) .'/'.$this->getModuleUriName($module); |
|
135 | + return $this->getModuleAssetRoot($module).'/'.$this->getModuleUriName($module); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | protected function getModuleAssetRoot(?string $module) |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | protected static function fixConfig(Application $application, ?string $module, array $config) |
43 | 43 | { |
44 | 44 | if (!\array_key_exists('assets-prefix', $config)) { |
45 | - $config['assets-prefix'] = defined('SUDA_ASSETS') ? \constant('SUDA_ASSETS'): 'assets'; |
|
45 | + $config['assets-prefix'] = defined('SUDA_ASSETS') ? \constant('SUDA_ASSETS') : 'assets'; |
|
46 | 46 | } |
47 | 47 | if (!\array_key_exists('static', $config)) { |
48 | 48 | $config['static'] = 'static'; |
49 | 49 | } |
50 | 50 | if (!\array_key_exists('assets-path', $config)) { |
51 | - $config['assets-path'] = SUDA_PUBLIC. '/'.$config['assets-prefix']; |
|
51 | + $config['assets-path'] = SUDA_PUBLIC.'/'.$config['assets-prefix']; |
|
52 | 52 | } |
53 | 53 | if (!array_key_exists('static-name', $config)) { |
54 | 54 | $config['uri-name'] = static::getSafeUriName($application, $module); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $assetRoot = static::getAssetRoot($application, $module); |
112 | 112 | if (in_array($request->getIndex(), $application->conf('index', ['/index.php']))) { |
113 | - $name = static::writableAssets($application, $module) ? dirname($request->getIndex()):$request->getIndex(); |
|
113 | + $name = static::writableAssets($application, $module) ? dirname($request->getIndex()) : $request->getIndex(); |
|
114 | 114 | return rtrim(str_replace('\\', '/', $name), '/').$assetRoot; |
115 | 115 | } |
116 | 116 | return rtrim(str_replace('\\', '/', $request->getIndex()), '/').$assetRoot; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public static function getStaticRequestAsset(Application $application, Request $request, ?string $module = null):string |
144 | 144 | { |
145 | 145 | $assetRoot = static::getAssetRoot($application, $module); |
146 | - $name = static::writableAssets($application, $module) ? dirname($request->getIndex()):$request->getIndex(); |
|
146 | + $name = static::writableAssets($application, $module) ? dirname($request->getIndex()) : $request->getIndex(); |
|
147 | 147 | return rtrim(str_replace('\\', '/', $name), '/').$assetRoot; |
148 | 148 | } |
149 | 149 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param string $path |
71 | 71 | * @return \suda\application\Module|null |
72 | 72 | */ |
73 | - public function guess(string $path):?Module |
|
73 | + public function guess(string $path): ?Module |
|
74 | 74 | { |
75 | 75 | foreach ($this->module as $module) { |
76 | 76 | if (FileSystem::isOverflowPath($module->getPath(), $path) === false) { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @throws ApplicationException |
103 | 103 | * @return Module|null |
104 | 104 | */ |
105 | - public function get(string $name):?Module |
|
105 | + public function get(string $name): ?Module |
|
106 | 106 | { |
107 | 107 | $full = $this->getFullName($name); |
108 | 108 | return $this->module[$full]; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if (\array_key_exists($version, $this->knownsFullName[$name])) { |
187 | 187 | return $this->knownsFullName[$name][$version]; |
188 | 188 | } |
189 | - return $hasVersion?$name.':'.$version:end($this->knownsFullName[$name]); |
|
189 | + return $hasVersion ? $name.':'.$version : end($this->knownsFullName[$name]); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | protected function getLikeName(string $name):string |
@@ -263,7 +263,7 @@ |
||
263 | 263 | |
264 | 264 | if ($this->expire !== 0) { |
265 | 265 | $time = $this->fulltime ? $this->expire : time() + $this->expire; |
266 | - $dateTime = \DateTime::createFromFormat('U', $time , new \DateTimeZone('GMT')); |
|
266 | + $dateTime = \DateTime::createFromFormat('U', $time, new \DateTimeZone('GMT')); |
|
267 | 267 | $cookie .= '; expires='.str_replace('+0000', '', $dateTime->format('D, d M Y H:i:s T')); |
268 | 268 | } |
269 | 269 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $this->config = $config; |
57 | 57 | $this->name = $name ?? 'anonymous'; |
58 | 58 | $this->observer = new NullObserver; |
59 | - \register_shutdown_function(function () { |
|
59 | + \register_shutdown_function(function() { |
|
60 | 60 | $this->onBeforeSystemShutdown(); |
61 | 61 | }); |
62 | 62 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | try { |
78 | 78 | $this->pdo = $this->createPDO(); |
79 | 79 | $this->id = static::$_id; |
80 | - static::$_id ++; |
|
80 | + static::$_id++; |
|
81 | 81 | } catch (PDOException $e) { |
82 | 82 | throw new SQLException($this->getName().'connect database error:'.$e->getMessage(), $e->getCode(), E_ERROR, __FILE__, __LINE__, $e); |
83 | 83 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function beginTransaction() |
143 | 143 | { |
144 | - $this->transaction ++; |
|
144 | + $this->transaction++; |
|
145 | 145 | if ($this->transaction == 1) { |
146 | 146 | $this->pdo->beginTransaction(); |
147 | 147 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | protected function onBeforeSystemShutdown() |
194 | 194 | { |
195 | 195 | if ($this->pdo && ($this->transaction > 0 || $this->pdo->inTransaction())) { |
196 | - throw new SQLException('SQL transaction is open (' . $this->transaction.') in connection '.$this->__toString(), SQLException::ERR_TRANSACTION); |
|
196 | + throw new SQLException('SQL transaction is open ('.$this->transaction.') in connection '.$this->__toString(), SQLException::ERR_TRANSACTION); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public function __construct(DataSource $datasource) |
12 | 12 | { |
13 | 13 | parent::__construct('hello'); |
14 | - (new MySQLTableCreator($this->getSource()->write(),$this->getStruct()->getFields()))->create(); |
|
14 | + (new MySQLTableCreator($this->getSource()->write(), $this->getStruct()->getFields()))->create(); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function onCreateStruct(TableStruct $struct):TableStruct |
@@ -26,9 +26,9 @@ |
||
26 | 26 | $status = $result ? 'OK' : 'Err'; |
27 | 27 | if ($result) { |
28 | 28 | $effect = $statement->getStatement()->rowCount(); |
29 | - $this->debug->info('query ['.$status.'] '.$query.' '. number_format($timeSpend, 5).'s and effect '. $effect . ' rows'); |
|
29 | + $this->debug->info('query ['.$status.'] '.$query.' '.number_format($timeSpend, 5).'s and effect '.$effect.' rows'); |
|
30 | 30 | } else { |
31 | - $this->debug->error('query ['.$status.'] '.$query.' '. number_format($timeSpend, 5).'s'); |
|
31 | + $this->debug->error('query ['.$status.'] '.$query.' '.number_format($timeSpend, 5).'s'); |
|
32 | 32 | $this->debug->error('query ['.$status.'] '.\implode(':', $statement->getStatement()->errorInfo())); |
33 | 33 | } |
34 | 34 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param string $name |
83 | 83 | * @return \suda\application\Module|null |
84 | 84 | */ |
85 | - public function find(string $name):?Module |
|
85 | + public function find(string $name): ?Module |
|
86 | 86 | { |
87 | 87 | return $this->module->get($name); |
88 | 88 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $this->modulePaths[] = Resource::getPathByRelativedPath($path, $this->path); |
117 | 117 | } |
118 | 118 | } else { |
119 | - $this->modulePaths = [ Resource::getPathByRelativedPath('modules', $this->path) ]; |
|
119 | + $this->modulePaths = [Resource::getPathByRelativedPath('modules', $this->path)]; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function className(string $name) |
141 | 141 | { |
142 | - return str_replace(['.','/'], '\\', $name); |
|
142 | + return str_replace(['.', '/'], '\\', $name); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |