CachedFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 19
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 1
1
<?php
2
/**
3
 * CachedFactory.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        https://www.ipublikuj.eu
7
 * @author         Adam Kadlec <[email protected]>
8
 * @package        iPublikuj:Flysystem!
9
 * @subpackage     Adapters
10
 * @since          1.0.0
11
 *
12
 * @date           23.04.16
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\Flysystem\Factories\Adapters;
18
19
use Nette\DI;
20
21
use League\Flysystem\Cached;
22
23
/**
24
 * Cached adapter filesystem factory
25
 *
26
 * @package        iPublikuj:Flysystem!
27
 * @subpackage     Adapters
28
 *
29
 * @author         Adam Kadlec <[email protected]>
30
 */
31 1
class CachedFactory
32
{
33
	/**
34
	 * @param string $adapterServiceName
35
	 * @param string $cacheServiceName
36
	 * @param DI\Container $container
37
	 *
38
	 * @return Cached\CachedAdapter
39
	 */
40
	public static function create($adapterServiceName, $cacheServiceName, DI\Container $container) : Cached\CachedAdapter
41
	{
42
		/** @var Flysystem\AdapterInterface $adapter */
43 1
		$adapter = $container->getService($adapterServiceName);
44
		/** @var Cached\CacheInterface $cache */
45 1
		$cache = $container->getService($cacheServiceName);
46
47 1
		return new Cached\CachedAdapter($adapter, $cache);
48
	}
49
}
50