Beispiel #1
0
     * @param string $key
     * @returns string absolute path for the directory specified in configuration
     *                 or null if this option was not specified and does not have
     *                 a default value
     * @see FajrConfig::$defaultOptions
     * @see FajrConfig::$directoriesRelativeTo
     * @see configuration.example.php
     */
    public static function getDirectory($key)
    {
        self::assertInitialized();
        $dir = self::get($key);
        if ($dir === null) {
            return null;
        }
        if (FajrUtils::isAbsolutePath($dir)) {
            return $dir;
        }
        // default resolve relative
        $relativeTo = FajrUtils::getProjectRootDirectory();
        $parameters = self::getParameterDescription();
        assert(array_key_exists($key, $parameters));
        $param = $parameters[$key];
        if (array_key_exists('relativeTo', $param)) {
            $relativeTo = self::getDirectory($param['relativeTo']);
        }
        return FajrUtils::joinPath($relativeTo, $dir);
    }
}
FajrConfig::load();