@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) |
| 50 | 50 | { |
| 51 | 51 | $this->dsn = $dsn; |
| 52 | - $this->lifetime = (int) $lifetime; |
|
| 52 | + $this->lifetime = (int)$lifetime; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | 113 | $result = $this->getMongo()->updateOne(array('_id' => $profile->getToken()), array( |
| 114 | - '$set' => array_filter($record, function ($v) { |
|
| 114 | + '$set' => array_filter($record, function($v) { |
|
| 115 | 115 | return !empty($v); |
| 116 | 116 | }), |
| 117 | 117 | ), array('upsert' => true)); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | list($server, $database, $collection) = $parsedDsn; |
| 138 | 138 | |
| 139 | - $client = new \MongoDB\Client('mongodb://'.$server.'/'.$database); |
|
| 139 | + $client = new \MongoDB\Client('mongodb://' . $server . '/' . $database); |
|
| 140 | 140 | |
| 141 | 141 | return $this->mongo = $client->selectCollection($database, $collection); |
| 142 | 142 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) |
| 39 | 39 | { |
| 40 | 40 | $this->dsn = $dsn; |
| 41 | - $this->lifetime = (int) $lifetime; |
|
| 41 | + $this->lifetime = (int)$lifetime; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = $values; |
| 70 | 70 | $statusCode = isset($values[6]) ? $values[6] : null; |
| 71 | 71 | |
| 72 | - $itemTime = (int) $itemTime; |
|
| 72 | + $itemTime = (int)$itemTime; |
|
| 73 | 73 | |
| 74 | 74 | if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) { |
| 75 | 75 | continue; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | --$limit; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - usort($result, function ($a, $b) { |
|
| 98 | + usort($result, function($a, $b) { |
|
| 99 | 99 | if ($a['time'] === $b['time']) { |
| 100 | 100 | return 0; |
| 101 | 101 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $data = array( |
| 162 | 162 | 'token' => $profile->getToken(), |
| 163 | 163 | 'parent' => $profile->getParentToken(), |
| 164 | - 'children' => array_map(function ($p) { |
|
| 164 | + 'children' => array_map(function($p) { |
|
| 165 | 165 | return $p->getToken(); |
| 166 | 166 | }, $profile->getChildren()), |
| 167 | 167 | 'data' => $profile->getCollectors(), |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $profile->getTime(), |
| 187 | 187 | $profile->getParentToken(), |
| 188 | 188 | $profile->getStatusCode(), |
| 189 | - ))."\n"; |
|
| 189 | + )) . "\n"; |
|
| 190 | 190 | |
| 191 | 191 | return $this->appendValue($indexName, $indexRow, $this->lifetime); |
| 192 | 192 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | private function getItemName($token) |
| 280 | 280 | { |
| 281 | - $name = self::TOKEN_PREFIX.$token; |
|
| 281 | + $name = self::TOKEN_PREFIX . $token; |
|
| 282 | 282 | |
| 283 | 283 | if ($this->isItemNameValid($name)) { |
| 284 | 284 | return $name; |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | private function getIndexName() |
| 296 | 296 | { |
| 297 | - $name = self::TOKEN_PREFIX.'index'; |
|
| 297 | + $name = self::TOKEN_PREFIX . 'index'; |
|
| 298 | 298 | |
| 299 | 299 | if ($this->isItemNameValid($name)) { |
| 300 | 300 | return $name; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) |
| 50 | 50 | { |
| 51 | 51 | $this->dsn = $dsn; |
| 52 | - $this->lifetime = (int) $lifetime; |
|
| 52 | + $this->lifetime = (int)$lifetime; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = $values; |
| 80 | 80 | $statusCode = isset($values[6]) ? $values[6] : null; |
| 81 | 81 | |
| 82 | - $itemTime = (int) $itemTime; |
|
| 82 | + $itemTime = (int)$itemTime; |
|
| 83 | 83 | |
| 84 | 84 | if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) { |
| 85 | 85 | continue; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $data = array( |
| 168 | 168 | 'token' => $profile->getToken(), |
| 169 | 169 | 'parent' => $profile->getParentToken(), |
| 170 | - 'children' => array_map(function ($p) { |
|
| 170 | + 'children' => array_map(function($p) { |
|
| 171 | 171 | return $p->getToken(); |
| 172 | 172 | }, $profile->getChildren()), |
| 173 | 173 | 'data' => $profile->getCollectors(), |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $profile->getTime(), |
| 193 | 193 | $profile->getParentToken(), |
| 194 | 194 | $profile->getStatusCode(), |
| 195 | - ))."\n"; |
|
| 195 | + )) . "\n"; |
|
| 196 | 196 | |
| 197 | 197 | return $this->appendValue($indexName, $indexRow, $this->lifetime); |
| 198 | 198 | } |
@@ -395,6 +395,6 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | private function delete(array $keys) |
| 397 | 397 | { |
| 398 | - return (bool) $this->getRedis()->delete($keys); |
|
| 398 | + return (bool)$this->getRedis()->delete($keys); |
|
| 399 | 399 | } |
| 400 | 400 | } |