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 61ea9fc commit f6bfa7c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Illuminate/Foundation/Application.php
Expand Up @@ -551,11 +551,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 f6bfa7c

Please sign in to comment.