Passed
Push — master ( eba56b...0dd639 )
by Sebastian
01:52
created

Resolver::getExecutable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of captainhook.
5
 *
6
 * (c) Sebastian Feldmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CaptainHook\App\Console\Runtime;
13
14
/**
15
 * Class Resolver
16
 *
17
 * @package CaptainHook\App
18
 */
19
class Resolver
20
{
21
    /**
22
     * PHAR flag, replaced by box during PHAR building
23
     *
24
     * @var string
25
     */
26
    private $runtime = '@runtime@';
27
28
    /**
29
     * Path to the currently executed 'binary'
30
     *
31
     * @var string
32
     */
33
    private $executable;
34
35
    /**
36
     * Resolver constructor.
37
     *
38
     * @param string $executable
39
     */
40
    public function __construct(string $executable = 'bin/vendor/captainhook')
41
    {
42
        $this->executable = $executable;
43
    }
44
45
    /**
46
     * Return current executed 'binary'
47
     *
48
     * @return string
49
     */
50
    public function getExecutable(): string
51
    {
52
        return $this->executable;
53
    }
54
55
    /**
56
     * Check if the current runtime is executed via PHAR
57
     *
58
     * @return bool
59
     */
60
    public function isPharRelease(): bool
61
    {
62
        return $this->runtime === 'PHAR';
63
    }
64
}
65