Completed
Push — master ( 57b1db...16daf9 )
by Mike
03:22
created

Upgrade::__toString()   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
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Sugarcrm\UpgradeSpec\Context;
4
5
final class Upgrade
6
{
7
    /**
8
     * @var Build
9
     */
10
    private $build;
11
12
    /**
13
     * @var Target
14
     */
15
    private $target;
16
17
    /**
18
     * Upgrade constructor.
19
     *
20
     * @param $build
21
     * @param $target
22
     */
23
    public function __construct(Build $build, Target $target)
24
    {
25
        $this->build = $build;
26
        $this->target = $target;
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getBuildVersion()
33
    {
34
        return $this->build->getVersion();
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getTargetVersion()
41
    {
42
        return $this->target->getVersion();
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getBuildFlav()
49
    {
50
        return $this->build->getFlav();
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getTargetPath()
57
    {
58
        return $this->target->getSource();
59
    }
60
61
    /**
62
     * Returns possible file name for current context.
63
     *
64
     * @return string
65
     */
66
    public function asFilename()
67
    {
68
        return sprintf('upgrade_%s_to_%s', $this->build, $this->target);
69
    }
70
71
    /**
72
     * Returns Upgrade string representation.
73
     *
74
     * @return string
75
     */
76
    public function __toString()
77
    {
78
        return sprintf('%s -> %s', $this->build, $this->target);
79
    }
80
}
81