Code Duplication    Length = 21-22 lines in 2 locations

src/IPub/Flysystem/Factories/Adapters/FtpFactory.php 1 location

@@ 31-52 (lines=22) @@
28
 *
29
 * @author         Adam Kadlec <[email protected]>
30
 */
31
class FtpFactory
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

src/IPub/Flysystem/Factories/Adapters/SftpFactory.php 1 location

@@ 31-51 (lines=21) @@
28
 *
29
 * @author         Adam Kadlec <[email protected]>
30
 */
31
class SftpFactory
32
{
33
	/**
34
	 * @param Utils\ArrayHash $parameters
35
	 *
36
	 * @return Sftp\SftpAdapter
37
	 */
38
	public static function create(Utils\ArrayHash $parameters) : Sftp\SftpAdapter
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