| @@ 20-43 (lines=24) @@ | ||
| 17 | /** |
|
| 18 | * @author Tobias Nyholm <[email protected]> |
|
| 19 | */ |
|
| 20 | final class FilesystemFactory extends AbstractAdapterFactory |
|
| 21 | { |
|
| 22 | protected static $dependencies = [ |
|
| 23 | ['requiredClass' => 'Cache\Adapter\Filesystem\FilesystemCachePool', 'packageName' => 'cache/filesystem-adapter'], |
|
| 24 | ]; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * {@inheritdoc} |
|
| 28 | */ |
|
| 29 | public function getAdapter(array $config) |
|
| 30 | { |
|
| 31 | return new FilesystemCachePool($config['flysystem_service']); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | */ |
|
| 37 | protected static function configureOptionResolver(OptionsResolver $resolver) |
|
| 38 | { |
|
| 39 | $resolver->setRequired(['flysystem_service']); |
|
| 40 | ||
| 41 | $resolver->setAllowedTypes('flysystem_service', ['string', 'object']); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||
| @@ 20-44 (lines=25) @@ | ||
| 17 | /** |
|
| 18 | * @author Tobias Nyholm <[email protected]> |
|
| 19 | */ |
|
| 20 | final class NamespacedFactory extends AbstractAdapterFactory |
|
| 21 | { |
|
| 22 | protected static $dependencies = [ |
|
| 23 | ['requiredClass' => 'Cache\Namespaced\NamespacedCachePool', 'packageName' => 'cache/namespaced-cache'], |
|
| 24 | ]; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * {@inheritdoc} |
|
| 28 | */ |
|
| 29 | public function getAdapter(array $config) |
|
| 30 | { |
|
| 31 | return new NamespacedCachePool($config['service'], $config['namespace']); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * {@inheritdoc} |
|
| 36 | */ |
|
| 37 | protected static function configureOptionResolver(OptionsResolver $resolver) |
|
| 38 | { |
|
| 39 | parent::configureOptionResolver($resolver); |
|
| 40 | ||
| 41 | $resolver->setRequired(['namespace', 'service']); |
|
| 42 | $resolver->setAllowedTypes('namespace', ['string']); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 17-41 (lines=25) @@ | ||
| 14 | use Cache\Prefixed\PrefixedCachePool; |
|
| 15 | use Symfony\Component\OptionsResolver\OptionsResolver; |
|
| 16 | ||
| 17 | final class PrefixedFactory extends AbstractAdapterFactory |
|
| 18 | { |
|
| 19 | protected static $dependencies = [ |
|
| 20 | ['requiredClass' => 'Cache\Prefixed\PrefixedCachePool', 'packageName' => 'cache/prefixed-cache'], |
|
| 21 | ]; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * {@inheritdoc} |
|
| 25 | */ |
|
| 26 | public function getAdapter(array $config) |
|
| 27 | { |
|
| 28 | return new PrefixedCachePool($config['service'], $config['prefix']); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * {@inheritdoc} |
|
| 33 | */ |
|
| 34 | protected static function configureOptionResolver(OptionsResolver $resolver) |
|
| 35 | { |
|
| 36 | parent::configureOptionResolver($resolver); |
|
| 37 | ||
| 38 | $resolver->setRequired(['prefix', 'service']); |
|
| 39 | $resolver->setAllowedTypes('prefix', ['string']); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||