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

File::getDirectory()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
crap 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