1 | <?php |
||
24 | abstract class AbstractFtpClient { |
||
25 | |||
26 | /** |
||
27 | * Authenticator. |
||
28 | * |
||
29 | * @var Authenticator |
||
30 | */ |
||
31 | private $authenticator; |
||
32 | |||
33 | /** |
||
34 | * Connection. |
||
35 | * |
||
36 | * @var ressource |
||
37 | */ |
||
38 | private $connection; |
||
39 | |||
40 | /** |
||
41 | * Constructor. |
||
42 | * |
||
43 | * @param Authenticator $authenticator The authenticator. |
||
44 | */ |
||
45 | protected function __construct(Authenticator $authenticator) { |
||
48 | |||
49 | /** |
||
50 | * Get the authenticator. |
||
51 | * |
||
52 | * @return Authenticator Returns the authenticator. |
||
53 | */ |
||
54 | public function getAuthenticator() { |
||
57 | |||
58 | /** |
||
59 | * Get the connection. |
||
60 | * |
||
61 | * @return mixed Returns the connection. |
||
62 | */ |
||
63 | public function getConnection() { |
||
66 | |||
67 | /** |
||
68 | * Construct a new FTP exception. |
||
69 | * |
||
70 | * @param string $message The message. |
||
71 | * @return FtpException Returns a new FTP exception. |
||
72 | */ |
||
73 | protected function newFtpException($message) { |
||
74 | |||
75 | $format = "%s://%s:%s@%s:%d ${message}"; |
||
76 | $args = [ |
||
77 | $this->getAuthenticator()->getScheme(), |
||
78 | $this->getAuthenticator()->getPasswordAuthentication()->getUsername(), |
||
79 | $this->getAuthenticator()->getPasswordAuthentication()->getPassword(), |
||
80 | $this->getAuthenticator()->getHostname(), |
||
81 | $this->getAuthenticator()->getPort(), |
||
82 | ]; |
||
83 | |||
84 | return new FtpException(vsprintf($format, $args)); |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * Set the authenticator. |
||
89 | * |
||
90 | * @param Authenticator $authenticator The authenticator. |
||
91 | * @return AbstractFtpClient Returns this FTP client. |
||
92 | */ |
||
93 | protected function setAuthenticator(Authenticator $authenticator) { |
||
97 | |||
98 | /** |
||
99 | * Set the connection. |
||
100 | * |
||
101 | * @param mixed $connection The connection. |
||
102 | * @return AbstractFtpClient Returns this FTP client. |
||
103 | */ |
||
104 | protected function setConnection($connection) { |
||
108 | } |
||
109 |