| @@ 7-38 (lines=32) @@ | ||
| 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 | ||
| @@ 7-38 (lines=32) @@ | ||
| 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 | ||