Failed Conditions
Push — master ( e87576...01797b )
by Chad
9s
created

MagicPropertyDisabledTrait::__get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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