Image   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getLocalPath() 0 3 1
A __construct() 0 4 1
A getName() 0 3 1
A getUnVersionedName() 0 3 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