LocalFileConnectionSettings::getRequiredKeys()   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 0
crap 2
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
}