1 | <?php |
||
21 | class SFtpService extends FtpService |
||
22 | { |
||
23 | /** |
||
24 | * The transfer mode. |
||
25 | * |
||
26 | * Value is substitute for the NET_SFTP_LOCAL_FILE constant. |
||
27 | * |
||
28 | * @var int |
||
29 | */ |
||
30 | const TRANSFER_MODE = 1; |
||
31 | |||
32 | /** |
||
33 | * The SFTP connection. |
||
34 | * |
||
35 | * @var \Net_SFTP |
||
36 | */ |
||
37 | private $sftp; |
||
38 | |||
39 | /** |
||
40 | * Is the connection logged in? |
||
41 | * |
||
42 | * @var bool |
||
43 | */ |
||
44 | private $loggedIn = false; |
||
45 | |||
46 | |||
47 | /** |
||
48 | * @inheritDoc |
||
49 | */ |
||
50 | 39 | public function __construct(array $config) |
|
58 | |||
59 | /** |
||
60 | * @inheritDoc |
||
61 | */ |
||
62 | 15 | public function send(FileInterface $file) |
|
81 | |||
82 | /** |
||
83 | * @inheritDoc |
||
84 | */ |
||
85 | 6 | public function scan() |
|
106 | |||
107 | /** |
||
108 | * @inheritDoc |
||
109 | */ |
||
110 | 9 | public function receive($fileName, $localDirectory) |
|
130 | |||
131 | /** |
||
132 | * {@inheritdoc} |
||
133 | */ |
||
134 | 9 | public function processed($fileName) |
|
153 | |||
154 | /** |
||
155 | * {@inheritdoc} |
||
156 | */ |
||
157 | public function delete($fileName) |
||
174 | |||
175 | |||
176 | /** |
||
177 | * Inject the connection for testing purpose. |
||
178 | * |
||
179 | * @param \Net_SFTP $connection |
||
180 | * The connection object. |
||
181 | */ |
||
182 | 39 | public function setConnection(\Net_SFTP $connection) |
|
186 | |||
187 | /** |
||
188 | * Get the connection. |
||
189 | * |
||
190 | * @return \Net_SFTP |
||
191 | */ |
||
192 | 39 | protected function getConnection() |
|
198 | |||
199 | /** |
||
200 | * Login to the SFTP service. |
||
201 | * |
||
202 | * @throws ServiceException |
||
203 | * Whe we can't login to the SFTP server. |
||
204 | */ |
||
205 | 39 | protected function login() |
|
223 | } |
||
224 |