- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactory.php
More file actions
32 lines (28 loc) · 730 Bytes
/
Factory.php
File metadata and controls
32 lines (28 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* Created by Graymur
* Date: 17.10.2014
* Time: 11:01
*/
namespace Graymur\Remote;
class Factory
{
/**
* @param string $protocol
* @param $server
* @param $login
* @param $password
* @param null $port
* @return RemoteAbstract
* @throws RemoteException
*/
static function get($protocol = 'FTP', $server, $login, $password, $port = null)
{
$className = "\\Graymur\\Remote\\Protocols\\" . strtoupper($protocol);
if (!class_exists($className))
{
throw new RemoteException("Protocol $protocol is not implemented");
}
return new $className($server, $login, $password, $port);
}
}