DNData::getProjectPaths PHP Method

getProjectPaths() public method

Returns an array of paths
public getProjectPaths ( ) : array
return array
    public function getProjectPaths()
    {
        $paths = array();
        if (!file_exists($this->getEnvironmentDir())) {
            $eMessage = 'The environment directory ' . $this->getEnvironmentDir() . ' doesn\'t exist. Create it ' . 'first and add some projects to it.';
            throw new Exception($eMessage);
        }
        foreach (scandir($this->getEnvironmentDir()) as $project) {
            // Exlcude dot-prefixed directories (.git was getting in the way)
            if (preg_match('/^[^\\.]/', $project)) {
                $path = $this->getEnvironmentDir() . '/' . $project;
                if (is_dir($path) && $project != '.' && $project != '..') {
                    $paths[] = $project;
                }
            }
        }
        sort($paths);
        return array_values($paths);
    }