MagicPropertyDisabledTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 4 1
A __set() 0 4 1
1
<?php
2
3
namespace SubjectivePHP\Spl\Traits;
4
5
use BadMethodCallException;
6
7
trait MagicPropertyDisabledTrait
8
{
9
    /**
10
     * Access an internal array element as a property
11
     *
12
     * @param string $name The name of class the property.
13
     *
14
     * @return void
15
     *
16
     * @throws BadMethodCallException Always thrown
17
     */
18
    public function __get(string $name)
19
    {
20
        throw new BadMethodCallException('dynamic properties are disabled in this class');
21
    }
22
23
    /**
24
     * Set an internal array element as a property
25
     *
26
     * @param string $name  The name of class the property.
27
     * @param mixed  $value The class property value.
28
     *
29
     * @return void
30
     *
31
     * @throws BadMethodCallException Always thrown
32
     */
33
    public function __set(string $name, $value)
34
    {
35
        throw new BadMethodCallException('dynamic properties are disabled in this class');
36
    }
37
}
38