Completed
Push — master ( 7d8097...8a93d3 )
by Peter
06:00 queued 01:01
created

MetaProperty::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2.0054

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 12
ccs 8
cts 9
cp 0.8889
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
crap 2.0054
1
<?php
2
3
/**
4
 * This software package is licensed under AGPL, Commercial license.
5
 *
6
 * @package maslosoft/addendum
7
 * @licence AGPL, Commercial
8
 * @copyright Copyright (c) Piotr Masełkowski <[email protected]> (Meta container, further improvements, bugfixes)
9
 * @copyright Copyright (c) Maslosoft (Meta container, further improvements, bugfixes)
10
 * @copyright Copyright (c) Jan Suchal (Original version, builder, parser)
11
 * @link https://maslosoft.com/addendum/ - maslosoft addendum
12
 * @link https://code.google.com/p/addendum/ - original addendum project
13
 */
14
15
namespace Maslosoft\Addendum\Collections;
16
17
use Maslosoft\Addendum\Interfaces\AnnotationEntityInterface;
18
use ReflectionProperty;
19
20
/**
21
 * Container for metadata generated by property annotations
22
 *
23
 * @author Piotr
24
 */
25
class MetaProperty implements AnnotationEntityInterface
26
{
27
28
	use \Maslosoft\Addendum\Traits\MetaState;
29
30
// <editor-fold defaultstate="collapsed" desc="Access Control">
31
	/**
32
	 * Indicates if field has getter
33
	 * @var bool
34
	 */
35
	public $callGet = false;
36
37
	/**
38
	 * Indicates if field has setter
39
	 * @var bool
40
	 */
41
	public $callSet = false;
42
43
	/**
44
	 * Indicates if field has either getter or setter
45
	 * @var bool
46
	 */
47
	public $direct = false;
48
49
	/**
50
	 * Getter method name
51
	 * @var string
52
	 */
53
	public $methodGet = '';
54
55
	/**
56
	 * Setter method name
57
	 * @var string
58
	 */
59
	public $methodSet = '';
60
61
	/**
62
	 * True if property is static
63
	 * @var bool
64
	 */
65
	public $isStatic = false;
66
// </editor-fold>
67
// <editor-fold defaultstate="collapsed" desc="Default value and property name">
68
	/**
69
	 * Default value of field as defined in class declaration
70
	 * @var mixed
71
	 */
72
	public $default = null;
73
74
	/**
75
	 * Name of a field
76
	 * @var string
77
	 */
78
	public $name = '';
79
80
// </editor-fold>
81
82
	/**
83
	 * Class constructor, sets some basic data for field
84
	 * @param ReflectionProperty $info
85
	 */
86 17
	public function __construct(ReflectionProperty $info = null)
87
	{
88
		// For internal use
89 17
		if (null === $info)
90 17
		{
91
			return;
92
		}
93 17
		$this->name = $info->name;
94 17
		$this->methodGet = 'get' . ucfirst($this->name);
95 17
		$this->methodSet = 'set' . ucfirst($this->name);
96 17
		$this->isStatic = $info->isStatic();
97 17
	}
98
99 1
	public function __get($name)
100
	{
101 1
		return null;
102
	}
103
104
}
105