OutputFile   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 34
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 3
A isEmpty() 0 4 1
A getFilePath() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Paraunit\Configuration;
6
7
/**
8
 * Class OutputFile
9
 * @package Paraunit\Configuration
10
 */
11
class OutputFile
12
{
13
    /** @var string */
14
    private $filePath;
15
16
    /**
17
     * OutputPath constructor.
18
     * @param string $filePath
19
     */
20 19
    public function __construct($filePath)
21
    {
22 19
        if (is_string($filePath) && $filePath !== '') {
23 15
            $this->filePath = $filePath;
24
        }
25
    }
26
27 13
    public function isEmpty(): bool
28
    {
29 13
        return $this->filePath === null;
30
    }
31
32
    /**
33
     * @return string
34
     * @throws \RuntimeException
35
     */
36 13
    public function getFilePath(): string
37
    {
38 13
        if ($this->isEmpty()) {
39 3
            throw new \RuntimeException('Program requested an empty file path');
40
        }
41
42 10
        return $this->filePath;
43
    }
44
}
45