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