/**
  * {@inheritDoc}
  */
 public function create(Filesystem $remote, array $options = array())
 {
     if (!$remote instanceof Directory) {
         throw new \InvalidArgumentException(sprintf("Invalid filesystem given, expected instance of Directory got %s", get_class($remote)));
     }
     if (!isset($options[FTP::RECURSIVE]) || true !== $options[FTP::RECURSIVE]) {
         throw new \InvalidArgumentException("Invalid option given. Expected true as FTP::RECURSIVE parameter");
     }
     $full = ltrim($remote->getRealpath(), '/');
     $parts = explode('/', $full);
     $path = '';
     foreach ($parts as $part) {
         $path = sprintf("%s/%s", $path, $part);
         if (null === $this->manager->findDirectoryByName($path) && !$this->wrapper->mkdir($path)) {
             throw new DirectoryException(sprintf("Could not create directory %s", $path));
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function findDirectoryByName($directory, Directory $inDirectory = null)
 {
     return $this->manager->findDirectoryByName($directory, $inDirectory);
 }