CachingExecutableFinder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getExecutablePath() 0 8 2
1
<?php
2
3
namespace RMiller\BehatSpec\Extension\PhpSpecRunExtension\Process;
4
5
use Symfony\Component\Process\PhpExecutableFinder;
6
7
class CachingExecutableFinder
8
{
9
    /**
10
     * @var PhpExecutableFinder
11
     */
12
    private $executableFinder;
13
14
    /**
15
     * @var null|false|string
16
     */
17
    private $executablePath;
18
19
    /**
20
     * @param PhpExecutableFinder $executableFinder
21
     */
22
    public function __construct(PhpExecutableFinder $executableFinder)
23
    {
24
        $this->executableFinder = $executableFinder;
25
    }
26
27
    /**
28
     * @return false|string
29
     */
30
    public function getExecutablePath()
31
    {
32
        if (null === $this->executablePath) {
33
            $this->executablePath = $this->executableFinder->find();
34
        }
35
36
        return $this->executablePath;
37
    }
38
}
39