Completed
Pull Request — master (#284)
by Alejandro
19:10 queued 09:10
created

ExecutionContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 8
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A currentContextIsSwoole() 0 3 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\Common\Exec;
5
6
use const PHP_SAPI;
7
use function Shlinkio\Shlink\Common\env;
8
9
abstract class ExecutionContext
10
{
11
    public const WEB = 'shlink_web';
12
    public const CLI = 'shlink_cli';
13
14
    public static function currentContextIsSwoole(): bool
15
    {
16
        return PHP_SAPI === 'cli' && env('CURRENT_SHLINK_CONTEXT', self::WEB) === self::WEB;
17
    }
18
}
19