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

AbstractValue::__isset()   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
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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