|
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 http://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
|
16 |
|
public function __construct(ReflectionProperty $info = null) |
|
87
|
|
|
{ |
|
88
|
|
|
// For internal use |
|
89
|
16 |
|
if (null === $info) |
|
90
|
16 |
|
{ |
|
91
|
|
|
return; |
|
92
|
|
|
} |
|
93
|
16 |
|
$this->name = $info->name; |
|
94
|
16 |
|
$this->methodGet = 'get' . ucfirst($this->name); |
|
95
|
16 |
|
$this->methodSet = 'set' . ucfirst($this->name); |
|
96
|
16 |
|
$this->isStatic = $info->isStatic(); |
|
97
|
16 |
|
} |
|
98
|
|
|
|
|
99
|
1 |
|
public function __get($name) |
|
100
|
|
|
{ |
|
101
|
1 |
|
return null; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
} |
|
105
|
|
|
|