/** * {@inheritDoc} * * @throws InvalidArgumentException When argument(s) is(are) incorrect */ public function download($local, Filesystem $remote, array $options = array()) { if (!$remote instanceof File) { throw new \InvalidArgumentException(sprintf("Invalid remote file given, expected instance of File, got %s", get_class($remote))); } if (false !== is_resource($local)) { throw new \InvalidArgumentException("Invalid local file given. Expected filename, got resource"); } if (false !== is_dir($local)) { throw new \InvalidArgumentException("Invalid local file given. Expected filename, got directory"); } if (!isset($options[FTP::NON_BLOCKING]) || false !== $options[FTP::NON_BLOCKING]) { throw new \InvalidArgumentException("Invalid option given. Expected false as FTP::NON_BLOCKING parameter"); } $defaults = array(FTP::TRANSFER_MODE => FTPWrapper::BINARY, FTP::START_POS => 0); $options = $options + $defaults; return $this->wrapper->get($local, $remote->getRealPath(), $options[FTP::TRANSFER_MODE], $options[FTP::START_POS]); }