Passed
Pull Request — master (#284)
by Alejandro
03:49
created

ExecutionContext::currentContextIsSwoole()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 6
rs 10
c 0
b 0
f 0
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