These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
||
5 | * @copyright Aimeos (aimeos.org), 2015 |
||
6 | * @package MW |
||
7 | * @subpackage Filesystem |
||
8 | */ |
||
9 | |||
10 | |||
11 | namespace Aimeos\MW\Filesystem; |
||
12 | |||
13 | use League\Flysystem\Filesystem; |
||
14 | use League\Flysystem\Adapter\Ftp as FtpAdapter; |
||
15 | |||
16 | |||
17 | /** |
||
18 | * Implementation of Flysystem FTP file system adapter |
||
19 | * |
||
20 | * @package MW |
||
21 | * @subpackage Filesystem |
||
22 | */ |
||
23 | View Code Duplication | class FlyFtp extends FlyBase implements Iface, DirIface, MetaIface |
|
0 ignored issues
–
show
|
|||
24 | { |
||
25 | private $fs; |
||
26 | |||
27 | |||
28 | /** |
||
29 | * Returns the file system provider |
||
30 | * |
||
31 | * @return \League\Flysystem\FilesystemInterface File system provider |
||
32 | */ |
||
33 | protected function getProvider() |
||
34 | { |
||
35 | if( !isset( $this->fs ) ) |
||
36 | { |
||
37 | $config = $this->getConfig(); |
||
38 | $this->fs = new Filesystem( new FtpAdapter( $config ) ); |
||
39 | } |
||
40 | |||
41 | return $this->fs; |
||
42 | } |
||
43 | } |
||
44 |
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.