LocalFileConnectionSettings   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 66
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 66
ccs 0
cts 27
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 hasRootPath() 0 4 1
A getRootPath() 0 4 1
A setRootPath() 0 4 1
A getRequiredKeys() 0 4 1
1
<?php
2
3
namespace ConfigToken\ConnectionSettings\Types;
4
5
6
use ConfigToken\FileClient\Types\LocalFileClient;
7
8
class LocalFileConnectionSettings extends GenericConnectionSettings
9
{
10
    const ROOT_PATH = 'root';
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 LocalFileClient::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->hasRootPath()) {
29
            $this->setRootPath('.');
30
        }
31
    }
32
33
    /**
34
     * Check if the root path was set.
35
     *
36
     * @return boolean
37
     */
38
    public function hasRootPath()
39
    {
40
        return $this->hasParameter(self::ROOT_PATH);
41
    }
42
43
    /**
44
     * Get the root path.
45
     *
46
     * @return string|null
47
     */
48
    public function getRootPath()
49
    {
50
        return $this->getParameter(self::ROOT_PATH);
51
    }
52
53
    /**
54
     * Set the root path.
55
     *
56
     * @param string $value The new value.
57
     * @return $this
58
     */
59
    public function setRootPath($value)
60
    {
61
        return $this->setParameter(self::ROOT_PATH, $value);
62
    }
63
64
    /**
65
     * Get the required keys.
66
     *
67
     * @return array
68
     */
69
    protected static function getRequiredKeys()
70
    {
71
        return array(static::ROOT_PATH);
72
    }
73
}