Refactoring ConfigCacheLoader methods

This commit is contained in:
Philipp Holzer 2019-02-05 22:27:57 +01:00
parent 104086215c
commit 6a9d73f7d9
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
9 changed files with 56 additions and 57 deletions

View file

@ -12,23 +12,24 @@ class BasePath
* It first checks for the internal variable, then for DOCUMENT_ROOT and
* finally for PWD
*
* @param string|null $basepath
* @param string|null $basePath The default base path
* @param array $server server arguments
*
* @return string
*
* @throws \Exception if directory isn't usable
*/
public static function create($basepath)
public static function create($basePath, $server = [])
{
if (!$basepath && !empty($_SERVER['DOCUMENT_ROOT'])) {
$basepath = $_SERVER['DOCUMENT_ROOT'];
if (!$basePath && !empty($server['DOCUMENT_ROOT'])) {
$basePath = $server['DOCUMENT_ROOT'];
}
if (!$basepath && !empty($_SERVER['PWD'])) {
$basepath = $_SERVER['PWD'];
if (!$basePath && !empty($server['PWD'])) {
$basePath = $server['PWD'];
}
return self::getRealPath($basepath);
return self::getRealPath($basePath);
}
/**
@ -52,7 +53,6 @@ class BasePath
}
}
/**
* @brief Checks if a given directory is usable for the system
*