Completed
Push — master ( 16daf9...8a3ba8 )
by Mike
03:45
created

Upgrade::getTargetFlav()   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\Context;
4
5
use Sugarcrm\UpgradeSpec\Version\Version;
6
7
final class Upgrade
8
{
9
    /**
10
     * @var Build
11
     */
12
    private $build;
13
14
    /**
15
     * @var Target
16
     */
17
    private $target;
18
19
    /**
20
     * Upgrade constructor.
21
     *
22
     * @param $build
23
     * @param $target
24
     */
25
    public function __construct(Build $build, Target $target)
26
    {
27
        $this->build = $build;
28
        $this->target = $target;
29
    }
30
31
    /**
32
     * @return Version
0 ignored issues
show
Documentation introduced by
Should the return type not be string?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
33
     */
34
    public function getBuildVersion()
35
    {
36
        return $this->build->getVersion();
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getBuildFlav()
43
    {
44
        return $this->build->getFlav();
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getBuildPath()
51
    {
52
        return $this->build->getSource();
53
    }
54
55
    /**
56
     * @return Version
0 ignored issues
show
Documentation introduced by
Should the return type not be string?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
57
     */
58
    public function getTargetVersion()
59
    {
60
        return $this->target->getVersion();
61
    }
62
63
    /**
64
     * @return string
65
     */
66
    public function getTargetFlav()
67
    {
68
        return $this->target->getFlav();
69
    }
70
71
    /**
72
     * @return string
73
     */
74
    public function getTargetPath()
75
    {
76
        return $this->target->getSource();
77
    }
78
79
    /**
80
     * Returns possible file name for current context.
81
     *
82
     * @return string
83
     */
84
    public function asFilename()
85
    {
86
        return sprintf('upgrade_%s_to_%s', $this->build, $this->target);
87
    }
88
89
    /**
90
     * Returns Upgrade string representation.
91
     *
92
     * @return string
93
     */
94
    public function __toString()
95
    {
96
        return sprintf('%s -> %s', $this->build, $this->target);
97
    }
98
}
99