Completed
Push — master ( 9226b3...e0bc2b )
by Mike
08:41
created

Context::getPackagesPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Sugarcrm\UpgradeSpec\Spec;
4
5
final class Context
6
{
7
    /**
8
     * @var string
9
     */
10
    private $buildVersion;
11
12
    /**
13
     * @var string
14
     */
15
    private $upgradeVersion;
16
17
    /**
18
     * @var string
19
     */
20
    private $flav;
21
22
    /**
23
     * @var string
24
     */
25
    private $packagesPath;
26
27
    /**
28
     * Context constructor.
29
     *
30
     * @param $buildVersion
31
     * @param $upgradeVersion
32
     * @param $flav
33
     * @param string $packagesPath
34
     */
35
    public function __construct($buildVersion, $upgradeVersion, $flav, $packagesPath = '')
36
    {
37
        $this->buildVersion = $buildVersion;
38
        $this->upgradeVersion = $upgradeVersion;
39
        $this->flav = $flav;
40
        $this->packagesPath = $packagesPath;
41
    }
42
43
    /**
44
     * Returns Context string representation.
45
     *
46
     * @return string
47
     */
48
    public function __toString()
49
    {
50
        return sprintf('%s -> %s (%s)', $this->buildVersion, $this->upgradeVersion, $this->flav);
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getBuildVersion()
57
    {
58
        return $this->buildVersion;
59
    }
60
61
    /**
62
     * @return string
63
     */
64
    public function getUpgradeVersion()
65
    {
66
        return $this->upgradeVersion;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getFlav()
73
    {
74
        return $this->flav;
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getPackagesPath()
81
    {
82
        return $this->packagesPath;
83
    }
84
85
    /**
86
     * Returns possible file name for current context.
87
     *
88
     * @return string
89
     */
90
    public function asFilename()
91
    {
92
        return sprintf('upgrade_%s_to_%s_%s', $this->buildVersion, $this->upgradeVersion, $this->flav);
93
    }
94
}
95