Test Failed
Push — master ( 5f8db2...b3d8d2 )
by Waaaaaaaaaa
02:26
created

Path   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 23
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 3 1
A hasPath() 0 3 1
A setPath() 0 9 2
1
<?php declare(strict_types=1);
2
3
namespace Logfile\Traits;
4
5
trait Path
6
{
7
    protected $path = '';
8
9
    public function hasPath(): bool
10
    {
11
        return !empty($this->path);
12
    }
13
14
    public function getPath(): string
15
    {
16
        return $this->path;
17
    }
18
19
    public function setPath(string $path): void
20
    {
21
        $realpath = realpath($path);
22
23
        if (false === $realpath) {
24
            throw new \InvalidArgumentException('Path does not exist: '.$path);
25
        }
26
27
        $this->path = $realpath . '/';
28
    }
29
}
30