Passed
Push — master ( e66d23...e16cc9 )
by Mariano
02:32 queued 01:03
created

Path::absoluteOrRelativeToCodeceptionDir()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Mcustiel\Phiremock\Codeception\Extension;
4
5
use Codeception\Configuration;
6
7
class Path
8
{
9
    /** @var string */
10
    private $path;
11
12
    public function __construct(string $path)
13
    {
14
        $this->path = $path;
15
    }
16
17
    public function absoluteOrRelativeToCodeceptionDir(): string
18
    {
19
        if (substr($this->path, 0, 1) === '/') {
20
            return $this->path;
21
        }
22
        return Configuration::projectDir() . $this->path;
23
    }
24
}
25