DoctrineBridgeFactory::get()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 12
loc 12
ccs 0
cts 10
cp 0
rs 9.4285
cc 3
eloc 6
nc 4
nop 3
crap 12
1
<?php
2
3
/*
4
 * This file is part of php-cache\cache-bundle package.
5
 *
6
 * (c) 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\CacheBundle\Factory;
13
14
use Cache\Bridge\Doctrine\DoctrineCacheBridge;
15
use Cache\CacheBundle\Cache\FixedTaggingCachePool;
16
use Cache\Prefixed\PrefixedCachePool;
17
use Cache\Taggable\TaggablePSR6PoolAdapter;
18
use Psr\Cache\CacheItemPoolInterface;
19
20
/**
21
 * @author Tobias Nyholm <[email protected]>
22
 */
23 View Code Duplication
class DoctrineBridgeFactory
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...
24
{
25
    /**
26
     * @param CacheItemPoolInterface $pool
27
     * @param array                  $config
28
     * @param array                  $tags
29
     *
30
     * @return DoctrineCacheBridge
31
     */
32
    public static function get(CacheItemPoolInterface $pool, array $config, array $tags)
33
    {
34
        if ($config['use_tagging']) {
35
            $pool = new FixedTaggingCachePool(TaggablePSR6PoolAdapter::makeTaggable($pool), $tags);
36
        }
37
38
        if (!empty($config['prefix'])) {
39
            $pool = new PrefixedCachePool($pool, $config['prefix']);
40
        }
41
42
        return new DoctrineCacheBridge($pool);
43
    }
44
}
45