Completed
Push — master ( b30e53...9fbf6c )
by Victor
01:55
created

FileLocation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 55.56%

Importance

Changes 6
Bugs 1 Features 2
Metric Value
wmc 4
c 6
b 1
f 2
lcom 1
cbo 1
dl 0
loc 39
ccs 5
cts 9
cp 0.5556
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getValue() 0 4 1
A getFileDirectory() 0 4 1
A isWritable() 0 4 1
1
<?php
2
/**
3
 * Created with PHP 5.6 generator
4
 * User: 
5
 * PHP 5.6 generator created by Victor MECH - April 2016
6
*/
7
8
namespace LazyEight\DiTesto\ValueObject;
9
10
11
use LazyEight\BasicTypes\Interfaces\ValueObjectInterface;
12
use LazyEight\BasicTypes\Stringy;
13
14
class FileLocation implements ValueObjectInterface
15
{
16
    /**
17
     * @var Stringy
18
     */
19
    private $location;
20
    
21
    /**
22
     * @param Stringy $location
23
     */
24 2
    public function __construct(Stringy $location)
25
    {
26 2
        $this->location = $location;
27 2
    }
28
29
    /**
30
     * @inheritDoc
31
     */
32 2
    public function getValue()
33
    {
34 2
        return clone $this->location;
35
    }
36
37
    /**
38
     * @return Stringy
39
     */
40
    public function getFileDirectory()
41
    {
42
        return $this->location->substring(0, $this->location->lastIndexOf("/"));
43
    }
44
45
    /**
46
     * @return bool
47
     */
48
    public function isWritable()
49
    {
50
        return is_writable($this->location->getValue());
51
    }
52
}
53