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

Image::getUnVersionedName()   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
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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