Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 18, 2020
1 parent f371cb3 commit adfcb59
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
30 changes: 16 additions & 14 deletions src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ class Application extends Container implements ApplicationContract, CachesConfig
protected $namespace;

/**
* The prefixes of absolute paths for normalization.
* The prefixes of absolute cache paths for use during normalization.
*
* @var array
*/
protected $absolutePathPrefixes = [DIRECTORY_SEPARATOR];
protected $absoluteCachePathPrefixes = [DIRECTORY_SEPARATOR];

/**
* Create a new Illuminate application instance.
Expand Down Expand Up @@ -1017,11 +1017,24 @@ protected function normalizeCachePath($key, $default)
return $this->bootstrapPath($default);
}

return Str::startsWith($env, $this->absolutePathPrefixes)
return Str::startsWith($env, $this->absoluteCachePathPrefixes)
? $env
: $this->basePath($env);
}

/**
* Add new prefix to list of absolute path prefixes.
*
* @param string $prefix
* @return $this
*/
public function addAbsoluteCachePathPrefix($prefix)
{
$this->absoluteCachePathPrefixes[] = $prefix;

return $this;
}

/**
* Determine if the application is currently down for maintenance.
*
Expand Down Expand Up @@ -1277,15 +1290,4 @@ public function getNamespace()

throw new RuntimeException('Unable to detect application namespace.');
}

/**
* Add new prefix to list of absolute path prefixes.
*
* @param string $prefix
* @return void
*/
public function addAbsolutePathPrefix(string $prefix): void
{
$this->absolutePathPrefixes[] = $prefix;
}
}
2 changes: 1 addition & 1 deletion tests/Foundation/FoundationApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public function testEnvPathsAreUsedAndMadeAbsoluteForCachePathsWhenSpecifiedAsRe
public function testEnvPathsAreAbsoluteInWindows()
{
$app = new Application(__DIR__);
$app->addAbsolutePathPrefix('C:');
$app->addAbsoluteCachePathPrefix('C:');
$_SERVER['APP_SERVICES_CACHE'] = 'C:\framework\services.php';
$_SERVER['APP_PACKAGES_CACHE'] = 'C:\framework\packages.php';
$_SERVER['APP_CONFIG_CACHE'] = 'C:\framework\config.php';
Expand Down

0 comments on commit adfcb59

Please sign in to comment.