Total Complexity | 7 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | class Ftp extends Base implements FtpClientInterface |
||
20 | { |
||
21 | private $connected; |
||
22 | |||
23 | /** |
||
24 | * @inheritDoc |
||
25 | */ |
||
26 | public function isConnected(): bool |
||
27 | { |
||
28 | return $this->connected; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @inheritDoc |
||
33 | */ |
||
34 | public function connect(CredentialInterface $credentials) |
||
35 | { |
||
36 | try { |
||
37 | $this->client = $this->clientFactory->create($credentials->getAll()); |
||
38 | $this->connected = $this->client->login($credentials->username, $credentials->password) ? true : false; |
||
39 | } catch (\Exception $exception) { |
||
40 | $this->connected = false; |
||
41 | } |
||
42 | return $this->connected; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @inheritDoc |
||
47 | */ |
||
48 | public function get($path = '') |
||
49 | { |
||
50 | return $this->client->get($path); |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @inheritDoc |
||
55 | */ |
||
56 | public function ls($dir = '.'): array |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @inheritDoc |
||
63 | */ |
||
64 | public function download($path = '', $destination = false) |
||
67 | } |
||
68 | } |
||
69 |