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

Image::__get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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 2
14
    /** @var string|null */
15 2
    protected $localPath;
16 2
17 2
    public function __construct($name, $localPath = null)
18
    {
19 2
        $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
        $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 2
    }
22
23
    public function __get($name)
24
    {
25
        return $this->{$name} ?? null;
26
    }
27
28
    public function __set($name, $value)
29
    {
30
        throw new \RuntimeException("Cannot set the value of {$name}");
31
    }
32
}
33