DropboxFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 1
1
<?php
2
/**
3
 * DropboxFactory.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           19.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\Dropbox;
23
24
use Dropbox\Client;
25
26
/**
27
 * Dropbox adapter filesystem factory
28
 *
29
 * @package        iPublikuj:Flysystem!
30
 * @subpackage     Adapters
31
 *
32
 * @author         Adam Kadlec <[email protected]>
33
 */
34
class DropboxFactory
35
{
36
	/**
37
	 * @param Utils\ArrayHash $parameters
38
	 * @param DI\Container $container
39
	 *
40
	 * @return Dropbox\DropboxAdapter
41
	 */
42
	public static function create(Utils\ArrayHash $parameters, DI\Container $container) : Dropbox\DropboxAdapter
43
	{
44
		/** @var Client $client */
45
		$client = $container->getService($parameters->client);
46
47
		return new Dropbox\DropboxAdapter(
48
			$client,
49
			$parameters->prefix
50
		);
51
	}
52
}
53