@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | foreach ($this->application->getModules() as $name => $module) { |
| 50 | 50 | if ($module->getStatus() === Module::REACHABLE) { |
| 51 | 51 | $this->loadModuleRoute($module); |
| 52 | - $this->application->debug()->debug('reachable # ' . $module->getFullName()); |
|
| 52 | + $this->application->debug()->debug('reachable # '.$module->getFullName()); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | protected function loadRouteGroup(Module $module, string $groupName) |
| 85 | 85 | { |
| 86 | - $group = $groupName === 'default' ? '' : '-' . $groupName; |
|
| 87 | - if ($path = $module->getResource()->getConfigResourcePath('config/route' . $group)) { |
|
| 86 | + $group = $groupName === 'default' ? '' : '-'.$groupName; |
|
| 87 | + if ($path = $module->getResource()->getConfigResourcePath('config/route'.$group)) { |
|
| 88 | 88 | $routeConfig = Config::loadConfig($path, [ |
| 89 | 89 | 'module' => $module->getName(), |
| 90 | 90 | 'group' => $groupName, |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | 'config' => $module->getConfig(), |
| 93 | 93 | ]); |
| 94 | 94 | if ($routeConfig !== null) { |
| 95 | - $prefix = $module->getConfig('route-prefix.' . $groupName, ''); |
|
| 95 | + $prefix = $module->getConfig('route-prefix.'.$groupName, ''); |
|
| 96 | 96 | $this->loadRouteConfig($module, $prefix, $groupName, $routeConfig); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | $uri = $config['uri'] ?? '/'; |
| 122 | 122 | $anti = array_key_exists('anti-prefix', $config) && $config['anti-prefix']; |
| 123 | 123 | if ($anti) { |
| 124 | - $uri = '/' . trim($uri, '/'); |
|
| 124 | + $uri = '/'.trim($uri, '/'); |
|
| 125 | 125 | } else { |
| 126 | - $uri = '/' . trim($prefix . $uri, '/'); |
|
| 126 | + $uri = '/'.trim($prefix.$uri, '/'); |
|
| 127 | 127 | } |
| 128 | 128 | $this->application->request($method, $exname, $uri, $attributes); |
| 129 | 129 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $this->loadVendorIfExist(); |
| 24 | 24 | $this->loadShareLibrary(); |
| 25 | - $this->application->debug()->debug('loaded - ' . $this->module->getFullName()); |
|
| 25 | + $this->application->debug()->debug('loaded - '.$this->module->getFullName()); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | public function toActive() |
| 34 | 34 | { |
| 35 | 35 | $this->loadConfig(); |
| 36 | - $this->application->debug()->debug('active = ' . $this->module->getFullName()); |
|
| 36 | + $this->application->debug()->debug('active = '.$this->module->getFullName()); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $this->checkRequirements(); |
| 45 | 45 | $this->loadPrivateLibrary(); |
| 46 | 46 | $this->application->setRunning($this->module); |
| 47 | - $this->application->debug()->debug('run + ' . $this->module->getFullName()); |
|
| 47 | + $this->application->debug()->debug('run + '.$this->module->getFullName()); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function loadVendorIfExist() |
| 93 | 93 | { |
| 94 | - $vendorAutoload = $this->module->getPath() . '/vendor/autoload.php'; |
|
| 94 | + $vendorAutoload = $this->module->getPath().'/vendor/autoload.php'; |
|
| 95 | 95 | if (FileSystem::exist($vendorAutoload)) { |
| 96 | 96 | Loader::requireOnce($vendorAutoload); |
| 97 | 97 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $name = $input->getArgument('name'); |
| 34 | 34 | |
| 35 | 35 | if (is_string($name)) { |
| 36 | - $text = 'Hello ' . $name; |
|
| 36 | + $text = 'Hello '.$name; |
|
| 37 | 37 | } else { |
| 38 | 38 | $text = 'Hello'; |
| 39 | 39 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | abstract class TableCreator |
| 13 | 13 | { |
| 14 | 14 | protected static $map = [ |
| 15 | - 'mysql' => MySQLTableCreator::class, |
|
| 15 | + 'mysql' => MySQLTableCreator::class, |
|
| 16 | 16 | ]; |
| 17 | 17 | |
| 18 | 18 | abstract function create(Connection $connection, TableStruct $fields); |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | $table = $this->fields->getRealTableName($this->connection); |
| 99 | 99 | $sql = "CREATE TABLE IF NOT EXISTS `{$table}` (\r\n\t"; |
| 100 | 100 | $sql .= implode(",\r\n\t", array_filter($content, 'strlen')); |
| 101 | - $auto = null === $this->auto?'':'AUTO_INCREMENT='.$this->auto; |
|
| 102 | - $collate = null === $this->collate?'':'COLLATE '.$this->collate; |
|
| 101 | + $auto = null === $this->auto ? '' : 'AUTO_INCREMENT='.$this->auto; |
|
| 102 | + $collate = null === $this->collate ? '' : 'COLLATE '.$this->collate; |
|
| 103 | 103 | $sql .= "\r\n) ENGINE={$this->engine} {$collate} {$auto} DEFAULT CHARSET={$this->charset};"; |
| 104 | 104 | return $sql; |
| 105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | if (count($primary)) { |
| 120 | - return 'PRIMARY KEY ('. implode(',', $primary).')'; |
|
| 120 | + return 'PRIMARY KEY ('.implode(',', $primary).')'; |
|
| 121 | 121 | } |
| 122 | 122 | return ''; |
| 123 | 123 | } |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | protected function createField(Field $field) |
| 211 | 211 | { |
| 212 | 212 | $type = strtoupper($field->getValueType()).$this->parseLength($field->getLength()); |
| 213 | - $auto = $field->getAuto() ?'AUTO_INCREMENT':''; |
|
| 214 | - $null = $field->isNullable() === null? '': $field->isNullable() === true ? 'NULL':'NOT NULL'; |
|
| 215 | - $attr = $field->getAttribute() ?strtoupper($field->getAttribute()):''; |
|
| 216 | - $comment = $field->getComment() ?('COMMENT \''.addcslashes($field->getComment(), '\'').'\''):''; |
|
| 213 | + $auto = $field->getAuto() ? 'AUTO_INCREMENT' : ''; |
|
| 214 | + $null = $field->isNullable() === null ? '' : $field->isNullable() === true ? 'NULL' : 'NOT NULL'; |
|
| 215 | + $attr = $field->getAttribute() ?strtoupper($field->getAttribute()) : ''; |
|
| 216 | + $comment = $field->getComment() ? ('COMMENT \''.addcslashes($field->getComment(), '\'').'\'') : ''; |
|
| 217 | 217 | // default设置 |
| 218 | 218 | if ($field->hasDefault()) { |
| 219 | 219 | if (null === $field->getDefault()) { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | protected function whereStringArray(string $where, array $whereBinder) |
| 198 | 198 | { |
| 199 | 199 | [$where, $whereBinder] = $this->prepareWhereString($where, $whereBinder); |
| 200 | - $this->where = 'WHERE ' . $where; |
|
| 200 | + $this->where = 'WHERE '.$where; |
|
| 201 | 201 | $this->binder = $this->mergeBinder($this->binder, $whereBinder); |
| 202 | 202 | } |
| 203 | 203 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | public function groupBy(string $what) |
| 211 | 211 | { |
| 212 | 212 | $what = $this->middleware->inputName($what); |
| 213 | - $this->groupBy = 'GROUP BY `' . $what . '`'; |
|
| 213 | + $this->groupBy = 'GROUP BY `'.$what.'`'; |
|
| 214 | 214 | return $this; |
| 215 | 215 | } |
| 216 | 216 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | protected function havingStringArray(string $having, array $havingBinder) |
| 254 | 254 | { |
| 255 | 255 | [$having, $havingBinder] = $this->prepareWhereString($having, $havingBinder); |
| 256 | - $this->having = 'HAVING ' . $having; |
|
| 256 | + $this->having = 'HAVING '.$having; |
|
| 257 | 257 | $this->binder = $this->mergeBinder($this->binder, $havingBinder); |
| 258 | 258 | } |
| 259 | 259 | |
@@ -269,9 +269,9 @@ discard block |
||
| 269 | 269 | $what = $this->middleware->inputName($what); |
| 270 | 270 | $order = strtoupper($order); |
| 271 | 271 | if (strlen($this->orderBy) > 0) { |
| 272 | - $this->orderBy .= ',`' . $what . '` ' . $order; |
|
| 272 | + $this->orderBy .= ',`'.$what.'` '.$order; |
|
| 273 | 273 | } else { |
| 274 | - $this->orderBy = 'ORDER BY `' . $what . '` ' . $order; |
|
| 274 | + $this->orderBy = 'ORDER BY `'.$what.'` '.$order; |
|
| 275 | 275 | } |
| 276 | 276 | return $this; |
| 277 | 277 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public function limit(int $start, int $length = null) |
| 295 | 295 | { |
| 296 | - $this->limit = 'LIMIT ' . $start . ($length !== null ? ',' . $length : ''); |
|
| 296 | + $this->limit = 'LIMIT '.$start.($length !== null ? ','.$length : ''); |
|
| 297 | 297 | return $this; |
| 298 | 298 | } |
| 299 | 299 | |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | if (array_key_exists($groupName, static::$dataSource)) { |
| 82 | 82 | return static::$dataSource[$groupName]; |
| 83 | 83 | } |
| 84 | - $group = $groupName === 'default' ? '': '-'. $groupName; |
|
| 84 | + $group = $groupName === 'default' ? '' : '-'.$groupName; |
|
| 85 | 85 | $dataSourceConfigPath = $resource->getConfigResourcePath('config/data-source'.$group); |
| 86 | 86 | $dataSource = new DataSource; |
| 87 | 87 | if ($dataSourceConfigPath !== null) { |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | * @param string $path 目标路径 |
| 17 | 17 | * @return string|null 返回格式化结果,如果路径不存在则返回NULL |
| 18 | 18 | */ |
| 19 | - public static function format(string $path):?string |
|
| 19 | + public static function format(string $path): ?string |
|
| 20 | 20 | { |
| 21 | 21 | if (strlen(trim($path)) === 0) { |
| 22 | 22 | return null; |
| 23 | 23 | } |
| 24 | - return static::existCharset($path, ['GBK','GB2312','BIG5']); |
|
| 24 | + return static::existCharset($path, ['GBK', 'GB2312', 'BIG5']); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param array $charset |
| 30 | 30 | * @return string|null |
| 31 | 31 | */ |
| 32 | - public static function existCharset(string $path, array $charset):?string |
|
| 32 | + public static function existCharset(string $path, array $charset): ?string |
|
| 33 | 33 | { |
| 34 | 34 | $abspath = static::toAbsolutePath($path); |
| 35 | 35 | if (static::existCase($abspath)) { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | } catch (Exception $e) { |
| 169 | - echo '<div style="color:red">' . $e->getMessage() . '</div>'; |
|
| 169 | + echo '<div style="color:red">'.$e->getMessage().'</div>'; |
|
| 170 | 170 | return; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -188,9 +188,9 @@ discard block |
||
| 188 | 188 | return ob_get_clean() ?: ''; |
| 189 | 189 | } |
| 190 | 190 | throw new NoTemplateFoundException( |
| 191 | - 'missing dest at ' . $path , |
|
| 191 | + 'missing dest at '.$path, |
|
| 192 | 192 | E_USER_ERROR, |
| 193 | - $path , |
|
| 193 | + $path, |
|
| 194 | 194 | 1 |
| 195 | 195 | ); |
| 196 | 196 | } |