LocalGitRepoConnectionSettings   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 2
dl 0
loc 68
ccs 0
cts 29
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getServerType() 0 4 1
A __construct() 0 7 2
A hasGitExecutable() 0 4 1
A getGitExecutable() 0 4 1
A setGitExecutable() 0 4 1
A getRequiredKeys() 0 6 1
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
}