FtpFactory::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * FtpFactory.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\Utils;
20
21
use League\Flysystem\Adapter;
22
23
/**
24
 * FTP adapter filesystem factory
25
 *
26
 * @package        iPublikuj:Flysystem!
27
 * @subpackage     Adapters
28
 *
29
 * @author         Adam Kadlec <[email protected]>
30
 */
31 View Code Duplication
class FtpFactory
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
{
33
	/**
34
	 * @param Utils\ArrayHash $parameters
35
	 *
36
	 * @return Adapter\Ftp
37
	 */
38
	public static function create(Utils\ArrayHash $parameters) : Adapter\Ftp
39
	{
40
		return new Adapter\Ftp([
41
			'host'     => $parameters->host,
42
			'username' => $parameters->username,
43
			'password' => $parameters->password,
44
45
			'port'    => $parameters->port,
46
			'root'    => $parameters->root,
47
			'passive' => $parameters->passive,
48
			'ssl'     => $parameters->ssl,
49
			'timeout' => $parameters->timeout,
50
		]);
51
	}
52
}
53