GridFSFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
/**
3
 * GridFSFactory.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
use Nette\Utils;
21
22
use League\Flysystem\GridFS;
23
24
/**
25
 * GridFS adapter filesystem factory
26
 *
27
 * @package        iPublikuj:Flysystem!
28
 * @subpackage     Adapters
29
 *
30
 * @author         Adam Kadlec <[email protected]>
31
 */
32
class GridFSFactory
33
{
34
	/**
35
	 * @param Utils\ArrayHash $parameters
36
	 * @param DI\Container $container
37
	 *
38
	 * @return GridFS\GridFSAdapter
39
	 */
40
	public static function create(Utils\ArrayHash $parameters, DI\Container $container) : GridFS\GridFSAdapter
41
	{
42
		/** @var \MongoGridFS $client */
43
		$client = $container->getService($parameters->client);
44
45
		return new GridFS\GridFSAdapter($client);
46
	}
47
}
48