Passed
Push — master ( 864d7f...a4d677 )
by Sebastian
02:02
created

File   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 21
rs 10
ccs 4
cts 4
cp 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDirectory() 0 3 1
A isInDirectory() 0 3 1
1
<?php
2
/**
3
 * This file is part of Camino.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianFeldmann\Camino\Path;
11
12
/**
13
 * Class File
14
 *
15
 * @package SebastianFeldmann\Camino
16
 */
17
final class File extends Base
18
{
19
    /**
20
     * Returns a directory instance of its location
21
     *
22
     * @return \SebastianFeldmann\Camino\Path\Directory
23
     */
24 1
    public function getDirectory(): Directory
25
    {
26 1
        return new Directory(dirname($this->raw));
27
    }
28
29
    /**
30
     * Is the file located in a given directory
31
     *
32
     * @param  \SebastianFeldmann\Camino\Path\Directory $directory
33
     * @return bool
34
     */
35 2
    public function isInDirectory(Directory $directory): bool
36
    {
37 2
        return $this->isChildOf($directory);
38
    }
39
}
40