Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Spatie\FlareClient\Context;
4
 
5
class BaseContextProviderDetector implements ContextProviderDetector
6
{
7
    public function detectCurrentContext(): ContextProvider
8
    {
9
        if ($this->runningInConsole()) {
10
            return new ConsoleContextProvider($_SERVER['argv'] ?? []);
11
        }
12
 
13
        return new RequestContextProvider();
14
    }
15
 
16
    protected function runningInConsole(): bool
17
    {
18
        if (isset($_ENV['APP_RUNNING_IN_CONSOLE'])) {
19
            return $_ENV['APP_RUNNING_IN_CONSOLE'] === 'true';
20
        }
21
 
22
        if (isset($_ENV['FLARE_FAKE_WEB_REQUEST'])) {
23
            return false;
24
        }
25
 
26
        return in_array(php_sapi_name(), ['cli', 'phpdb']);
27
    }
28
}