@@ -20,7 +20,7 @@ |
||
20 | 20 | $this->name = $name; |
21 | 21 | $this->value = $value; |
22 | 22 | $this->key = $key; |
23 | - static::$index ++; |
|
23 | + static::$index++; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function index(string $name):string |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | public function charset(string $charset) |
48 | 48 | { |
49 | - $this->charset = 'CHARACTER SET ' . $charset; |
|
49 | + $this->charset = 'CHARACTER SET '.$charset; |
|
50 | 50 | return $this; |
51 | 51 | } |
52 | 52 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace suda\framework\loader; |
3 | 3 | |
4 | -require_once __DIR__ .'/Path.php'; |
|
5 | -require_once __DIR__ .'/PathTrait.php'; |
|
6 | -require_once __DIR__ .'/PathInterface.php'; |
|
7 | -require_once __DIR__ .'/IncludeManager.php'; |
|
4 | +require_once __DIR__.'/Path.php'; |
|
5 | +require_once __DIR__.'/PathTrait.php'; |
|
6 | +require_once __DIR__.'/PathInterface.php'; |
|
7 | +require_once __DIR__.'/IncludeManager.php'; |
|
8 | 8 | |
9 | 9 | use suda\framework\loader\IncludeManager; |
10 | 10 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param string $className |
47 | 47 | * @return string|null |
48 | 48 | */ |
49 | - public function getClassPath(string $className):?string |
|
49 | + public function getClassPath(string $className): ?string |
|
50 | 50 | { |
51 | 51 | // 搜索路径 |
52 | 52 | foreach ($this->includePath as $includeNamespace => $includePaths) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param string $filename |
64 | 64 | * @return string|null |
65 | 65 | */ |
66 | - public function import(string $filename):?string |
|
66 | + public function import(string $filename): ?string |
|
67 | 67 | { |
68 | 68 | if ($filename = static::realPath($filename)) { |
69 | 69 | @require_once $filename; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param string $className |
106 | 106 | * @return string|null |
107 | 107 | */ |
108 | - protected function getClassPathByAlias(string $includePath, string $className):?string |
|
108 | + protected function getClassPathByAlias(string $includePath, string $className): ?string |
|
109 | 109 | { |
110 | 110 | $namepath = static::formatSeparator($className); |
111 | 111 | $className = static::realName($className); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param string $className |
131 | 131 | * @return string|null |
132 | 132 | */ |
133 | - protected function getClassPathByName(string $includeNamespace, string $includePath, string $className):?string |
|
133 | + protected function getClassPathByName(string $includeNamespace, string $includePath, string $className): ?string |
|
134 | 134 | { |
135 | 135 | if (is_numeric($includeNamespace)) { |
136 | 136 | $path = $includePath.DIRECTORY_SEPARATOR.static::formatSeparator($className).'.php'; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @var array |
18 | 18 | */ |
19 | - protected $namespace = [ __NAMESPACE__ ]; |
|
19 | + protected $namespace = [__NAMESPACE__]; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * 包含路径 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function realName(string $name):string |
35 | 35 | { |
36 | - return str_replace(['.','/'], '\\', $name); |
|
36 | + return str_replace(['.', '/'], '\\', $name); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param string $name |
43 | 43 | * @return string|null |
44 | 44 | */ |
45 | - public static function realPath(string $name):?string |
|
45 | + public static function realPath(string $name): ?string |
|
46 | 46 | { |
47 | 47 | return Path::format($name); |
48 | 48 | } |
@@ -113,7 +113,7 @@ |
||
113 | 113 | * @param string|null $name |
114 | 114 | * @return Connection |
115 | 115 | */ |
116 | - public static function new(string $type, array $config, ?string $name = null): Connection |
|
116 | + public static function new(string $type, array $config, ?string $name = null) : Connection |
|
117 | 117 | { |
118 | 118 | if (array_key_exists($type, static::$type)) { |
119 | 119 | return new static::$type[$type]($config, $name); |
@@ -70,7 +70,7 @@ |
||
70 | 70 | } |
71 | 71 | $zip = new ZipArchive; |
72 | 72 | if ($zip->open($path, ZipArchive::CHECKCONS)) { |
73 | - $unzipPath = $unpackPath.'/'. pathinfo($path, PATHINFO_FILENAME) .'-'.substr(md5_file($path), 0, 8); |
|
73 | + $unzipPath = $unpackPath.'/'.pathinfo($path, PATHINFO_FILENAME).'-'.substr(md5_file($path), 0, 8); |
|
74 | 74 | $zip->extractTo($unzipPath); |
75 | 75 | $zip->close(); |
76 | 76 | return PathResolver::resolve($unzipPath.'/module'); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | <div class="footer"> |
26 | 26 | <?php if (defined('SUDA_START_TIME') && defined('SUDA_START_MEMORY')): ?> |
27 | 27 | <?php |
28 | - $mem = memory_get_usage() - SUDA_START_MEMORY ; |
|
28 | + $mem = memory_get_usage() - SUDA_START_MEMORY ; |
|
29 | 29 | $human = array('B', 'KB', 'MB', 'GB', 'TB'); |
30 | 30 | $pos = 0; |
31 | 31 | while ($mem >= 1024) { |
@@ -25,14 +25,14 @@ |
||
25 | 25 | <div class="footer"> |
26 | 26 | <?php if (defined('SUDA_START_TIME') && defined('SUDA_START_MEMORY')): ?> |
27 | 27 | <?php |
28 | - $mem = memory_get_usage() - SUDA_START_MEMORY ; |
|
28 | + $mem = memory_get_usage() - SUDA_START_MEMORY; |
|
29 | 29 | $human = array('B', 'KB', 'MB', 'GB', 'TB'); |
30 | 30 | $pos = 0; |
31 | 31 | while ($mem >= 1024) { |
32 | 32 | $mem /= 1024; |
33 | 33 | $pos++; |
34 | 34 | } |
35 | - $memory_usage = round($mem, 5) .' '. $human[$pos]; ?> |
|
35 | + $memory_usage = round($mem, 5).' '.$human[$pos]; ?> |
|
36 | 36 | |
37 | 37 | <div class="footer-item">Memory Cost: <?php echo $memory_usage; ?></div> |
38 | 38 | <div class="footer-item">Time Cost: <?php echo number_format(microtime(true) - SUDA_START_TIME, 5); ?>s</div> |
@@ -28,9 +28,9 @@ |
||
28 | 28 | */ |
29 | 29 | public function register() |
30 | 30 | { |
31 | - register_shutdown_function([$this,'uncaughtFatalError']); |
|
32 | - set_error_handler([$this,'uncaughtError']); |
|
33 | - set_exception_handler([$this,'uncaughtException']); |
|
31 | + register_shutdown_function([$this, 'uncaughtFatalError']); |
|
32 | + set_error_handler([$this, 'uncaughtError']); |
|
33 | + set_exception_handler([$this, 'uncaughtException']); |
|
34 | 34 | return $this; |
35 | 35 | } |
36 | 36 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | try { |
31 | 31 | $pdo = new PDO($this->getDsn()); |
32 | 32 | $this->id = static::$_id; |
33 | - static::$_id ++; |
|
33 | + static::$_id++; |
|
34 | 34 | return $pdo; |
35 | 35 | } catch (PDOException $e) { |
36 | 36 | throw new SQLException($this->__toString().' connect database error:'.$e->getMessage(), $e->getCode(), E_ERROR, __FILE__, __LINE__, $e); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function switchDatabase(string $database) |
41 | 41 | { |
42 | - return $this->query(new Statement('USE `' . $database.'`')); |
|
42 | + return $this->query(new Statement('USE `'.$database.'`')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function rawTableName(string $name) |