@@ -24,7 +24,7 @@ |
||
| 24 | 24 | |
| 25 | 25 | $header = $this->requestHeader('seaslog-kafka', self::METADATA_REQUEST, self::METADATA_REQUEST); |
| 26 | 26 | $data = self::encodeArray($payloads, [$this, 'encodeString'], self::PACK_INT16); |
| 27 | - $data = self::encodeString($header . $data, self::PACK_INT32); |
|
| 27 | + $data = self::encodeString($header.$data, self::PACK_INT32); |
|
| 28 | 28 | |
| 29 | 29 | return $data; |
| 30 | 30 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function __construct(array $configs) |
| 65 | 65 | { |
| 66 | 66 | foreach ($configs as $name => $value) { |
| 67 | - $method = 'set' . ucfirst($name); |
|
| 67 | + $method = 'set'.ucfirst($name); |
|
| 68 | 68 | $this->$method($value); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $brokers = array_filter( |
| 154 | 154 | explode(',', $brokerList), |
| 155 | - function (string $broker): bool { |
|
| 155 | + function(string $broker): bool { |
|
| 156 | 156 | return preg_match('/^(.*:[\d]+)$/', $broker) === 1; |
| 157 | 157 | } |
| 158 | 158 | ); |
@@ -60,8 +60,8 @@ |
||
| 60 | 60 | $maxRetry = $this->config['retry']; |
| 61 | 61 | $reconnectCount = 0; |
| 62 | 62 | while (true) { |
| 63 | - $isConnect = $this->config['timeout'] ? $client->connect($host, (int)$port, |
|
| 64 | - $this->config['timeout']) : $client->connect($host, (int)$port); |
|
| 63 | + $isConnect = $this->config['timeout'] ? $client->connect($host, ( int ) $port, |
|
| 64 | + $this->config['timeout']) : $client->connect($host, ( int ) $port); |
|
| 65 | 65 | if (!$isConnect) { |
| 66 | 66 | $reconnectCount++; |
| 67 | 67 | if ($maxRetry > 0 && $reconnectCount >= $maxRetry) { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | public static function encode(int $key, array $payloads): string |
| 44 | 44 | { |
| 45 | 45 | if (!isset(self::$objects[$key])) { |
| 46 | - throw new NotSupportedException('Not support api key, key:' . $key); |
|
| 46 | + throw new NotSupportedException('Not support api key, key:'.$key); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return self::$objects[$key]->encode($payloads); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | public static function decode(int $key, string $data): array |
| 59 | 59 | { |
| 60 | 60 | if (!isset(self::$objects[$key])) { |
| 61 | - throw new NotSupportedException('Not support api key, key:' . $key); |
|
| 61 | + throw new NotSupportedException('Not support api key, key:'.$key); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | return self::$objects[$key]->decode($data); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $brokers = []; |
| 58 | 58 | |
| 59 | 59 | foreach ($brokersResult as $value) { |
| 60 | - $brokers[$value['nodeId']] = $value['host'] . ':' . $value['port']; |
|
| 60 | + $brokers[$value['nodeId']] = $value['host'].':'.$value['port']; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $changed = false; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $newTopics = []; |
| 72 | 72 | foreach ($topics as $topic) { |
| 73 | - if ((int)$topic['errorCode'] !== Protocol::NO_ERROR) { |
|
| 73 | + if (( int ) $topic['errorCode'] !== Protocol::NO_ERROR) { |
|
| 74 | 74 | continue; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | $milliseconds = 0; |
| 128 | 128 | } |
| 129 | 129 | if ($tmp === '%T') { |
| 130 | - $msg[] = date($this->datetime_format, (int)$timestamp) . '.' . (int)$milliseconds; |
|
| 130 | + $msg[] = date($this->datetime_format, ( int ) $timestamp).'.'.( int ) $milliseconds; |
|
| 131 | 131 | } else { |
| 132 | - $msg[] = date($this->datetime_format, (int)$timestamp); |
|
| 132 | + $msg[] = date($this->datetime_format, ( int ) $timestamp); |
|
| 133 | 133 | } |
| 134 | 134 | break; |
| 135 | 135 | case '%Q': |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | $this->recall_depth + 2); |
| 161 | 161 | if ($tmp === '%F') { |
| 162 | 162 | $trace = $trace[$this->recall_depth]; |
| 163 | - $msg[] = $this->useBasename ? basename($trace['file']) . ':' . $trace['line'] : $trace['file'] . ':' . $trace['line']; |
|
| 163 | + $msg[] = $this->useBasename ? basename($trace['file']).':'.$trace['line'] : $trace['file'].':'.$trace['line']; |
|
| 164 | 164 | } else { |
| 165 | 165 | $trace = $trace[$this->recall_depth + 1]; |
| 166 | - $msg[] = $trace['class'] . $trace['type'] . $trace['function']; |
|
| 166 | + $msg[] = $trace['class'].$trace['type'].$trace['function']; |
|
| 167 | 167 | } |
| 168 | 168 | break; |
| 169 | 169 | case '%U': |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | $color = ArrayHelper::getValue($template, '%c'); |
| 191 | 191 | $color && $msg['%c'] = $color; |
| 192 | - $key = $this->appName . ($module ? '_' . $module : ''); |
|
| 192 | + $key = $this->appName.($module ? '_'.$module : ''); |
|
| 193 | 193 | $this->buffer[$key][] = $msg; |
| 194 | 194 | $this->flush(); |
| 195 | 195 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | { |
| 203 | 203 | if (!empty($this->buffer) && $flush || ($this->bufferSize !== 0 && $this->bufferSize <= count($this->buffer))) { |
| 204 | 204 | foreach ($this->targetList as $index => $target) { |
| 205 | - rgo(function () use ($target, $flush) { |
|
| 205 | + rgo(function() use ($target, $flush) { |
|
| 206 | 206 | $target->export($this->buffer); |
| 207 | 207 | }); |
| 208 | 208 | } |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | */ |
| 158 | 158 | public static function getColor(string $color): string |
| 159 | 159 | { |
| 160 | - return (string)ArrayHelper::getValue(static::$colors, $color, ''); |
|
| 160 | + return ( string ) ArrayHelper::getValue(static::$colors, $color, ''); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | foreach ($this->targetList as $target) { |
| 55 | 55 | $target->setTemplate($this->template)->setCustomerFieldType($this->customerType)->setSplit($this->split); |
| 56 | 56 | } |
| 57 | - register_shutdown_function(function () { |
|
| 57 | + register_shutdown_function(function() { |
|
| 58 | 58 | $this->flush(true); |
| 59 | 59 | }); |
| 60 | 60 | $this->tick > 0 && Timer::tick($this->tick * 1000, [$this, 'flush'], [true]); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public static function analyzerCount($level = 'all', $log_path = '*', $key_word = null) |
| 219 | 219 | { |
| 220 | - return SeasLog::analyzerCount($level, $log_path, (string)$key_word); |
|
| 220 | + return SeasLog::analyzerCount($level, $log_path, ( string ) $key_word); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | return SeasLog::analyzerDetail( |
| 244 | 244 | $level, |
| 245 | 245 | $log_path, |
| 246 | - (string)$key_word, |
|
| 246 | + ( string ) $key_word, |
|
| 247 | 247 | $start, |
| 248 | 248 | $limit, |
| 249 | 249 | $order |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public function log($level, $message, array $context = array()) |
| 337 | 337 | { |
| 338 | - if ((int)$level < self::$RequestLevel) { |
|
| 338 | + if (( int ) $level < self::$RequestLevel) { |
|
| 339 | 339 | return; |
| 340 | 340 | } |
| 341 | 341 | |