File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,19 @@ class UseTag extends AbstractTag
14
14
protected $ y = 0 ;
15
15
protected $ width ;
16
16
protected $ height ;
17
+ protected $ instances = 0 ;
17
18
18
19
/** @var AbstractTag */
19
20
protected $ reference ;
20
21
21
22
protected function before ($ attributes )
22
23
{
24
+ $ this ->instances ++;
25
+ if ($ this ->instances > 1 ) {
26
+ //TODO: log circular reference error state
27
+ return ;
28
+ }
29
+
23
30
if (isset ($ attributes ['x ' ])) {
24
31
$ this ->x = $ attributes ['x ' ];
25
32
}
@@ -52,6 +59,9 @@ protected function before($attributes)
52
59
}
53
60
54
61
protected function after () {
62
+ if ($ this ->instances > 0 ) {
63
+ return ;
64
+ }
55
65
parent ::after ();
56
66
57
67
if ($ this ->reference ) {
@@ -63,6 +73,11 @@ protected function after() {
63
73
64
74
public function handle ($ attributes )
65
75
{
76
+ if ($ this ->instances > 1 ) {
77
+ //TODO: log circular reference error state
78
+ return ;
79
+ }
80
+
66
81
parent ::handle ($ attributes );
67
82
68
83
if (!$ this ->reference ) {
@@ -87,6 +102,11 @@ public function handle($attributes)
87
102
88
103
public function handleEnd ()
89
104
{
105
+ $ this ->instances --;
106
+ if ($ this ->instances > 0 ) {
107
+ return ;
108
+ }
109
+
90
110
parent ::handleEnd ();
91
111
92
112
if (!$ this ->reference ) {
You can’t perform that action at this time.
0 commit comments