diff --git a/src/Illuminate/Filesystem/Cache.php b/src/Illuminate/Filesystem/Cache.php index 1ec575141d87..deb5fe5d177b 100644 --- a/src/Illuminate/Filesystem/Cache.php +++ b/src/Illuminate/Filesystem/Cache.php @@ -8,11 +8,11 @@ class Cache extends AbstractCache { /** - * The cache repository instance. + * The cache repository implementation. * * @var \Illuminate\Contracts\Cache\Repository */ - protected $repo; + protected $repository; /** * The cache key. @@ -22,7 +22,7 @@ class Cache extends AbstractCache protected $key; /** - * The cache expire in minutes. + * The cache expiration time in minutes. * * @var int */ @@ -31,16 +31,16 @@ class Cache extends AbstractCache /** * Create a new cache instance. * - * @param \Illuminate\Contracts\Cache\Repository $repo - * @param string $key - * @param int|null $expire + * @param \Illuminate\Contracts\Cache\Repository $repository + * @param string $key + * @param int|null $expire */ - public function __construct(Repository $repo, string $key = 'flysystem', int $expire = null) + public function __construct(Repository $repository, $key = 'flysystem', $expire = null) { - $this->repo = $repo; $this->key = $key; + $this->repository = $repository; - if ($expire) { + if (! is_null($expire)) { $this->expire = (int) ceil($expire / 60); } } @@ -52,15 +52,15 @@ public function __construct(Repository $repo, string $key = 'flysystem', int $ex */ public function load() { - $contents = $this->repo->get($this->key); + $contents = $this->repository->get($this->key); - if ($contents !== null) { + if (! is_null($contents)) { $this->setFromStorage($contents); } } /** - * Store the cache. + * Persist the cache. * * @return void */ @@ -68,10 +68,10 @@ public function save() { $contents = $this->getForStorage(); - if ($this->expire !== null) { - $this->repo->put($this->key, $contents, $this->expire); + if (! is_null($this->expire)) { + $this->repository->put($this->key, $contents, $this->expire); } else { - $this->repo->forever($this->key, $contents); + $this->repository->forever($this->key, $contents); } } } diff --git a/src/Illuminate/Filesystem/FilesystemAdapter.php b/src/Illuminate/Filesystem/FilesystemAdapter.php index 73995af32695..572bf33e8983 100644 --- a/src/Illuminate/Filesystem/FilesystemAdapter.php +++ b/src/Illuminate/Filesystem/FilesystemAdapter.php @@ -604,16 +604,6 @@ public function deleteDirectory($directory) return $this->driver->deleteDir($directory); } - /** - * Get the Flysystem driver. - * - * @return \League\Flysystem\FilesystemInterface - */ - public function getDriver() - { - return $this->driver; - } - /** * Flush the Flysystem cache. * @@ -628,6 +618,16 @@ public function flushCache() } } + /** + * Get the Flysystem driver. + * + * @return \League\Flysystem\FilesystemInterface + */ + public function getDriver() + { + return $this->driver; + } + /** * Filter directory contents by type. * diff --git a/src/Illuminate/Filesystem/FilesystemManager.php b/src/Illuminate/Filesystem/FilesystemManager.php index 9c1f45ae4e43..2c01823593ca 100644 --- a/src/Illuminate/Filesystem/FilesystemManager.php +++ b/src/Illuminate/Filesystem/FilesystemManager.php @@ -287,8 +287,8 @@ protected function createCacheStore($config) return new Cache( $this->app['cache']->store($config['store']), - Arr::get($config, 'prefix', 'flysystem'), - Arr::get($config, 'expire') + $config['prefix'] ?? 'flysystem', + $config['expire'] ?? null ); }