@@ -34,7 +34,7 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function one(?string $class = null, array $args = []) |
| 36 | 36 | { |
| 37 | - return $this->access->run($this->limit(0,1)->wantOne($class, $args)); |
|
| 37 | + return $this->access->run($this->limit(0, 1)->wantOne($class, $args)); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | protected function analyse(string $message, array $context) |
| 24 | 24 | { |
| 25 | 25 | $replace = []; |
| 26 | - $attach = [] ; |
|
| 26 | + $attach = []; |
|
| 27 | 27 | foreach ($context as $key => $val) { |
| 28 | - $replaceKey = '{' . $key . '}'; |
|
| 28 | + $replaceKey = '{'.$key.'}'; |
|
| 29 | 29 | if ($this->isReplacedObj($val) && strpos($message, $replaceKey) !== false) { |
| 30 | - $replace['{' . $key . '}'] = $val; |
|
| 30 | + $replace['{'.$key.'}'] = $val; |
|
| 31 | 31 | } else { |
| 32 | 32 | $attach[$key] = $val; |
| 33 | 33 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | protected function isReplacedObj($val) : bool |
| 39 | 39 | { |
| 40 | - return !is_array($val) && (!is_object($val) || method_exists($val, '__toString')) && (! $val instanceof Throwable); |
|
| 40 | + return !is_array($val) && (!is_object($val) || method_exists($val, '__toString')) && (!$val instanceof Throwable); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function interpolate(string $message, array $context, array $attribute) |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | list($attach, $replace) = $this->analyse($message, $context); |
| 46 | 46 | $attribute = array_merge($this->attribute, $attribute); |
| 47 | 47 | foreach ($attribute as $key => $val) { |
| 48 | - $replace['%' . $key . '%'] = $val; |
|
| 48 | + $replace['%'.$key.'%'] = $val; |
|
| 49 | 49 | } |
| 50 | 50 | $message = strtr($message, $replace); |
| 51 | 51 | $attachInfo = ''; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $replace = []; |
| 69 | 69 | foreach ($context as $key => $val) { |
| 70 | 70 | if ($this->canBeStringValue($val)) { |
| 71 | - $replace['{' . $key . '}'] = $val; |
|
| 71 | + $replace['{'.$key.'}'] = $val; |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | return strtr($message, $replace); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); |
| 98 | 98 | $pos = min($pow, count($human) - 1); |
| 99 | 99 | $bytes /= (1 << (10 * $pos)); |
| 100 | - return round($bytes, $precision) . ' ' . $human[$pos]; |
|
| 100 | + return round($bytes, $precision).' '.$human[$pos]; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | public function time(string $name, string $type = LogLevel::INFO) |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class JsonException extends RuntimeException |
| 11 | 11 | { |
| 12 | - public static $error=[ |
|
| 12 | + public static $error = [ |
|
| 13 | 13 | JSON_ERROR_NONE=>'no errors', |
| 14 | 14 | JSON_ERROR_DEPTH=>'maximum stack depth exceeded', |
| 15 | 15 | JSON_ERROR_STATE_MISMATCH=>'underflow or the modes mismatch', |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | |
| 60 | 60 | protected static function parseValue(string $content, array $extra = []): string |
| 61 | 61 | { |
| 62 | - return preg_replace_callback('/\$\{(.+?)\}/', function ($matchs) use ($extra) { |
|
| 62 | + return preg_replace_callback('/\$\{(.+?)\}/', function($matchs) use ($extra) { |
|
| 63 | 63 | $name = $matchs[1]; |
| 64 | 64 | if (($value = ArrayDotAccess::get($extra, $name, null)) !== null) { |
| 65 | 65 | } elseif (defined($name)) { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | public static function formatSeparator(string $path, string $separator = DIRECTORY_SEPARATOR):string |
| 16 | 16 | { |
| 17 | - return str_replace(['\\','/'], $separator, $path); |
|
| 17 | + return str_replace(['\\', '/'], $separator, $path); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | if (static::getHomePath() !== null && strpos($path, '~') === 0) { |
| 86 | 86 | $scheme = ''; |
| 87 | - $subpath = static::getHomePath() .DIRECTORY_SEPARATOR.substr($path, 1); |
|
| 87 | + $subpath = static::getHomePath().DIRECTORY_SEPARATOR.substr($path, 1); |
|
| 88 | 88 | } elseif (strpos($path, '://') !== false) { |
| 89 | 89 | list($scheme, $subpath) = explode('://', $path, 2); |
| 90 | 90 | $scheme .= '://'; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * @return string|null |
| 101 | 101 | */ |
| 102 | - public static function getHomePath():?string |
|
| 102 | + public static function getHomePath(): ?string |
|
| 103 | 103 | { |
| 104 | 104 | if (defined('USER_HOME_PATH')) { |
| 105 | 105 | return constant('USER_HOME_PATH'); |
@@ -45,10 +45,10 @@ |
||
| 45 | 45 | |
| 46 | 46 | foreach ($info as $name => $logs) { |
| 47 | 47 | if (count($logs)) { |
| 48 | - $textOutput .= '- '. $name. PHP_EOL; |
|
| 48 | + $textOutput .= '- '.$name.PHP_EOL; |
|
| 49 | 49 | $logs = array_unique($logs); |
| 50 | 50 | foreach ($logs as $log) { |
| 51 | - $textOutput .= ' - '. $log. PHP_EOL; |
|
| 51 | + $textOutput .= ' - '.$log.PHP_EOL; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | try { |
| 104 | 104 | $reflectClass = new ReflectionClass($statement->getFetchClass()); |
| 105 | 105 | } catch (ReflectionException $e) { |
| 106 | - throw new FetchResultException('error create class: '. $e->getMessage(), $e->getCode(), $e); |
|
| 106 | + throw new FetchResultException('error create class: '.$e->getMessage(), $e->getCode(), $e); |
|
| 107 | 107 | } |
| 108 | 108 | $object = $reflectClass->newInstanceArgs($statement->getFetchClassArgs()); |
| 109 | 109 | if (method_exists($object, '__set')) { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | try { |
| 134 | 134 | $property = $reflectClass->getProperty($propertyName); |
| 135 | 135 | } catch (ReflectionException $e) { |
| 136 | - throw new FetchResultException('error create property: '. $e->getMessage(), $e->getCode(), $e); |
|
| 136 | + throw new FetchResultException('error create property: '.$e->getMessage(), $e->getCode(), $e); |
|
| 137 | 137 | } |
| 138 | 138 | $property->setAccessible(true); |
| 139 | 139 | $property->setValue($object, $value); |