Server::getPassword()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Onigoetz\Deployer\Configuration;
4
5
use Onigoetz\Deployer\Configuration\Containers\ConfigurationContainer;
6
7
class Server extends ConfigurationContainer
8
{
9
    public static $defaultPassword = null;
10
11 27
    public function getHost()
12
    {
13 27
        return $this->getValueOrFail('host', "no 'host' specified in server '{$this->name}'");
14
    }
15
16 24
    public function getUsername()
17
    {
18 24
        return $this->getValueOrFail('username', "no 'username' specified in server '{$this->name}'");
19
    }
20
21 6
    public function getPassword()
22
    {
23 6
        return $this->getValueOrDefault('password', self::$defaultPassword);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29 21
    public function checkValidity()
30
    {
31 21
        $this->getHost();
32 18
        $this->getUsername();
33
34 12
        return true;
35
    }
36
}
37