Pop\Archive\Adapter\Tar::addFiles PHP Метод

addFiles() публичный Метод

Method to create an archive file
public addFiles ( string | array $files ) : void
$files string | array
Результат void
    public function addFiles($files)
    {
        if (!is_array($files)) {
            $files = array($files);
        }
        foreach ($files as $file) {
            // If file is a directory, loop through and add the files.
            if (file_exists($file) && is_dir($file)) {
                $realpath = realpath($file);
                $dir = new Dir($file, true, true);
                $dirFiles = $dir->getFiles();
                foreach ($dirFiles as $fle) {
                    if (file_exists($fle) && !is_dir($fle)) {
                        $fle = $file . DIRECTORY_SEPARATOR . str_replace($realpath . DIRECTORY_SEPARATOR, '', $fle);
                        $this->archive->add($fle);
                    }
                }
                // Else, just add the file.
            } else {
                if (file_exists($file)) {
                    $this->archive->add($file);
                }
            }
        }
    }