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 | * Inject the connection for testing purpose. |
||
156 | * |
||
157 | * @param \Net_SFTP $connection |
||
158 | * The connection object. |
||
159 | */ |
||
160 | 39 | public function setConnection(\Net_SFTP $connection) |
|
164 | |||
165 | /** |
||
166 | * Get the connection. |
||
167 | * |
||
168 | * @return \Net_SFTP |
||
169 | */ |
||
170 | 39 | protected function getConnection() |
|
176 | |||
177 | /** |
||
178 | * Login to the SFTP service. |
||
179 | * |
||
180 | * @throws ServiceException |
||
181 | * Whe we can't login to the SFTP server. |
||
182 | */ |
||
183 | 39 | protected function login() |
|
201 | } |
||
202 |