Env::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * This file is part of the Behat Environment Extension.
4
 * (c) Erik Wohllebe <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Wohlie\Behat\Environment;
11
12
use Wohlie\Behat\Environment\Resolver\Version as VersionResolver;
13
14
class Env
15
{
16
    /**
17
     * Holds the current project version.
18
     *
19
     * @var string
20
     */
21
    protected $projectVersion;
22
23
    /**
24
     * Env constructor.
25
     *
26
     * @param VersionResolver $versionResolver
27
     */
28
    public function __construct(VersionResolver $versionResolver)
29
    {
30
        $this->setProjectVersion($versionResolver->get());
31
    }
32
33
    /**
34
     * Return the current project version.
35
     *
36
     * @return string
37
     */
38
    public function getProjectVersion()
39
    {
40
        return $this->projectVersion;
41
    }
42
43
    /**
44
     * Set the given project version.
45
     *
46
     * @param string $projectVersion
47
     * @return $this
48
     */
49
    public function setProjectVersion($projectVersion)
50
    {
51
        if (!$projectVersion) {
52
            throw new \UnexpectedValueException("The project version number can't be empty.");
53
        }
54
55
        $this->projectVersion = $projectVersion;
56
        return $this;
57
    }
58
}