@@ -51,5 +51,5 @@ |
||
| 51 | 51 | |
| 52 | 52 | if (class_exists('Composer\Autoload\ClassLoader')) { |
| 53 | 53 | trigger_error('Your project already makes use of Composer. You SHOULD use the composer dependency "phpfastcache/phpfastcache" instead of hard-autoloading.', |
| 54 | - E_USER_WARNING); |
|
| 54 | + E_USER_WARNING); |
|
| 55 | 55 | } |
| 56 | 56 | \ No newline at end of file |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * Register Autoload |
| 20 | 20 | */ |
| 21 | -spl_autoload_register(function ($entity) { |
|
| 21 | +spl_autoload_register(function($entity) { |
|
| 22 | 22 | $module = explode('\\', $entity, 2); |
| 23 | - if (!in_array($module[ 0 ], ['phpFastCache', 'Psr'])) { |
|
| 23 | + if (!in_array($module[0], ['phpFastCache', 'Psr'])) { |
|
| 24 | 24 | /** |
| 25 | 25 | * Not a part of phpFastCache file |
| 26 | 26 | * then we return here. |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | if (is_readable($path)) { |
| 34 | 34 | require_once $path; |
| 35 | - }else{ |
|
| 35 | + } else { |
|
| 36 | 36 | trigger_error('Cannot locate the Psr/Cache files', E_USER_ERROR); |
| 37 | 37 | return; |
| 38 | 38 | } |
@@ -273,7 +273,7 @@ |
||
| 273 | 273 | |
| 274 | 274 | if (!is_dir($path)) { |
| 275 | 275 | throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94); |
| 276 | - }else{ |
|
| 276 | + } else{ |
|
| 277 | 277 | $size = Directory::dirSize($path); |
| 278 | 278 | } |
| 279 | 279 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | if (!class_exists('phpFastCache\CacheManager')) { |
| 19 | 19 | echo "[FAIL] Autoload failed to find the CacheManager\n"; |
| 20 | 20 | $status = 255; |
| 21 | -}else{ |
|
| 21 | +} else { |
|
| 22 | 22 | echo "[PASS] Autoload successfully found the CacheManager\n"; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | if (!interface_exists('Psr\Cache\CacheItemInterface')) { |
| 29 | 29 | echo "[FAIL] Autoload failed to find the Psr CacheItemInterface\n"; |
| 30 | 30 | $status = 255; |
| 31 | -}else{ |
|
| 31 | +} else { |
|
| 32 | 32 | echo "[PASS] Autoload successfully found the Psr CacheItemInterface\n"; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | if (!class_exists('phpFastCache\CacheManager')) { |
| 19 | 19 | echo "[FAIL] Autoload failed to find the CacheManager\n"; |
| 20 | 20 | $status = 255; |
| 21 | -}else{ |
|
| 21 | +} else{ |
|
| 22 | 22 | echo "[PASS] Autoload successfully found the CacheManager\n"; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | if (!interface_exists('Psr\Cache\CacheItemInterface')) { |
| 29 | 29 | echo "[FAIL] Autoload failed to find the Psr CacheItemInterface\n"; |
| 30 | 30 | $status = 255; |
| 31 | -}else{ |
|
| 31 | +} else{ |
|
| 32 | 32 | echo "[PASS] Autoload successfully found the Psr CacheItemInterface\n"; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * @param \Psr\Cache\CacheItemInterface $item |
| 160 | - * @return mixed |
|
| 160 | + * @return boolean |
|
| 161 | 161 | * @throws \InvalidArgumentException |
| 162 | 162 | */ |
| 163 | 163 | public function save(CacheItemInterface $item) |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | - * @return mixed|null |
|
| 178 | + * @return boolean |
|
| 179 | 179 | * @throws \InvalidArgumentException |
| 180 | 180 | */ |
| 181 | 181 | public function commit() |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $item->set($this->driverUnwrapData($driverArray)); |
| 62 | 62 | $item->expiresAt($this->driverUnwrapEdate($driverArray)); |
| 63 | 63 | |
| 64 | - if($this->config['itemDetailedDate']){ |
|
| 64 | + if ($this->config['itemDetailedDate']) { |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * If the itemDetailedDate has been |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | } else { |
| 86 | 86 | $item->setHit(true); |
| 87 | 87 | } |
| 88 | - }else{ |
|
| 89 | - $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ])); |
|
| 88 | + } else { |
|
| 89 | + $item->expiresAfter(abs((int) $this->getConfig()['defaultTtl'])); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | throw new \InvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', gettype($key))); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - return $this->itemInstances[ $key ]; |
|
| 97 | + return $this->itemInstances[$key]; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | public function setItem(CacheItemInterface $item) |
| 106 | 106 | { |
| 107 | 107 | if ($this->getClassNamespace() . '\\Item' === get_class($item)) { |
| 108 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 108 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 109 | 109 | |
| 110 | 110 | return $this; |
| 111 | 111 | } else { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | $collection = []; |
| 124 | 124 | foreach ($keys as $key) { |
| 125 | - $collection[ $key ] = $this->getItem($key); |
|
| 125 | + $collection[$key] = $this->getItem($key); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | return $collection; |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | * @var ExtendedCacheItemInterface $item |
| 205 | 205 | */ |
| 206 | 206 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
| 207 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 208 | - } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 207 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 208 | + } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 209 | 209 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
| 210 | 210 | } |
| 211 | 211 | |
@@ -228,12 +228,12 @@ discard block |
||
| 228 | 228 | public function saveDeferred(CacheItemInterface $item) |
| 229 | 229 | { |
| 230 | 230 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
| 231 | - $this->itemInstances[ $item->getKey() ] = $item; |
|
| 232 | - }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 231 | + $this->itemInstances[$item->getKey()] = $item; |
|
| 232 | + } else if (spl_object_hash($item) !== spl_object_hash($this->itemInstances[$item->getKey()])) { |
|
| 233 | 233 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - return $this->deferredList[ $item->getKey() ] = $item; |
|
| 236 | + return $this->deferredList[$item->getKey()] = $item; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | foreach ($this->deferredList as $key => $item) { |
| 247 | 247 | $result = $this->save($item); |
| 248 | 248 | if ($return !== false) { |
| 249 | - unset($this->deferredList[ $key ]); |
|
| 249 | + unset($this->deferredList[$key]); |
|
| 250 | 250 | $return = $result; |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } else { |
| 86 | 86 | $item->setHit(true); |
| 87 | 87 | } |
| 88 | - }else{ |
|
| 88 | + } else{ |
|
| 89 | 89 | $item->expiresAfter(abs((int) $this->getConfig()[ 'defaultTtl' ])); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | { |
| 230 | 230 | if (!array_key_exists($item->getKey(), $this->itemInstances)) { |
| 231 | 231 | $this->itemInstances[ $item->getKey() ] = $item; |
| 232 | - }else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 232 | + } else if(spl_object_hash($item) !== spl_object_hash($this->itemInstances[ $item->getKey() ])){ |
|
| 233 | 233 | throw new \RuntimeException('Spl object hash mismatches ! You probably tried to save a detached item which has been already retrieved from cache.'); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | - * @param $file |
|
| 118 | + * @param string $file |
|
| 119 | 119 | * @return string |
| 120 | 120 | * @throws \Exception |
| 121 | 121 | */ |
@@ -159,9 +159,9 @@ |
||
| 159 | 159 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
| 160 | 160 | { |
| 161 | 161 | $wrap = [ |
| 162 | - self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 163 | - self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 164 | - self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 162 | + self::DRIVER_DATA_WRAPPER_INDEX => $item->get(), |
|
| 163 | + self::DRIVER_TAGS_WRAPPER_INDEX => $item->getTags(), |
|
| 164 | + self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
|
| 165 | 165 | ]; |
| 166 | 166 | |
| 167 | 167 | if($this->config['itemDetailedDate']){ |
@@ -273,7 +273,7 @@ |
||
| 273 | 273 | |
| 274 | 274 | if (!is_dir($path)) { |
| 275 | 275 | throw new phpFastCacheDriverException("Can't read PATH:" . $path, 94); |
| 276 | - }else{ |
|
| 276 | + } else{ |
|
| 277 | 277 | $size = Directory::dirSize($path); |
| 278 | 278 | } |
| 279 | 279 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | if (is_array($config_name)) { |
| 53 | 53 | $this->config = array_merge($this->config, $config_name); |
| 54 | 54 | } else { |
| 55 | - $this->config[ $config_name ] = $value; |
|
| 55 | + $this->config[$config_name] = $value; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -164,16 +164,16 @@ discard block |
||
| 164 | 164 | self::DRIVER_EDATE_WRAPPER_INDEX => $item->getExpirationDate(), |
| 165 | 165 | ]; |
| 166 | 166 | |
| 167 | - if($this->config['itemDetailedDate']){ |
|
| 168 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = new \DateTime(); |
|
| 167 | + if ($this->config['itemDetailedDate']) { |
|
| 168 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = new \DateTime(); |
|
| 169 | 169 | /** |
| 170 | 170 | * If the creation date exists |
| 171 | 171 | * reuse it else set a new Date |
| 172 | 172 | */ |
| 173 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = $item->getCreationDate() ?: new \DateTime(); |
|
| 174 | - }else{ |
|
| 175 | - $wrap[ self::DRIVER_MDATE_WRAPPER_INDEX ] = null; |
|
| 176 | - $wrap[ self::DRIVER_CDATE_WRAPPER_INDEX ] = null; |
|
| 173 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = $item->getCreationDate() ?: new \DateTime(); |
|
| 174 | + } else { |
|
| 175 | + $wrap[self::DRIVER_MDATE_WRAPPER_INDEX] = null; |
|
| 176 | + $wrap[self::DRIVER_CDATE_WRAPPER_INDEX] = null; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | return $wrap; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | public function driverUnwrapData(array $wrapper) |
| 187 | 187 | { |
| 188 | - return $wrapper[ self::DRIVER_DATA_WRAPPER_INDEX ]; |
|
| 188 | + return $wrapper[self::DRIVER_DATA_WRAPPER_INDEX]; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function driverUnwrapTags(array $wrapper) |
| 196 | 196 | { |
| 197 | - return $wrapper[ self::DRIVER_TAGS_WRAPPER_INDEX ]; |
|
| 197 | + return $wrapper[self::DRIVER_TAGS_WRAPPER_INDEX]; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | public function driverUnwrapEdate(array $wrapper) |
| 206 | 206 | { |
| 207 | - return $wrapper[ self::DRIVER_EDATE_WRAPPER_INDEX ]; |
|
| 207 | + return $wrapper[self::DRIVER_EDATE_WRAPPER_INDEX]; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function driverUnwrapCdate(array $wrapper) |
| 215 | 215 | { |
| 216 | - return $wrapper[ self::DRIVER_CDATE_WRAPPER_INDEX ]; |
|
| 216 | + return $wrapper[self::DRIVER_CDATE_WRAPPER_INDEX]; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | public function driverUnwrapMdate(array $wrapper) |
| 225 | 225 | { |
| 226 | - return $wrapper[ self::DRIVER_MDATE_WRAPPER_INDEX ]; |
|
| 226 | + return $wrapper[self::DRIVER_MDATE_WRAPPER_INDEX]; |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | /** |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * on tags item, it can leads |
| 249 | 249 | * to an infinite recursive calls |
| 250 | 250 | */ |
| 251 | - if(strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX ) === 0){ |
|
| 251 | + if (strpos($item->getKey(), self::DRIVER_TAGS_KEY_PREFIX) === 0) { |
|
| 252 | 252 | throw new \LogicException('Trying to set tag(s) to an Tag item index: ' . $item->getKey()); |
| 253 | 253 | } |
| 254 | 254 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | foreach ($tagsItems as $tagsItem) { |
| 292 | 292 | $data = (array) $tagsItem->get(); |
| 293 | 293 | |
| 294 | - unset($data[ $item->getKey() ]); |
|
| 294 | + unset($data[$item->getKey()]); |
|
| 295 | 295 | $tagsItem->set($data); |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -25,7 +25,6 @@ discard block |
||
| 25 | 25 | public $tmp = []; |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * @param bool $skip_create_path |
|
| 29 | 28 | * @param $config |
| 30 | 29 | * @return string |
| 31 | 30 | * @throws \Exception |
@@ -118,7 +117,7 @@ discard block |
||
| 118 | 117 | } |
| 119 | 118 | |
| 120 | 119 | /** |
| 121 | - * @param $keyword |
|
| 120 | + * @param string|false $keyword |
|
| 122 | 121 | * @param bool $skip |
| 123 | 122 | * @return string |
| 124 | 123 | * @throws phpFastCacheDriverException |
@@ -165,7 +164,7 @@ discard block |
||
| 165 | 164 | |
| 166 | 165 | /** |
| 167 | 166 | * @param $filename |
| 168 | - * @return mixed |
|
| 167 | + * @return string |
|
| 169 | 168 | */ |
| 170 | 169 | protected static function cleanFileName($filename) |
| 171 | 170 | { |
@@ -180,7 +179,7 @@ discard block |
||
| 180 | 179 | } |
| 181 | 180 | |
| 182 | 181 | /** |
| 183 | - * @param $path |
|
| 182 | + * @param string $path |
|
| 184 | 183 | * @param bool $create |
| 185 | 184 | * @throws \Exception |
| 186 | 185 | */ |
@@ -185,9 +185,9 @@ |
||
| 185 | 185 | protected static function cleanFileName($filename) |
| 186 | 186 | { |
| 187 | 187 | $regex = [ |
| 188 | - '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
| 189 | - '/\.$/', |
|
| 190 | - '/^\./', |
|
| 188 | + '/[\?\[\]\/\\\=\<\>\:\;\,\'\"\&\$\#\*\(\)\|\~\`\!\{\}]/', |
|
| 189 | + '/\.$/', |
|
| 190 | + '/^\./', |
|
| 191 | 191 | ]; |
| 192 | 192 | $replace = ['-', '', '']; |
| 193 | 193 | |
@@ -34,30 +34,30 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $tmp_dir = rtrim(ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(), '\\/') . DIRECTORY_SEPARATOR . 'phpfastcache'; |
| 36 | 36 | |
| 37 | - if (!isset($this->config[ 'path' ]) || $this->config[ 'path' ] == '') { |
|
| 37 | + if (!isset($this->config['path']) || $this->config['path'] == '') { |
|
| 38 | 38 | if (self::isPHPModule()) { |
| 39 | 39 | $path = $tmp_dir; |
| 40 | 40 | } else { |
| 41 | - $document_root_path = rtrim($_SERVER[ 'DOCUMENT_ROOT' ], '/') . '/../'; |
|
| 42 | - $path = isset($_SERVER[ 'DOCUMENT_ROOT' ]) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . 'PathSeekerTrait.php/'; |
|
| 41 | + $document_root_path = rtrim($_SERVER['DOCUMENT_ROOT'], '/') . '/../'; |
|
| 42 | + $path = isset($_SERVER['DOCUMENT_ROOT']) && is_writable($document_root_path) ? $document_root_path : rtrim(__DIR__, '/') . 'PathSeekerTrait.php/'; |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if ($this->config[ 'path' ] != '') { |
|
| 46 | - $path = $this->config[ 'path' ]; |
|
| 45 | + if ($this->config['path'] != '') { |
|
| 46 | + $path = $this->config['path']; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | } else { |
| 50 | - $path = $this->config[ 'path' ]; |
|
| 50 | + $path = $this->config['path']; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if ($getBasePath === true) { |
| 54 | 54 | return $path; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $securityKey = array_key_exists('securityKey', $this->config) ? $this->config[ 'securityKey' ] : ''; |
|
| 57 | + $securityKey = array_key_exists('securityKey', $this->config) ? $this->config['securityKey'] : ''; |
|
| 58 | 58 | if (!$securityKey || $securityKey === 'auto') { |
| 59 | - if (isset($_SERVER[ 'HTTP_HOST' ])) { |
|
| 60 | - $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER[ 'HTTP_HOST' ]))); |
|
| 59 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
| 60 | + $securityKey = preg_replace('/^www./', '', strtolower(str_replace(':', '_', $_SERVER['HTTP_HOST']))); |
|
| 61 | 61 | } else { |
| 62 | 62 | $securityKey = ($this->isPHPModule() ? 'web' : 'cli'); |
| 63 | 63 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $full_pathx = md5($full_path); |
| 74 | 74 | |
| 75 | 75 | |
| 76 | - if (!isset($this->tmp[ $full_pathx ])) { |
|
| 76 | + if (!isset($this->tmp[$full_pathx])) { |
|
| 77 | 77 | |
| 78 | 78 | if (!@file_exists($full_path) || !@is_writable($full_path)) { |
| 79 | 79 | if (!@file_exists($full_path)) { |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $this->tmp[ $full_pathx ] = true; |
|
| 101 | - $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config[ 'htaccess' ] : false); |
|
| 100 | + $this->tmp[$full_pathx] = true; |
|
| 101 | + $this->htaccessGen($full_path, array_key_exists('htaccess', $this->config) ? $this->config['htaccess'] : false); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | return realpath($full_path); |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function setChmodAuto() |
| 173 | 173 | { |
| 174 | - if (!isset($this->config[ 'default_chmod' ]) || $this->config[ 'default_chmod' ] == '' || is_null($this->config[ 'default_chmod' ])) { |
|
| 174 | + if (!isset($this->config['default_chmod']) || $this->config['default_chmod'] == '' || is_null($this->config['default_chmod'])) { |
|
| 175 | 175 | return 0777; |
| 176 | 176 | } else { |
| 177 | - return $this->config[ 'default_chmod' ]; |
|
| 177 | + return $this->config['default_chmod']; |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | if ($create === true) { |
| 205 | 205 | if (!is_writable($path)) { |
| 206 | 206 | try { |
| 207 | - if(!chmod($path, 0777)){ |
|
| 207 | + if (!chmod($path, 0777)) { |
|
| 208 | 208 | throw new phpFastCacheDriverException('Chmod failed on : ' . $path); |
| 209 | 209 | } |
| 210 | 210 | } catch (phpFastCacheDriverException $e) { |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param \Psr\Cache\CacheItemInterface $item |
| 60 | - * @return mixed |
|
| 60 | + * @return boolean |
|
| 61 | 61 | * @throws \InvalidArgumentException |
| 62 | 62 | */ |
| 63 | 63 | public function driverWrite(CacheItemInterface $item) |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | protected function driverRead(CacheItemInterface $item) |
| 80 | 80 | { |
| 81 | 81 | return [ |
| 82 | - self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
| 83 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
| 84 | - self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(), |
|
| 82 | + self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
| 83 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
| 84 | + self::DRIVER_TIME_WRAPPER_INDEX => new \DateTime(), |
|
| 85 | 85 | ]; |
| 86 | 86 | } |
| 87 | 87 | /** |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | $stat = new driverStatistic(); |
| 132 | 132 | $stat->setInfo('[Devfalse] A void info string') |
| 133 | - ->setSize(0) |
|
| 134 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 135 | - ->setRawData(false); |
|
| 133 | + ->setSize(0) |
|
| 134 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 135 | + ->setRawData(false); |
|
| 136 | 136 | |
| 137 | 137 | return $stat; |
| 138 | 138 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Item constructor. |
| 32 | - * @param \phpFastCache\Drivers\Memcache\Driver $driver |
|
| 32 | + * @param Driver $driver |
|
| 33 | 33 | * @param $key |
| 34 | 34 | * @throws \InvalidArgumentException |
| 35 | 35 | */ |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Item constructor. |
| 32 | - * @param \phpFastCache\Drivers\Apc\Driver $driver |
|
| 32 | + * @param Driver $driver |
|
| 33 | 33 | * @param $key |
| 34 | 34 | * @throws \InvalidArgumentException |
| 35 | 35 | */ |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function getCreationDate() |
| 69 | 69 | { |
| 70 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
| 70 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
| 71 | 71 | return $this->creationDate; |
| 72 | - }else{ |
|
| 72 | + } else { |
|
| 73 | 73 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function setCreationDate(\DateTimeInterface $date) |
| 83 | 83 | { |
| 84 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
| 84 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
| 85 | 85 | $this->creationDate = $date; |
| 86 | 86 | return $this; |
| 87 | - }else{ |
|
| 87 | + } else { |
|
| 88 | 88 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function getModificationDate() |
| 97 | 97 | { |
| 98 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
| 98 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
| 99 | 99 | return $this->modificationDate; |
| 100 | - }else{ |
|
| 100 | + } else { |
|
| 101 | 101 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function setModificationDate(\DateTimeInterface $date) |
| 111 | 111 | { |
| 112 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
| 112 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
| 113 | 113 | $this->modificationDate = $date; |
| 114 | 114 | return $this; |
| 115 | - }else{ |
|
| 115 | + } else { |
|
| 116 | 116 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | public function removeTag($tagName) |
| 280 | 280 | { |
| 281 | 281 | if (($key = array_search($tagName, $this->tags)) !== false) { |
| 282 | - unset($this->tags[ $key ]); |
|
| 282 | + unset($this->tags[$key]); |
|
| 283 | 283 | $this->removedTags[] = $tagName; |
| 284 | 284 | } |
| 285 | 285 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | final public function __debugInfo() |
| 346 | 346 | { |
| 347 | 347 | $info = get_object_vars($this); |
| 348 | - $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')'; |
|
| 348 | + $info['driver'] = 'object(' . get_class($info['driver']) . ')'; |
|
| 349 | 349 | |
| 350 | 350 | return (array) $info; |
| 351 | 351 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | if($this->driver->getConfig()['itemDetailedDate']){ |
| 71 | 71 | return $this->creationDate; |
| 72 | - }else{ |
|
| 72 | + } else{ |
|
| 73 | 73 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | if($this->driver->getConfig()['itemDetailedDate']){ |
| 85 | 85 | $this->creationDate = $date; |
| 86 | 86 | return $this; |
| 87 | - }else{ |
|
| 87 | + } else{ |
|
| 88 | 88 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | if($this->driver->getConfig()['itemDetailedDate']){ |
| 99 | 99 | return $this->modificationDate; |
| 100 | - }else{ |
|
| 100 | + } else{ |
|
| 101 | 101 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if($this->driver->getConfig()['itemDetailedDate']){ |
| 113 | 113 | $this->modificationDate = $date; |
| 114 | 114 | return $this; |
| 115 | - }else{ |
|
| 115 | + } else{ |
|
| 116 | 116 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
| 117 | 117 | } |
| 118 | 118 | } |