OutputPath::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Paraunit\Configuration;
6
7
/**
8
 * Class OutputPath
9
 * @package Paraunit\Configuration
10
 */
11
class OutputPath
12
{
13
    /** @var string */
14
    private $path;
15
16
    /**
17
     * OutputPath constructor.
18
     * @param string $path
19
     */
20 6
    public function __construct(string $path)
21
    {
22 6
        if ($path === '') {
23 1
            throw new \InvalidArgumentException('Empty path provided: not valid');
24
        }
25
26 5
        $this->path = $path;
27
    }
28
29
    public function isEmpty(): bool
30
    {
31
        return $this->path === null;
32
    }
33
34
    /**
35
     * @return string
36
     * @throws \RuntimeException
37
     */
38 3
    public function getPath(): string
39
    {
40 3
        return $this->path;
41
    }
42
}
43