Passed
Push — master ( 2b8f81...145d48 )
by Gaetano
10:22 queued 05:19
created

AbstractValue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 40
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 7 2
A __isset() 0 3 1
1
<?php
2
3
namespace Kaliop\eZMigrationBundle\API\Value;
4
5
use eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException;
6
7
abstract class AbstractValue
8
{
9
    /**
10
     * Magic get function handling read to non public properties
11
     *
12
     * Returns value for all readonly (protected) properties.
13
     *
14
     * @ignore This method is for internal use
15
     * @access private
16
     *
17
     * @throws \eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException exception on all reads to undefined properties so typos are not silently accepted.
18
     *
19
     * @param string $property Name of the property
20
     *
21
     * @return mixed
22
     */
23
    public function __get($property)
24
    {
25
        if (property_exists($this, $property))
26
        {
27
            return $this->$property;
28
        }
29
        throw new PropertyNotFoundException($property, get_class($this));
30
    }
31
32
    /**
33
     * Magic isset function handling isset() to non public properties
34
     *
35
     * Returns true for all (public/)protected/private properties.
36
     *
37
     * @ignore This method is for internal use
38
     * @access private
39
     *
40
     * @param string $property Name of the property
41
     *
42
     * @return boolean
43
     */
44
    public function __isset($property)
45
    {
46
        return property_exists($this, $property);
47
    }
48
}
49