Passed
Push — master ( 8d5c1a...e21dd3 )
by Pol
02:37
created

Filesystem::pwd()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace drupol\phpvfs\Filesystem;
6
7
use drupol\phpvfs\Node\DirectoryInterface;
8
use drupol\phpvfs\Node\FilesystemNodeInterface;
9
10
/**
11
 * Class Filesystem.
12
 */
13
class Filesystem implements FilesystemInterface
14
{
15
    /**
16
     * @var \drupol\phpvfs\Node\DirectoryInterface
17
     */
18
    private $cwd;
19
20
    /**
21
     * Filesystem constructor.
22
     *
23
     * @param \drupol\phpvfs\Node\DirectoryInterface $directory
24
     */
25 16
    public function __construct(DirectoryInterface $directory)
26
    {
27 16
        $this->cwd = $directory;
28 16
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33 14
    public function getCwd(): DirectoryInterface
34
    {
35 14
        return $this->cwd;
36
    }
37
38
    /**
39
     * @return string
40
     */
41 4
    public function pwd(): string
42
    {
43 4
        return $this->getCwd()->getPath()->__toString();
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49 2
    public function root(): FilesystemNodeInterface
50
    {
51 2
        return $this->getCwd()->root();
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 2
    public function setCwd(DirectoryInterface $dir)
58
    {
59 2
        $this->cwd = $dir;
60
61 2
        return $this;
62
    }
63
}
64