AbstractCommonStep::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
/**
3
 *  Common step for cf commands with no arguments
4
 */
5
6
namespace Graviton\Deployment\Steps\CloudFoundry;
7
8
use Graviton\Deployment\Steps\StepInterface;
9
10
/**
11
 * @author   List of contributors <https://github.com/libgraviton/deploy-scripts/graphs/contributors>
12
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
13
 * @link     http://swisscom.ch
14
 */
15
abstract class AbstractCommonStep extends AbstractStep
16
{
17
18
    /** @var string */
19
    private $slice;
20
21
    /** @var string */
22
    private $applicationName;
23
24
    /** @var string Name of the step to be registered. */
25
    protected static $stepName;
26
27
    /**
28
     *
29
     * @param array  $configuration   Current application configuration.
30
     * @param string $applicationName Name of the CF-application to be checked
31
     * @param string $slice           deployment location in blue/green deployment.
32
     *
33
     * @link http://martinfowler.com/bliki/BlueGreenDeployment.html
34
     */
35 12
    public function __construct(array $configuration, $applicationName, $slice)
36
    {
37 12
        parent::__construct($configuration);
38
39 12
        $this->slice = $slice;
40 12
        $this->applicationName = $applicationName;
41 12
    }
42
43
    /**
44
     * returns the command
45
     *
46
     * @return array
47
     */
48 7
    public function getCommand()
49
    {
50
        return array(
51 7
            $this->configuration['cf_bin'],
52 7
            static::$stepName,
53 7
            $this->applicationName . '-' . $this->slice
54 7
        );
55
    }
56
}
57