@@ -105,6 +105,6 @@ |
||
105 | 105 | // simulate append in Memcache <3.0 |
106 | 106 | $content = $memcache->get($key); |
107 | 107 | |
108 | - return $memcache->set($key, $content.$value, false, $expiration); |
|
108 | + return $memcache->set($key, $content . $value, false, $expiration); |
|
109 | 109 | } |
110 | 110 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $this->dsn = $dsn; |
44 | 44 | $this->username = $username; |
45 | 45 | $this->password = $password; |
46 | - $this->lifetime = (int) $lifetime; |
|
46 | + $this->lifetime = (int)$lifetime; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | |
62 | 62 | list($criteria, $args) = $this->buildCriteria($ip, $url, $start, $end, $limit, $method); |
63 | 63 | |
64 | - $criteria = $criteria ? 'WHERE '.implode(' AND ', $criteria) : ''; |
|
64 | + $criteria = $criteria ? 'WHERE ' . implode(' AND ', $criteria) : ''; |
|
65 | 65 | |
66 | 66 | $db = $this->initDb(); |
67 | - $tokens = $this->fetch($db, 'SELECT token, ip, method, url, time, parent, status_code FROM sf_profiler_data '.$criteria.' ORDER BY time DESC LIMIT '.((int) $limit), $args); |
|
67 | + $tokens = $this->fetch($db, 'SELECT token, ip, method, url, time, parent, status_code FROM sf_profiler_data ' . $criteria . ' ORDER BY time DESC LIMIT ' . ((int)$limit), $args); |
|
68 | 68 | $this->close($db); |
69 | 69 | |
70 | 70 | return $tokens; |
@@ -54,12 +54,12 @@ |
||
54 | 54 | |
55 | 55 | if ($ip = preg_replace('/[^\d\.]/', '', $ip)) { |
56 | 56 | $criteria[] = 'ip LIKE :ip'; |
57 | - $args[':ip'] = '%'.$ip.'%'; |
|
57 | + $args[':ip'] = '%' . $ip . '%'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | if ($url) { |
61 | 61 | $criteria[] = 'url LIKE :url'; |
62 | - $args[':url'] = '%'.addcslashes($url, '%_\\').'%'; |
|
62 | + $args[':url'] = '%' . addcslashes($url, '%_\\') . '%'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | if ($method) { |
@@ -107,12 +107,12 @@ |
||
107 | 107 | |
108 | 108 | if ($ip = preg_replace('/[^\d\.]/', '', $ip)) { |
109 | 109 | $criteria[] = 'ip LIKE :ip'; |
110 | - $args[':ip'] = '%'.$ip.'%'; |
|
110 | + $args[':ip'] = '%' . $ip . '%'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | if ($url) { |
114 | 114 | $criteria[] = 'url LIKE :url ESCAPE "\"'; |
115 | - $args[':url'] = '%'.addcslashes($url, '%_\\').'%'; |
|
115 | + $args[':url'] = '%' . addcslashes($url, '%_\\') . '%'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | if ($method) { |
@@ -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 | } |