These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * SftpFactory.php |
||
4 | * |
||
5 | * @copyright More in license.md |
||
6 | * @license http://www.ipublikuj.eu |
||
7 | * @author Adam Kadlec http://www.ipublikuj.eu |
||
8 | * @package iPublikuj:Flysystem! |
||
9 | * @subpackage Adapters |
||
10 | * @since 1.0.0 |
||
11 | * |
||
12 | * @date 23.04.16 |
||
13 | */ |
||
14 | |||
15 | namespace IPub\Flysystem\Factories\Adapters; |
||
16 | |||
17 | use Nette; |
||
18 | use Nette\Utils; |
||
19 | |||
20 | use League\Flysystem; |
||
21 | use League\Flysystem\Sftp; |
||
22 | |||
23 | /** |
||
24 | * SFTP adapter filesystem factory |
||
25 | * |
||
26 | * @package iPublikuj:Flysystem! |
||
27 | * @subpackage Adapters |
||
28 | * |
||
29 | * @author Adam Kadlec <[email protected]> |
||
30 | */ |
||
31 | View Code Duplication | class SftpFactory |
|
0 ignored issues
–
show
|
|||
32 | { |
||
33 | /** |
||
34 | * @param Utils\ArrayHash $parameters |
||
35 | * |
||
36 | * @return Sftp\SftpAdapter |
||
37 | */ |
||
38 | public static function create(Utils\ArrayHash $parameters) |
||
39 | { |
||
40 | return new Sftp\SftpAdapter([ |
||
41 | 'host' => $parameters->host, |
||
42 | 'port' => $parameters->port, |
||
43 | 'username' => $parameters->username, |
||
44 | 'password' => $parameters->password, |
||
45 | 'privateKey' => $parameters->privateKey, |
||
46 | |||
47 | 'root' => $parameters->root, |
||
48 | 'timeout' => $parameters->timeout, |
||
49 | ]); |
||
50 | } |
||
51 | } |
||
52 |
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.