Completed
Push — master ( 5f4179...916f6e )
by Richard
11s
created

CachingExecutableFinder::getExecutablePath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace RMiller\BehatSpec\Extension\PhpSpecRunExtension\Process;
4
5
use Symfony\Component\Process\PhpExecutableFinder;
6
7 View Code Duplication
class CachingExecutableFinder
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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