@@ -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 | } |
@@ -12,20 +12,20 @@ discard block |
||
| 12 | 12 | use suda\framework\debug\log\logger\FileLogger; |
| 13 | 13 | use suda\application\builder\ApplicationBuilder; |
| 14 | 14 | |
| 15 | -defined('SUDA_APP') or define('SUDA_APP', __DIR__ . '/app'); |
|
| 16 | -defined('SUDA_DATA') or define('SUDA_DATA', __DIR__ . '/data'); |
|
| 17 | -defined('SUDA_PUBLIC') or define('SUDA_PUBLIC', __DIR__ . '/public'); |
|
| 15 | +defined('SUDA_APP') or define('SUDA_APP', __DIR__.'/app'); |
|
| 16 | +defined('SUDA_DATA') or define('SUDA_DATA', __DIR__.'/data'); |
|
| 17 | +defined('SUDA_PUBLIC') or define('SUDA_PUBLIC', __DIR__.'/public'); |
|
| 18 | 18 | defined('SUDA_DEBUG') or define('SUDA_DEBUG', true); |
| 19 | 19 | defined('SUDA_DEBUG_LEVEL') or define('SUDA_DEBUG_LEVEL', 'debug'); |
| 20 | -defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP . '/manifest'); |
|
| 21 | -defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', SUDA_DATA . '/logs'); |
|
| 20 | +defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP.'/manifest'); |
|
| 21 | +defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', SUDA_DATA.'/logs'); |
|
| 22 | 22 | |
| 23 | -require_once __DIR__ . '/loader.php'; |
|
| 23 | +require_once __DIR__.'/loader.php'; |
|
| 24 | 24 | |
| 25 | 25 | // 初始化系统加载器 |
| 26 | 26 | $loader = new Loader; |
| 27 | 27 | $loader->register(); |
| 28 | -$loader->addIncludePath(SUDA_SYSTEM . '/src', 'suda'); |
|
| 28 | +$loader->addIncludePath(SUDA_SYSTEM.'/src', 'suda'); |
|
| 29 | 29 | // 初始化数据目录 |
| 30 | 30 | $application = ApplicationBuilder::build($loader, SUDA_APP, SUDA_APP_MANIFEST, SUDA_DATA); |
| 31 | 31 | |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | [ |
| 35 | 35 | 'log-level' => SUDA_DEBUG_LEVEL, |
| 36 | 36 | 'save-path' => SUDA_DEBUG_LOG_PATH, |
| 37 | - 'save-dump-path' => SUDA_DEBUG_LOG_PATH . '/dump', |
|
| 38 | - 'save-zip-path' => SUDA_DEBUG_LOG_PATH . '/zip', |
|
| 37 | + 'save-dump-path' => SUDA_DEBUG_LOG_PATH.'/dump', |
|
| 38 | + 'save-zip-path' => SUDA_DEBUG_LOG_PATH.'/zip', |
|
| 39 | 39 | 'log-format' => '%message%', |
| 40 | 40 | ] |
| 41 | 41 | ); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | /** @var Command $cmd */ |
| 63 | 63 | $className = Loader::realName($item['class']); |
| 64 | 64 | $cmd = new $className; |
| 65 | - $cmd->setName($module->getName() . ':' . $cmd->getName()); |
|
| 65 | + $cmd->setName($module->getName().':'.$cmd->getName()); |
|
| 66 | 66 | if (method_exists($cmd, 'putApplication')) { |
| 67 | 67 | call_user_func_array([$cmd, 'putApplication'], [$application]); |
| 68 | 68 | } |
@@ -2,14 +2,14 @@ |
||
| 2 | 2 | /** |
| 3 | 3 | * 控制台用 |
| 4 | 4 | */ |
| 5 | -defined('SUDA_APP') or define('SUDA_APP', __DIR__ . '/app'); |
|
| 6 | -defined('SUDA_DATA') or define('SUDA_DATA', __DIR__ . '/data'); |
|
| 7 | -defined('SUDA_PUBLIC') or define('SUDA_PUBLIC', __DIR__ . '/public'); |
|
| 5 | +defined('SUDA_APP') or define('SUDA_APP', __DIR__.'/app'); |
|
| 6 | +defined('SUDA_DATA') or define('SUDA_DATA', __DIR__.'/data'); |
|
| 7 | +defined('SUDA_PUBLIC') or define('SUDA_PUBLIC', __DIR__.'/public'); |
|
| 8 | 8 | |
| 9 | 9 | defined('SUDA_DEBUG') or define('SUDA_DEBUG', true); |
| 10 | 10 | defined('SUDA_DEBUG_LEVEL') or define('SUDA_DEBUG_LEVEL', 'debug'); |
| 11 | -defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP . '/manifest'); |
|
| 12 | -defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', SUDA_DATA . '/logs'); |
|
| 11 | +defined('SUDA_APP_MANIFEST') or define('SUDA_APP_MANIFEST', SUDA_APP.'/manifest'); |
|
| 12 | +defined('SUDA_DEBUG_LOG_PATH') or define('SUDA_DEBUG_LOG_PATH', SUDA_DATA.'/logs'); |
|
| 13 | 13 | |
| 14 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
| 15 | -require_once __DIR__ . '/suda/loader/console.php'; |
|
| 16 | 14 | \ No newline at end of file |
| 15 | +require_once __DIR__.'/vendor/autoload.php'; |
|
| 16 | +require_once __DIR__.'/suda/loader/console.php'; |
|
| 17 | 17 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public function prepareQueryMark(string $sql, array $parameter) |
| 22 | 22 | { |
| 23 | 23 | $binders = []; |
| 24 | - $query = preg_replace_callback('/\?/', function ($match) use (&$binders, $parameter) { |
|
| 24 | + $query = preg_replace_callback('/\?/', function($match) use (&$binders, $parameter) { |
|
| 25 | 25 | $index = count($binders); |
| 26 | 26 | if (array_key_exists($index, $parameter)) { |
| 27 | 27 | $name = Binder::index($index); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } else { |
| 33 | 33 | $binder = new Binder($name, $parameter[$index]); |
| 34 | 34 | $binders[] = $binder; |
| 35 | - return ':' . $binder->getName(); |
|
| 35 | + return ':'.$binder->getName(); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | return $match[0]; |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | public function prepareInParameter($values, string $name) |
| 51 | 51 | { |
| 52 | 52 | if ($this->countObject($values) <= 0) { |
| 53 | - throw new SQLException('on field ' . $name . ' value can\'t be empty array'); |
|
| 53 | + throw new SQLException('on field '.$name.' value can\'t be empty array'); |
|
| 54 | 54 | } |
| 55 | 55 | $names = []; |
| 56 | 56 | $binders = []; |
| 57 | 57 | foreach ($values as $value) { |
| 58 | 58 | $_name = Binder::index($name); |
| 59 | 59 | $binders[] = new Binder($_name, $value); |
| 60 | - $names[] = ':' . $_name; |
|
| 60 | + $names[] = ':'.$_name; |
|
| 61 | 61 | } |
| 62 | 62 | return [implode(',', $names), $binders]; |
| 63 | 63 | } |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | public function createQueryOperation(string $name, string $operator, $value, string $indexName = '') |
| 86 | 86 | { |
| 87 | 87 | if ($value instanceof Query) { |
| 88 | - return new Query("`{$name}` {$operator} " . $value, $value->getBinder()); |
|
| 88 | + return new Query("`{$name}` {$operator} ".$value, $value->getBinder()); |
|
| 89 | 89 | } |
| 90 | 90 | if ($value instanceof Statement) { |
| 91 | - return new Query("`{$name}` {$operator} (" . $value->getQuery() . ')', $value->getBinder()); |
|
| 91 | + return new Query("`{$name}` {$operator} (".$value->getQuery().')', $value->getBinder()); |
|
| 92 | 92 | } |
| 93 | 93 | if ($value instanceof IteratorAggregate || is_array($value)) { |
| 94 | 94 | return $this->prepareIn($name, $operator, $value); |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | if (is_array($value)) { |
| 180 | 180 | $newWhere[] = [$name, $value[0], $value[1]]; |
| 181 | 181 | } else { |
| 182 | - $op = $this->isArray($value)?'in':'='; |
|
| 182 | + $op = $this->isArray($value) ? 'in' : '='; |
|
| 183 | 183 | $newWhere[] = [$name, $op, $value]; |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | return $this->createQueryOperation($name, 'in', $values); |
| 239 | 239 | } |
| 240 | 240 | [$inSQL, $binders] = $this->prepareInParameter($values, $name); |
| 241 | - $sql = '`' . $name . '` ' . strtoupper($operation) . ' (' . $inSQL . ')'; |
|
| 241 | + $sql = '`'.$name.'` '.strtoupper($operation).' ('.$inSQL.')'; |
|
| 242 | 242 | return new Query($sql, $binders); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -253,6 +253,6 @@ discard block |
||
| 253 | 253 | public function replaceQuote(string $name, string $replace, string $target) |
| 254 | 254 | { |
| 255 | 255 | $name = ltrim($name, ':'); |
| 256 | - return preg_replace('/(?<!_):' . preg_quote($name) . '/', $replace, $target); |
|
| 256 | + return preg_replace('/(?<!_):'.preg_quote($name).'/', $replace, $target); |
|
| 257 | 257 | } |
| 258 | 258 | } |