AbstractImmutable   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __set() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Keppler\Url\Scheme\Schemes;
5
6
use Keppler\Url\Exceptions\ImmutableException;
7
8
/**
9
 * Not truly immutable since reflection is always an option
10
 *
11
 * Class AbstractImmutable
12
 *
13
 * @package Keppler\Url\Scheme\Schemes
14
 */
15
class AbstractImmutable
16
{
17
    /**
18
     * Don't __set my stuff you heathen!
19
     *
20
     * This is here mostly because somebody may make a mistake and do something like $immutable->unexistingProperty = something
21
     * which would actually work without throwing an error if the bellow wouldn't throw one
22
     *
23
     * @param $key
24
     * @param $value
25
     *
26
     * @throws ImmutableException
27
     */
28
    public function __set($key, $value)
29
    {
30
        throw new ImmutableException(sprintf('Immutable class %s cannot be changed', __CLASS__));
31
    }
32
}