LocalGitRepoConnectionSettings::setGitExecutable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace ConfigToken\ConnectionSettings\Types;
4
5
6
use ConfigToken\FileClient\Types\LocalGitRepoClient;
7
8
class LocalGitRepoConnectionSettings extends GitRepoConnectionSettings
9
{
10
    const GIT_EXECUTABLE = 'git';
11
12
    /**
13
     * Get the file server type identifier corresponding to the client's implementation.
14
     *
15
     * @return string|null If fallback class for all server types.
16
     */
17
    public static function getServerType()
18
    {
19
        return LocalGitRepoClient::getServerType();
20
    }
21
22
    /**
23
     * @param array|null $parameters
24
     */
25
    public function __construct(array $parameters = null)
26
    {
27
        parent::__construct($parameters);
28
        if (!$this->hasGitExecutable()) {
29
            $this->setGitExecutable('git');
30
        }
31
    }
32
33
    /**
34
     * Check if the Git executable path was set.
35
     *
36
     * @return boolean
37
     */
38
    public function hasGitExecutable()
39
    {
40
        return $this->hasParameter(self::GIT_EXECUTABLE);
41
    }
42
43
    /**
44
     * Get the Git executable path.
45
     *
46
     * @return string|null
47
     */
48
    public function getGitExecutable()
49
    {
50
        return $this->getParameter(self::GIT_EXECUTABLE);
51
    }
52
53
    /**
54
     * Set the Git executable path.
55
     *
56
     * @param string $value The new value.
57
     * @return $this
58
     */
59
    public function setGitExecutable($value)
60
    {
61
        return $this->setParameter(self::GIT_EXECUTABLE, $value);
62
    }
63
64
    /**
65
     * Get the required keys.
66
     *
67
     * @return array
68
     */
69
    protected static function getRequiredKeys()
70
    {
71
        $result = parent::getRequiredKeys();
72
        $result[] = static::GIT_EXECUTABLE;
73
        return $result;
74
    }
75
}