Test Failed
Pull Request — master (#31)
by Keoghan
03:12
created

Image::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace App\Support\Images;
4
5
/**
6
 * @property-read string $name
7
 * @property-read string|null $localPath
8
 */
9
class Image
10
{
11
    /** @var string */
12
    protected $name;
13
14
    /** @var string|null */
15
    protected $localPath;
16
17 11
    public function __construct($name, $localPath = null)
18
    {
19 11
        $this->name = $name;
0 ignored issues
show
Bug introduced by
The property name is declared read-only in App\Support\Images\Image.
Loading history...
20 11
        $this->localPath = $localPath;
0 ignored issues
show
Bug introduced by
The property localPath is declared read-only in App\Support\Images\Image.
Loading history...
21 11
    }
22
23 7
    public function __get($name)
24
    {
25 7
        return $this->{$name} ?? null;
26
    }
27
28 2
    public function __set($name, $value)
29
    {
30 2
        throw new \RuntimeException("Cannot set the value of {$name}");
31
    }
32
}
33