for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of php-cache organization.
*
* (c) 2015-2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Cache\AdapterBundle\Factory;
use Cache\Adapter\PHPArray\ArrayCachePool;
use Cache\Namespaced\NamespacedCachePool;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @author Tobias Nyholm <[email protected]>
class ArrayFactory extends AbstractAdapterFactory
{
protected static $dependencies = [
['requiredClass' => 'Cache\Adapter\PHPArray\ArrayCachePool', 'packageName' => 'cache/array-adapter'],
];
* {@inheritdoc}
public function getAdapter(array $config)
$pool = new ArrayCachePool();
if (null !== $config['pool_namespace']) {
$pool = new NamespacedCachePool($pool, $config['pool_namespace']);
}
return $pool;
protected static function configureOptionResolver(OptionsResolver $resolver)
parent::configureOptionResolver($resolver);
$resolver->setDefaults(
[
'pool_namespace' => null,
]
);
$resolver->setAllowedTypes('pool_namespace', ['string', 'null']);