ManaPHP\Filesystem\Adapter\File::_dirCopy PHP Метод

_dirCopy() защищенный Метод

protected _dirCopy ( string $src, string $dst, boolean $overwrite ) : void
$src string
$dst string
$overwrite boolean
Результат void
    protected function _dirCopy($src, $dst, $overwrite)
    {
        foreach (scandir($src, SCANDIR_SORT_NONE) as $item) {
            if ($item === '.' || $item === '..') {
                continue;
            }
            $srcPath = $src . '/' . $item;
            $dstPath = $dst . '/' . $item;
            if (is_file($srcPath)) {
                if ($overwrite || !file_exists($dstPath)) {
                    if (!copy($srcPath, $dstPath)) {
                        throw new FileException('copy `:src` file to `:dst` file failed: :last_error_message', ['src' => $srcPath, 'dst' => $dstPath]);
                    }
                }
            } elseif (is_dir($srcPath)) {
                $this->_dirCreate($dstPath);
                if ($overwrite || !is_dir($dstPath)) {
                    $this->_dirCopy($srcPath, $dstPath, $overwrite);
                }
            } else {
                break;
            }
        }
    }