public function create($path, $files = null, $recursive = true, $type = null, $password = null)
    {
        if (null === $type) {
            $type = $this->guessAdapterExtension($path);
        }

        
        
        try {
            $adapter = $this->getAdapterFor($this->sanitizeExtension($type));
            if (method_exists($adapter, 'setPassword') && $password){
                $adapter->setPassword($password);
            }
            return $adapter->create($path, $files, $recursive);
        } catch (ExceptionInterface $e) {
            throw new RuntimeException('Unable to create archive', $e->getCode(), $e);
        }
    }
public function create($path, $files = null, $recursive = true, $type = null, $password = null)
    {
        if (null === $type) {
            $type = $this->guessAdapterExtension($path);
        }

        
        
        try {
            $adapter = $this->getAdapterFor($this->sanitizeExtension($type));
            if (method_exists($adapter, 'setPassword') && $password){
                $adapter->setPassword($password);
            }
            return $adapter->create($path, $files, $recursive);
        } catch (ExceptionInterface $e) {
            throw new RuntimeException('Unable to create archive', $e->getCode(), $e);
        }
    }
public function create ( $ path , $ files = null , $ recursive = true , $ type = null , $ password = null ) { if ( null === $ type ) { $ type = $ this -> guessAdapterExtension ( $ path ) ; } try { $ adapter = $ this -> getAdapterFor ( $ this -> sanitizeExtension ( $ type ) ) ; if ( method_exists ( $ adapter , 'setPassword' ) && $ password ) { $ adapter -> setPassword ( $ password ) ; } return $ adapter -> create ( $ path , $ files , $ recursive ) ; } catch ( ExceptionInterface $ e ) { throw new RuntimeException ( 'Unable to create archive' , $ e -> getCode ( ) , $ e ) ; } }
Creates an archive

@param string                         $path
@param string|array|\Traversable|null $files
@param bool                           $recursive
@param string|null                    $type

@return ArchiveInterface

@throws RuntimeException In case of failure
Creates an archive