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 Maslosoft\Addendum\Traits\MetaState; |
19
|
|
|
use ReflectionProperty; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Container for metadata generated by property annotations |
23
|
|
|
* |
24
|
|
|
* @author Piotr |
25
|
|
|
*/ |
26
|
|
|
class MetaProperty implements AnnotationEntityInterface |
27
|
|
|
{ |
28
|
|
|
|
29
|
|
|
use MetaState; |
30
|
|
|
|
31
|
|
|
// <editor-fold defaultstate="collapsed" desc="Access Control"> |
32
|
|
|
/** |
33
|
|
|
* Indicates if field has getter |
34
|
|
|
* @var bool |
35
|
|
|
*/ |
36
|
|
|
public $callGet = false; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Indicates if field has setter |
40
|
|
|
* @var bool |
41
|
|
|
*/ |
42
|
|
|
public $callSet = false; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Indicates if field has either getter or setter |
46
|
|
|
* @var bool |
47
|
|
|
*/ |
48
|
|
|
public $direct = false; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Getter method name |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
public $methodGet = ''; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Setter method name |
58
|
|
|
* @var string |
59
|
|
|
*/ |
60
|
|
|
public $methodSet = ''; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* True if property is static |
64
|
|
|
* @var bool |
65
|
|
|
*/ |
66
|
|
|
public $isStatic = false; |
67
|
|
|
// </editor-fold> |
68
|
|
|
// <editor-fold defaultstate="collapsed" desc="Default value and property name"> |
69
|
|
|
/** |
70
|
|
|
* Default value of field as defined in class declaration |
71
|
|
|
* @var mixed |
72
|
|
|
*/ |
73
|
|
|
public $default = null; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Name of a field |
77
|
|
|
* @var string |
78
|
|
|
*/ |
79
|
|
|
public $name = ''; |
80
|
|
|
|
81
|
|
|
// </editor-fold> |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Class constructor, sets some basic data for field |
85
|
|
|
* @param ReflectionProperty $info |
86
|
|
|
*/ |
87
|
17 |
|
public function __construct(ReflectionProperty $info = null) |
88
|
|
|
{ |
89
|
|
|
// For internal use |
90
|
17 |
|
if (null === $info) |
91
|
|
|
{ |
92
|
|
|
return; |
93
|
|
|
} |
94
|
17 |
|
$this->name = $info->name; |
95
|
17 |
|
$this->methodGet = 'get' . ucfirst($this->name); |
96
|
17 |
|
$this->methodSet = 'set' . ucfirst($this->name); |
97
|
17 |
|
$this->isStatic = $info->isStatic(); |
98
|
17 |
|
} |
99
|
|
|
|
100
|
|
|
public function __get($name) |
101
|
|
|
{ |
102
|
|
|
return null; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
} |
106
|
|
|
|