构建目标目录

@param string $distPath
目标文件路径
@return void
778020
private function buildDistDir(string $distPath): void
    {
        $distDir = dirname($distPath);
        if (! is_dir($distDir)) {
            if (@mkdir($distDir, 0755, true) === false) {
                throw new \Exception('创建目录' . $distDir . '失败');
            }
        }
    }
74032
private function setYamlPath(string $yamlPath): void
    {
        $chars = preg_quote(':._-\/\\\\', '#');
        $pattern = '#^[\w' . $chars . ']+\.(yaml|yml)$#';
        if (!preg_match($pattern, $yamlPath)) {
            throw new ParserException('Given path to YAML file is invalid');
        }

        // Get absolute path to file, resolve symbolic links (if any)
        $givenPath = $yamlPath;
        $yamlPath = realpath($yamlPath);
        if (!$yamlPath) {
            throw new ParserException(
                sprintf('YAML file "%s" not found in directory "%s"', basename($givenPath), dirname($givenPath))
            );
        }

        $this->yamlPath = $yamlPath;
        $this->baseDirectory = dirname($this->yamlPath);
    }
516986
public function setDistFiles(Collection $distFiles)
    {
        if ($distFiles->getType() !== DistFile::class) {
            throw new \UnexpectedValueException('The Collection is not of DistFile type');
        }

        $this->distFiles = $distFiles;
    }
210494
protected function makeDir($path)
    {
        if (! file_exists(dirname($path))) {
            $this->makeDir(dirname($path));
        }

        if (! file_exists($path)) {
            mkdir($path);
        }
    }
1080072
public function setPath(?string $path) : void
    {
        if (strpos($path, "/") !== 0) {
            $path = "/" . $path;
        }
        $this->path = $path;
    }
861711
public function setPath($path)
    {
        $this->parts = Path::translatePath($this->outer->getProject(), $path);
    }
1012377
public function setCachePath(string $cachePath)
    {
        $this->cachePath = $cachePath;
        if (!is_dir($this->cachePath)) {
            FileHelper::createDirectory($this->cachePath, $this->dirMode, true);
        }
    }
719397
private function clearDirectory($path)
    {
        $this->debug("Clear directory: {$path}");
        $this->delete($path);
        $this->makeDirectory($path);
    }
92871
protected function _subdirs($path) {
		return ($stat = $this->stat($path)) && isset($stat['dirs']) ? $stat['dirs'] : false;
	}
32368
public static function mkdir(string $path)
    {
        if (!is_dir($path))
        {
            mkdir($path, self::$dir_mode, true);
        }
    }
1099639
public function setPath($path)
    {
        // clear out the prior search dirs
        $this->configList[self::TPL_PATH_LIST] = [];
        // always add the fallback directories as last resort
        $this->addPath('.');
        // actually add the user-specified directory
        $this->addPath($path);
    }
498272
public static function addPath($path)
    {
        if ( ! isset(self::$_i18nPaths[$path]))
        {
            self::$_i18nPaths[$path] = $path;
        }
    }
1143610
public function dest($path)
    {
        return $this->iterate(function ($distFile) use ($path) {
            $dir = $path;

            /** @var DistFile $distFile */
            $filename = $distFile->getDistpathname();
            $dsPos = strrpos($filename, DIRECTORY_SEPARATOR);

            if ($dsPos) {
                $dir .= DIRECTORY_SEPARATOR . substr($filename, 0, $dsPos);
            }

            if (!file_exists($dir)) {
                mkdir($dir, 0777, true);
            }

            file_put_contents(
                $path . DIRECTORY_SEPARATOR . $filename,
                $distFile->getContent()
            );
        });
    }
887645
protected static function addPath($path)
    {
        $len = strlen(DIRECTORY_SEPARATOR);
        while (1) {
            if (!is_string($path)) {
                return;
            }

            if (substr($path, -$len) == DIRECTORY_SEPARATOR) {
                $path = substr($path, 0, -$len);
            } else {
                break;
            }
        }

        if (!in_array($path, self::$paths)) {
            self::$paths[] = $path;
        }
    }
796099
protected function createDirectory($filePath)
    {
        $parts = explode('/', $filePath);
        $file = array_pop($parts);
        $dir = '';
        foreach ($parts as $part) {
            if (!is_dir($dir .= "/$part")) {
                mkdir($dir);
            }
        }
    }
1134943
protected function _setExportDir($path = null) {
		$path = (string)$path;
		if (file_exists($path)) {
			$this->_pathExportDir = $path;
		}
	}
134281
protected function processDirectory(string $path = '', array &$worklist = []): void
    {
        $dir = new DirectoryIterator($this->basePath . $path);

        foreach ($dir as $item) {
            if ($item->isDot()) {
                continue;
            }

            $itemPath = $path . $item->getFilename();

            if ($this->exclude($itemPath)) {
                continue;
            }

            if ($item->isFile() && $item->getExtension() == 'php') {
                $worklist[] = $item->getFileInfo();
            }

            if ($item->isDir()) {
                $this->processDirectory($itemPath . '/', $worklist);
            }
        }
    }