for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nip\Filesystem\FilesystemManager;
use League\Flysystem\Cached\CachedAdapter;
use League\Flysystem\Cached\Storage\Memory as MemoryStore;
use Nip\Utility\Arr;
/**
* Trait HasCacheStoreTrait
* @package Nip\Filesystem\FilesystemManager
*/
trait HasCacheStoreTrait
{
* @param $adapter
* @param $config
protected function checkForCacheNeeded(&$adapter, &$config)
$cache = Arr::pull($config, 'cache');
if (!empty($cache)) {
$adapter = $this->createCacheAdapter($adapter, $cache);
}
* @param $cache
* @return CachedAdapter
protected function createCacheAdapter($adapter, $cache)
return new CachedAdapter($adapter, $this->createCacheStore($cache));
* Create a cache store instance.
*
* @param mixed $config
* @return \League\Flysystem\Cached\CacheInterface|MemoryStore
* @throws \InvalidArgumentException
protected function createCacheStore($config)
$config
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
// if ($config === true) {
return new MemoryStore;
// }
//
// return new Cache(
// $this->app['cache']->store($config['store']),
// $config['prefix'] ?? 'flysystem',
// $config['expire'] ?? null
// );
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.