Skip to content

Commit

Permalink
Speed up runningInConsole method
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Dec 24, 2019
1 parent f0a7c3c commit 61a4c49
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,13 @@ public function detectEnvironment(Closure $callback)
*/
public function runningInConsole()
{
if (Env::get('APP_RUNNING_IN_CONSOLE') !== null) {
return Env::get('APP_RUNNING_IN_CONSOLE') === true;
$inConsole = Env::get('APP_RUNNING_IN_CONSOLE');

if ($inConsole !== null) {
return $inConsole === true;
}

return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg';
return PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg';
}

/**
Expand Down

0 comments on commit 61a4c49

Please sign in to comment.