Completed
Push — master ( 46fb62...052fb1 )
by Tobias
22:30
created

NamespacedFactory::configureOptionResolver()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of php-cache organization.
5
 *
6
 * (c) 2015-2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Cache\AdapterBundle\Factory;
13
14
use Cache\Namespaced\NamespacedCachePool;
15
use Symfony\Component\OptionsResolver\OptionsResolver;
16
17
/**
18
 * @author Tobias Nyholm <[email protected]>
19
 */
20 View Code Duplication
class NamespacedFactory extends AbstractAdapterFactory
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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