RequestCacheFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 5 1
1
<?php
2
3
/**
4
 * This file is part of the bugloos/fault-tolerance-bundle project.
5
 * (c) Bugloos <https://bugloos.com/>
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace Bugloos\FaultToleranceBundle\Factory;
11
12
use Bugloos\FaultToleranceBundle\RequestCache\RequestCache;
13
use Bugloos\FaultToleranceBundle\RequestCache\Storage\CacheStorageFactory;
14
use Exception;
15
16
/**
17
 * @author Mojtaba Gheytasi <[email protected]>
18
 */
19
class RequestCacheFactory
20
{
21
    private CacheStorageFactory $storageFactory;
22
23
    public function __construct(CacheStorageFactory $storageFactory)
24
    {
25
        $this->storageFactory = $storageFactory;
26
    }
27
28
    /**
29
     * @throws Exception
30
     */
31
    public function create(string $storageType): RequestCache
32
    {
33
        $storage = $this->storageFactory->create($storageType);
34
35
        return new RequestCache($storage);
36
    }
37
}
38