Passed
Push — master ( 889900...85cb36 )
by Keoghan
02:57
created

Image   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 48
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 3 1
A getLocalPath() 0 3 1
A getUnVersionedName() 0 3 1
1
<?php
2
3
namespace App\Support\Images;
4
5
class Image
6
{
7
    /** @var string */
8
    protected $name;
9
10
    /** @var string|null */
11
    protected $localPath;
12
13
    /**
14
     * Image constructor.
15
     *
16
     * @param $name
17
     * @param string|null $localPath
18
     */
19 26
    public function __construct($name, $localPath = null)
20
    {
21 26
        $this->name = $name;
22 26
        $this->localPath = $localPath;
23 26
    }
24
25
    /**
26
     * Return the name for this image.
27
     *
28
     * @return string
29
     */
30 19
    public function getName()
31
    {
32 19
        return $this->name;
33
    }
34
35
    /**
36
     * Return the un-versioned name for this image.
37
     *
38
     * @return string
39
     */
40 4
    public function getUnVersionedName()
41
    {
42 4
        return str_before($this->name, ':');
43
    }
44
45
    /**
46
     * Return the local path for the image, if it is local.
47
     *
48
     * @return string|null
49
     */
50 6
    public function getLocalPath()
51
    {
52 6
        return $this->localPath;
53
    }
54
}
55