StepRoute::getCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 5
Bugs 1 Features 0
Metric Value
c 5
b 1
f 0
dl 0
loc 11
ccs 8
cts 8
cp 1
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Step to log off a Cloud Foundry instance.
4
 */
5
6
namespace Graviton\Deployment\Steps\CloudFoundry;
7
8
/**
9
 * @author   List of contributors <https://github.com/libgraviton/deploy-scripts/graphs/contributors>
10
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
11
 * @link     http://swisscom.ch
12
 */
13
final class StepRoute extends AbstractStep
14
{
15
    /** @var string */
16
    private $target;
17
18
    /** @var string */
19
    private $map;
20
21
    /**
22
     * @var string
23
     */
24
    private $applicationName;
25
26
    /** @var string  */
27
    private $hostname;
28
29
    /**
30
     *
31
     * @param array  $configuration   Current application configuration.
32
     * @param string $applicationName Name of the CF-application to be checked
33
     * @param string $targetName      Name of the target (deploy or old)
34
     * @param string $subdomain       Used a the subdomain for the application route.
35
     * @param string $map             Art of the map (map or unmap)
36
     */
37 7
    public function __construct(array $configuration, $applicationName, $targetName, $subdomain, $map)
38
    {
39 7
        parent::__construct($configuration);
40
41 7
        $this->applicationName = $applicationName;
42 7
        $this->target = $targetName;
43 7
        $this->hostname = $subdomain;
44 7
        $this->map = $map;
45 7
    }
46
47
    /**
48
     * returns the command
49
     *
50
     * @return array
51
     */
52 4
    public function getCommand()
53
    {
54
        return array(
55 4
            $this->configuration['cf_bin'],
56 4
            $this->map . '-route',
57 4
            $this->target,
58 4
            $this->configuration['cf_domain'],
59 4
            '-n',
60 4
            $this->hostname,
61 4
        );
62
    }
63
}
64