@@ -102,7 +102,7 @@ |
||
| 102 | 102 | |
| 103 | 103 | // @TODO - Temporary fix @see https://github.com/krakjoe/apcu/pull/42 |
| 104 | 104 | if (PHP_VERSION_ID >= 50500) { |
| 105 | - $info['num_hits'] = isset($info['num_hits']) ? $info['num_hits'] : $info['nhits']; |
|
| 105 | + $info['num_hits'] = isset($info['num_hits']) ? $info['num_hits'] : $info['nhits']; |
|
| 106 | 106 | $info['num_misses'] = isset($info['num_misses']) ? $info['num_misses'] : $info['nmisses']; |
| 107 | 107 | $info['start_time'] = isset($info['start_time']) ? $info['start_time'] : $info['stime']; |
| 108 | 108 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | protected function doFetch($id) |
| 67 | 67 | { |
| 68 | - if (! $this->doContains($id)) { |
|
| 68 | + if ( ! $this->doContains($id)) { |
|
| 69 | 69 | $this->missesCount += 1; |
| 70 | 70 | |
| 71 | 71 | return false; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | protected function doContains($id) |
| 83 | 83 | { |
| 84 | - if (! isset($this->data[$id])) { |
|
| 84 | + if ( ! isset($this->data[$id])) { |
|
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $value = $cacheProvider->doFetch($id); |
| 64 | 64 | |
| 65 | 65 | // We populate all the previous cache layers (that are assumed to be faster) |
| 66 | - for ($subKey = $key - 1 ; $subKey >= 0 ; $subKey--) { |
|
| 66 | + for ($subKey = $key - 1; $subKey >= 0; $subKey--) { |
|
| 67 | 67 | $this->cacheProviders[$subKey]->doSave($id, $value); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -106,6 +106,6 @@ |
||
| 106 | 106 | $data = serialize($data); |
| 107 | 107 | $filename = $this->getFilename($id); |
| 108 | 108 | |
| 109 | - return $this->writeFile($filename, $lifeTime . PHP_EOL . $data); |
|
| 109 | + return $this->writeFile($filename, $lifeTime.PHP_EOL.$data); |
|
| 110 | 110 | } |
| 111 | 111 | } |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // No lifetime, use MSET |
| 73 | - $response = $this->client->mset(array_map(function ($value) { |
|
| 73 | + $response = $this->client->mset(array_map(function($value) { |
|
| 74 | 74 | return serialize($value); |
| 75 | 75 | }, $keysAndValues)); |
| 76 | 76 | |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | |
| 96 | 96 | // Keys have lifetime, use SETEX for each of them |
| 97 | 97 | foreach ($keysAndValues as $key => $value) { |
| 98 | - if (!$this->redis->setex($key, $lifetime, $value)) { |
|
| 98 | + if ( ! $this->redis->setex($key, $lifetime, $value)) { |
|
| 99 | 99 | $success = false; |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | $stats = $this->couchbase->getStats(); |
| 109 | 109 | $servers = $this->couchbase->getServers(); |
| 110 | 110 | $server = explode(":", $servers[0]); |
| 111 | - $key = $server[0] . ":" . "11210"; |
|
| 111 | + $key = $server[0].":"."11210"; |
|
| 112 | 112 | $stats = $stats[$key]; |
| 113 | 113 | return [ |
| 114 | 114 | Cache::STATS_HITS => $stats['get_hits'], |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | { |
| 143 | 143 | $stats = $this->memcached->getStats(); |
| 144 | 144 | $servers = $this->memcached->getServerList(); |
| 145 | - $key = $servers[0]['host'] . ':' . $servers[0]['port']; |
|
| 145 | + $key = $servers[0]['host'].':'.$servers[0]['port']; |
|
| 146 | 146 | $stats = $stats[$key]; |
| 147 | 147 | return [ |
| 148 | 148 | Cache::STATS_HITS => $stats['get_hits'], |
@@ -158,7 +158,7 @@ |
||
| 158 | 158 | /** |
| 159 | 159 | * Find a single row by ID. |
| 160 | 160 | * |
| 161 | - * @param mixed $id |
|
| 161 | + * @param string $id |
|
| 162 | 162 | * @param bool $includeData |
| 163 | 163 | * |
| 164 | 164 | * @return array|null |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $item = $this->findById($id); |
| 90 | 90 | |
| 91 | - if (!$item) { |
|
| 91 | + if ( ! $item) { |
|
| 92 | 92 | return false; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | * |
| 164 | 164 | * @return array|null |
| 165 | 165 | */ |
| 166 | - private function findById($id, bool $includeData = true) : ?array |
|
| 166 | + private function findById($id, bool $includeData = true) : ? array |
|
| 167 | 167 | { |
| 168 | 168 | list($idField) = $fields = $this->getFields(); |
| 169 | 169 | |
| 170 | - if (!$includeData) { |
|
| 170 | + if ( ! $includeData) { |
|
| 171 | 171 | $key = array_search(static::DATA_FIELD, $fields); |
| 172 | 172 | unset($fields[$key]); |
| 173 | 173 | } |