SessionHandlerFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 17
ccs 0
cts 7
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 8 2
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\CacheBundle\Cache\FixedTaggingCachePool;
15
use Cache\SessionHandler\Psr6SessionHandler;
16
use Cache\Taggable\TaggablePSR6PoolAdapter;
17
use Psr\Cache\CacheItemPoolInterface;
18
19
/**
20
 * @author Tobias Nyholm <[email protected]>
21
 */
22
class SessionHandlerFactory
23
{
24
    /**
25
     * @param CacheItemPoolInterface $pool
26
     * @param array                  $config
27
     *
28
     * @return Psr6SessionHandler
29
     */
30
    public static function get(CacheItemPoolInterface $pool, array $config)
31
    {
32
        if ($config['use_tagging']) {
33
            $pool = new FixedTaggingCachePool(TaggablePSR6PoolAdapter::makeTaggable($pool), ['session']);
34
        }
35
36
        return new Psr6SessionHandler($pool, $config);
37
    }
38
}
39