Pop\Archive\Adapter\Zip::addDir PHP Метод

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

Method to create sub directories within the zip archive
public addDir ( array $branch, string $level = null, string $orig = null ) : void
$branch array
$level string
$orig string
Результат void
    public function addDir($branch, $level = null, $orig = null)
    {
        if (!is_array($branch)) {
            $dir = new Dir($branch);
            $branch = $dir->getTree();
        }
        foreach ($branch as $leaf => $node) {
            if (is_array($node)) {
                if (null === $level) {
                    $new = basename($leaf);
                    $orig = substr($leaf, 0, strrpos($leaf, $new));
                } else {
                    $new = $level . $leaf;
                }
                $this->archive->addEmptyDir($new);
                $this->addDir($node, $new, $orig);
            } else {
                $this->archive->addFile($orig . $level . '/' . $node, $level . '/' . $node);
            }
        }
    }