PhpBinValue   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 10
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 12 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\VariableResolver\Variable\Value;
6
7
use Symfony\Component\Process\PhpExecutableFinder;
8
9
final class PhpBinValue implements ValueInterface
10
{
11
    private ?string $value = null;
12
13
    public function getValue(): string
14
    {
15
        if (null === $this->value) {
16
            $phpBin = (new PhpExecutableFinder())->find();
17
            if (false === $phpBin) {
18
                throw new \RuntimeException('A PHP binary could not be found'); // todo better exception
19
            }
20
21
            $this->value = $phpBin;
22
        }
23
24
        return $this->value;
25
    }
26
}
27