CachingExecutableFinder::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace RMiller\BehatSpec\Extension\PhpSpecExtension\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