|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* \AppserverIo\Doppelgaenger\Entities\Aspect |
|
5
|
|
|
* |
|
6
|
|
|
* NOTICE OF LICENSE |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
|
9
|
|
|
* that is available through the world-wide-web at this URL: |
|
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
|
11
|
|
|
* |
|
12
|
|
|
* PHP version 5 |
|
13
|
|
|
* |
|
14
|
|
|
* @author Bernhard Wick <[email protected]> |
|
15
|
|
|
* @copyright 2015 TechDivision GmbH - <[email protected]> |
|
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
17
|
|
|
* @link https://github.com/appserver-io/doppelgaenger |
|
18
|
|
|
* @link http://www.appserver.io/ |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace AppserverIo\Doppelgaenger\Entities\Definitions; |
|
22
|
|
|
|
|
23
|
|
|
use AppserverIo\Doppelgaenger\Entities\Lists\TypedList; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Class which represents the definition of an aspect as an annotated class definition. |
|
27
|
|
|
* Will only contain the needed parts of the definition |
|
28
|
|
|
* |
|
29
|
|
|
* @author Bernhard Wick <[email protected]> |
|
30
|
|
|
* @copyright 2015 TechDivision GmbH - <[email protected]> |
|
31
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
|
32
|
|
|
* @link https://github.com/appserver-io/doppelgaenger |
|
33
|
|
|
* @link http://www.appserver.io/ |
|
34
|
|
|
* |
|
35
|
|
|
* @property \AppserverIo\Doppelgaenger\Entities\Lists\TypedList $advices List of advices |
|
36
|
|
|
* @property string $name Name of the aspect |
|
37
|
|
|
* @property string $namespace Namespace of this aspect definition |
|
38
|
|
|
* @property \AppserverIo\Doppelgaenger\Entities\Lists\TypedList $pointcuts List of pointcut definitions |
|
39
|
|
|
*/ |
|
40
|
|
|
class Aspect |
|
41
|
|
|
{ |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* List of advices (\AppserverIo\Doppelgaenger\Entities\Definitions\Advice) which are defined within |
|
45
|
|
|
* the aspect definition |
|
46
|
|
|
* |
|
47
|
|
|
* @var \AppserverIo\Doppelgaenger\Entities\Lists\TypedList $advices |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $advices; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Name of the aspect |
|
53
|
|
|
* |
|
54
|
|
|
* @var string $name |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $name; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Namespace of this aspect definition |
|
60
|
|
|
* |
|
61
|
|
|
* @var string $namespace |
|
62
|
|
|
*/ |
|
63
|
|
|
protected $namespace; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* List of pointcut definitions (\AppserverIo\Doppelgaenger\Entities\Definitions\Pointcut) which are defined within |
|
67
|
|
|
* the code of this aspect |
|
68
|
|
|
* |
|
69
|
|
|
* @var \AppserverIo\Doppelgaenger\Entities\Lists\TypedList $pointcuts |
|
70
|
|
|
*/ |
|
71
|
|
|
protected $pointcuts; |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Default constructor |
|
75
|
|
|
*/ |
|
76
|
|
|
public function __construct() |
|
77
|
|
|
{ |
|
78
|
|
|
$this->pointcuts = new TypedList('\AppserverIo\Doppelgaenger\Entities\Definitions\Pointcut', 'name'); |
|
79
|
|
|
$this->advices = new TypedList('\AppserverIo\Doppelgaenger\Entities\Definitions\Advice', 'name'); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Getter for the $advices property |
|
84
|
|
|
* |
|
85
|
|
|
* @return \AppserverIo\Doppelgaenger\Entities\Lists\TypedList |
|
86
|
|
|
*/ |
|
87
|
|
|
public function getAdvices() |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->advices; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* Getter for the $name property |
|
94
|
|
|
* |
|
95
|
|
|
* @return string |
|
96
|
|
|
*/ |
|
97
|
|
|
public function getName() |
|
98
|
|
|
{ |
|
99
|
|
|
return $this->name; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Getter for the $namespace property |
|
104
|
|
|
* |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getNamespace() |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->namespace; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Getter for the $pointcuts property |
|
114
|
|
|
* |
|
115
|
|
|
* @return \AppserverIo\Doppelgaenger\Entities\Lists\TypedList |
|
116
|
|
|
*/ |
|
117
|
|
|
public function getPointcuts() |
|
118
|
|
|
{ |
|
119
|
|
|
return $this->pointcuts; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* Will return the qualified name of a structure |
|
124
|
|
|
* |
|
125
|
|
|
* @return string |
|
126
|
|
|
*/ |
|
127
|
|
View Code Duplication |
public function getQualifiedName() |
|
128
|
|
|
{ |
|
129
|
|
|
if (empty($this->namespace)) { |
|
130
|
|
|
return $this->name; |
|
131
|
|
|
|
|
|
|
|
|
|
132
|
|
|
} else { |
|
133
|
|
|
return $this->namespace . '\\' . $this->name; |
|
134
|
|
|
} |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* Setter for the $name property |
|
139
|
|
|
* |
|
140
|
|
|
* @param string $name Name of the aspect |
|
141
|
|
|
* |
|
142
|
|
|
* @return null |
|
143
|
|
|
*/ |
|
144
|
|
|
public function setName($name) |
|
145
|
|
|
{ |
|
146
|
|
|
$this->name = $name; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Setter for the $namespace property |
|
151
|
|
|
* |
|
152
|
|
|
* @param string $namespace Namespace of this aspect definition |
|
153
|
|
|
* |
|
154
|
|
|
* @return null |
|
155
|
|
|
*/ |
|
156
|
|
|
public function setNamespace($namespace) |
|
157
|
|
|
{ |
|
158
|
|
|
$this->namespace = $namespace; |
|
159
|
|
|
} |
|
160
|
|
|
} |
|
161
|
|
|
|