Image::getName()   A
last analyzed

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
use Illuminate\Support\Str;
6
7
class Image
8
{
9
    /** @var string */
10
    protected $name;
11
12
    /** @var string|null */
13
    protected $localPath;
14
15
    /**
16
     * Image constructor.
17
     *
18
     * @param $name
19
     * @param string|null $localPath
20
     */
21 34
    public function __construct($name, $localPath = null)
22
    {
23 34
        $this->name = $name;
24 34
        $this->localPath = $localPath;
25
    }
26
27
    /**
28
     * Return the name for this image.
29
     *
30
     * @return string
31
     */
32 27
    public function getName()
33
    {
34 27
        return $this->name;
35
    }
36
37
    /**
38
     * Return the un-versioned name for this image.
39
     *
40
     * @return string
41
     */
42 5
    public function getUnVersionedName()
43
    {
44 5
        return Str::before($this->name, ':');
45
    }
46
47
    /**
48
     * Return the local path for the image, if it is local.
49
     *
50
     * @return string|null
51
     */
52 7
    public function getLocalPath()
53
    {
54 7
        return $this->localPath;
55
    }
56
}
57