@@ -24,11 +24,11 @@ |
||
| 24 | 24 | $config = $this->processConfiguration($configuration, $configs); |
| 25 | 25 | |
| 26 | 26 | // Root Configuration Parameters |
| 27 | - $container->setParameter('sitetheory_profiler_storage.profiler.defaultStorage',$config['profiler']['defaultStorage']); |
|
| 28 | - $container->setParameter('sitetheory_profiler_storage.profiler.class',$config['profiler']['class']); |
|
| 29 | - $container->setParameter('sitetheory_profiler_storage.profiler.dsn',$config['profiler']['dsn']); |
|
| 30 | - $container->setParameter('sitetheory_profiler_storage.profiler.username',$config['profiler']['username']); |
|
| 31 | - $container->setParameter('sitetheory_profiler_storage.profiler.password',$config['profiler']['password']); |
|
| 32 | - $container->setParameter('sitetheory_profiler_storage.profiler.ttl',$config['profiler']['ttl']); |
|
| 27 | + $container->setParameter('sitetheory_profiler_storage.profiler.defaultStorage', $config['profiler']['defaultStorage']); |
|
| 28 | + $container->setParameter('sitetheory_profiler_storage.profiler.class', $config['profiler']['class']); |
|
| 29 | + $container->setParameter('sitetheory_profiler_storage.profiler.dsn', $config['profiler']['dsn']); |
|
| 30 | + $container->setParameter('sitetheory_profiler_storage.profiler.username', $config['profiler']['username']); |
|
| 31 | + $container->setParameter('sitetheory_profiler_storage.profiler.password', $config['profiler']['password']); |
|
| 32 | + $container->setParameter('sitetheory_profiler_storage.profiler.ttl', $config['profiler']['ttl']); |
|
| 33 | 33 | } |
| 34 | 34 | } |
@@ -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; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) |
| 51 | 51 | { |
| 52 | 52 | $this->dsn = $dsn; |
| 53 | - $this->lifetime = (int) $lifetime; |
|
| 53 | + $this->lifetime = (int)$lifetime; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = $values; |
| 81 | 81 | $statusCode = isset($values[6]) ? $values[6] : null; |
| 82 | 82 | |
| 83 | - $itemTime = (int) $itemTime; |
|
| 83 | + $itemTime = (int)$itemTime; |
|
| 84 | 84 | |
| 85 | 85 | if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) { |
| 86 | 86 | continue; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $data = array( |
| 169 | 169 | 'token' => $profile->getToken(), |
| 170 | 170 | 'parent' => $profile->getParentToken(), |
| 171 | - 'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()), |
|
| 171 | + 'children' => array_map(function($p) { return $p->getToken(); }, $profile->getChildren()), |
|
| 172 | 172 | 'data' => $profile->getCollectors(), |
| 173 | 173 | 'ip' => $profile->getIp(), |
| 174 | 174 | 'method' => $profile->getMethod(), |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $profile->getTime(), |
| 192 | 192 | $profile->getParentToken(), |
| 193 | 193 | $profile->getStatusCode(), |
| 194 | - ))."\n"; |
|
| 194 | + )) . "\n"; |
|
| 195 | 195 | |
| 196 | 196 | return $this->appendValue($indexName, $indexRow, $this->lifetime); |
| 197 | 197 | } |
@@ -394,6 +394,6 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | private function delete(array $keys) |
| 396 | 396 | { |
| 397 | - return (bool) $this->getRedis()->delete($keys); |
|
| 397 | + return (bool)$this->getRedis()->delete($keys); |
|
| 398 | 398 | } |
| 399 | 399 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) |
| 40 | 40 | { |
| 41 | 41 | $this->dsn = $dsn; |
| 42 | - $this->lifetime = (int) $lifetime; |
|
| 42 | + $this->lifetime = (int)$lifetime; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | list($itemToken, $itemIp, $itemMethod, $itemUrl, $itemTime, $itemParent) = $values; |
| 71 | 71 | $statusCode = isset($values[6]) ? $values[6] : null; |
| 72 | 72 | |
| 73 | - $itemTime = (int) $itemTime; |
|
| 73 | + $itemTime = (int)$itemTime; |
|
| 74 | 74 | |
| 75 | 75 | if ($ip && false === strpos($itemIp, $ip) || $url && false === strpos($itemUrl, $url) || $method && false === strpos($itemMethod, $method)) { |
| 76 | 76 | continue; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | --$limit; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - usort($result, function ($a, $b) { |
|
| 99 | + usort($result, function($a, $b) { |
|
| 100 | 100 | if ($a['time'] === $b['time']) { |
| 101 | 101 | return 0; |
| 102 | 102 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $data = array( |
| 163 | 163 | 'token' => $profile->getToken(), |
| 164 | 164 | 'parent' => $profile->getParentToken(), |
| 165 | - 'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()), |
|
| 165 | + 'children' => array_map(function($p) { return $p->getToken(); }, $profile->getChildren()), |
|
| 166 | 166 | 'data' => $profile->getCollectors(), |
| 167 | 167 | 'ip' => $profile->getIp(), |
| 168 | 168 | 'method' => $profile->getMethod(), |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $profile->getTime(), |
| 186 | 186 | $profile->getParentToken(), |
| 187 | 187 | $profile->getStatusCode(), |
| 188 | - ))."\n"; |
|
| 188 | + )) . "\n"; |
|
| 189 | 189 | |
| 190 | 190 | return $this->appendValue($indexName, $indexRow, $this->lifetime); |
| 191 | 191 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | private function getItemName($token) |
| 279 | 279 | { |
| 280 | - $name = self::TOKEN_PREFIX.$token; |
|
| 280 | + $name = self::TOKEN_PREFIX . $token; |
|
| 281 | 281 | |
| 282 | 282 | if ($this->isItemNameValid($name)) { |
| 283 | 283 | return $name; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | private function getIndexName() |
| 295 | 295 | { |
| 296 | - $name = self::TOKEN_PREFIX.'index'; |
|
| 296 | + $name = self::TOKEN_PREFIX . 'index'; |
|
| 297 | 297 | |
| 298 | 298 | if ($this->isItemNameValid($name)) { |
| 299 | 299 | return $name; |
@@ -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) { |
@@ -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 | /** |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | 'status_code' => $profile->getStatusCode(), |
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | - $result = $this->getMongo()->update(array('_id' => $profile->getToken()), array_filter($record, function ($v) { return !empty($v); }), array('upsert' => true)); |
|
| 99 | + $result = $this->getMongo()->update(array('_id' => $profile->getToken()), array_filter($record, function($v) { return !empty($v); }), array('upsert' => true)); |
|
| 100 | 100 | |
| 101 | - return (bool) (isset($result['ok']) ? $result['ok'] : $result); |
|
| 101 | + return (bool)(isset($result['ok']) ? $result['ok'] : $result); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -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) { |