* If a relative path is given in configuration, it is resolved * relative to the specified directory or project root directory * if no directory was specified * * @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) { $dir = self::get($key); if ($dir === null) { return null; } if (FajrUtils::isAbsolutePath($dir)) { return $dir; } // default resolve relative $relativeTo = dirname(__FILE__); if (!empty(self::$directoriesRelativeTo[$key])) { $relativeTo = self::getDirectory(self::$directoriesRelativeTo[$key]); } return FajrUtils::joinPath($relativeTo, $dir); } } FajrConfig::load();