Passed
Push — master ( b3d8d2...49adaa )
by Waaaaaaaaaa
02:33
created

Path   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 88.89%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 23
ccs 8
cts 9
cp 0.8889
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 3
    public function hasPath(): bool
10
    {
11 3
        return !empty($this->path);
12
    }
13
14 1
    public function getPath(): string
15
    {
16 1
        return $this->path;
17
    }
18
19 1
    public function setPath(string $path): void
20
    {
21 1
        $realpath = realpath($path);
22
23 1
        if (false === $realpath) {
24
            throw new \InvalidArgumentException('Path does not exist: '.$path);
25
        }
26
27 1
        $this->path = $realpath . '/';
28 1
    }
29
}
30