Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 6, 2019
1 parent 7227083 commit ac9dbf6
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ public function shouldSkipMiddleware()
*/
public function getCachedServicesPath()
{
return $this->normalizeCachePath('cache/services.php', 'APP_SERVICES_CACHE');
return $this->normalizeCachePath('APP_SERVICES_CACHE', 'cache/services.php');
}

/**
Expand All @@ -904,7 +904,7 @@ public function getCachedServicesPath()
*/
public function getCachedPackagesPath()
{
return $this->normalizeCachePath('cache/packages.php', 'APP_PACKAGES_CACHE');
return $this->normalizeCachePath('APP_PACKAGES_CACHE', 'cache/packages.php');
}

/**
Expand All @@ -924,7 +924,7 @@ public function configurationIsCached()
*/
public function getCachedConfigPath()
{
return $this->normalizeCachePath('cache/config.php', 'APP_CONFIG_CACHE');
return $this->normalizeCachePath('APP_CONFIG_CACHE', 'cache/config.php');
}

/**
Expand All @@ -944,7 +944,7 @@ public function routesAreCached()
*/
public function getCachedRoutesPath()
{
return $this->normalizeCachePath('cache/routes.php', 'APP_ROUTES_CACHE');
return $this->normalizeCachePath('APP_ROUTES_CACHE', 'cache/routes.php');
}

/**
Expand All @@ -964,29 +964,25 @@ public function eventsAreCached()
*/
public function getCachedEventsPath()
{
return $this->normalizeCachePath('cache/events.php', 'APP_EVENTS_CACHE');
return $this->normalizeCachePath('APP_EVENTS_CACHE', 'cache/events.php');
}

/**
* Normalize a relative or absolute path to a cache file.
*
* @param string $path
* @param string $key
* @param string $default
* @return string
*/
protected function normalizeCachePath($path, $key)
protected function normalizeCachePath($key, $default)
{
$env = Env::get($key);

if ($env === null) {
return $this->bootstrapPath($path);
}

if (Str::startsWith($env, '/')) {
return $env;
if (is_null($env = Env::get($key))) {
return $this->bootstrapPath($default);
}

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

/**
Expand Down

0 comments on commit ac9dbf6

Please sign in to comment.