Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 7, 2017
1 parent 28759a8 commit 0657496
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
30 changes: 15 additions & 15 deletions src/Illuminate/Filesystem/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -22,7 +22,7 @@ class Cache extends AbstractCache
protected $key;

/**
* The cache expire in minutes.
* The cache expiration time in minutes.
*
* @var int
*/
Expand All @@ -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);
}
}
Expand All @@ -52,26 +52,26 @@ 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
*/
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);
}
}
}
20 changes: 10 additions & 10 deletions src/Illuminate/Filesystem/FilesystemAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Filesystem/FilesystemManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand Down

0 comments on commit 0657496

Please sign in to comment.