@@ -59,20 +59,20 @@ discard block |
||
59 | 59 | strpos($node->content, self::PHP_MACRO_FUNCTION) === false |
60 | 60 | && strpos($node->content, self::PHP_MARCO_EXISTS_FUNCTION) === false |
61 | 61 | ) |
62 | - ) { |
|
62 | + ){ |
|
63 | 63 | return null; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $php = new PHPMixin($node->tokens, self::PHP_MACRO_FUNCTION); |
67 | - foreach ($this->blocks->getNames() as $name) { |
|
67 | + foreach ($this->blocks->getNames() as $name){ |
|
68 | 68 | $block = $this->blocks->get($name); |
69 | 69 | |
70 | - if ($this->isReference($block)) { |
|
70 | + if ($this->isReference($block)){ |
|
71 | 71 | // resolved on later stage |
72 | 72 | continue; |
73 | 73 | } |
74 | 74 | |
75 | - if ($php->has($name)) { |
|
75 | + if ($php->has($name)){ |
|
76 | 76 | $php->set($name, $this->trimPHP($this->blocks->claim($name))); |
77 | 77 | } |
78 | 78 | } |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | $node->tokens = token_get_all($node->content); |
82 | 82 | |
83 | 83 | $exists = new PHPMixin($node->tokens, self::PHP_MARCO_EXISTS_FUNCTION); |
84 | - foreach ($this->blocks->getNames() as $name) { |
|
84 | + foreach ($this->blocks->getNames() as $name){ |
|
85 | 85 | $block = $this->blocks->get($name); |
86 | 86 | |
87 | - if ($this->isReference($block)) { |
|
87 | + if ($this->isReference($block)){ |
|
88 | 88 | // resolved on later stage |
89 | 89 | continue; |
90 | 90 | } |
91 | 91 | |
92 | - if ($exists->has($name)) { |
|
92 | + if ($exists->has($name)){ |
|
93 | 93 | $exists->set($name, 'true'); |
94 | 94 | } |
95 | 95 | } |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | */ |
112 | 112 | private function isReference($node): bool |
113 | 113 | { |
114 | - switch (true) { |
|
114 | + switch (true){ |
|
115 | 115 | case is_array($node): |
116 | - foreach ($node as $child) { |
|
117 | - if ($this->isReference($child)) { |
|
116 | + foreach ($node as $child){ |
|
117 | + if ($this->isReference($child)){ |
|
118 | 118 | return true; |
119 | 119 | } |
120 | 120 | } |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | return $this->isReference($node->getValue()); |
126 | 126 | |
127 | 127 | case $node instanceof Mixin: |
128 | - foreach ($node->nodes as $child) { |
|
129 | - if ($this->isReference($child)) { |
|
128 | + foreach ($node->nodes as $child){ |
|
129 | + if ($this->isReference($child)){ |
|
130 | 130 | return true; |
131 | 131 | } |
132 | 132 | } |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | */ |
147 | 147 | private function trimPHP($node): string |
148 | 148 | { |
149 | - switch (true) { |
|
149 | + switch (true){ |
|
150 | 150 | case is_array($node): |
151 | 151 | $result = []; |
152 | - foreach ($node as $child) { |
|
152 | + foreach ($node as $child){ |
|
153 | 153 | $result[] = $this->trimPHP($child); |
154 | 154 | } |
155 | 155 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | case $node instanceof Mixin: |
159 | 159 | $result = []; |
160 | - foreach ($node->nodes as $child) { |
|
160 | + foreach ($node->nodes as $child){ |
|
161 | 161 | $result[] = $this->trimPHP($child); |
162 | 162 | } |
163 | 163 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | return trim($node->body); |
171 | 171 | |
172 | 172 | case $node instanceof PHP: |
173 | - if ($node->getContext()->getValue(PHP::ORIGINAL_BODY) !== null) { |
|
173 | + if ($node->getContext()->getValue(PHP::ORIGINAL_BODY) !== null){ |
|
174 | 174 | return $node->getContext()->getValue(PHP::ORIGINAL_BODY); |
175 | 175 | } |
176 | 176 | |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | private function exportValue(Raw $node): string |
191 | 191 | { |
192 | 192 | $value = $node->content; |
193 | - switch (true) { |
|
193 | + switch (true){ |
|
194 | 194 | case strtolower($value) === 'true': |
195 | 195 | return 'true'; |
196 | 196 | case strtolower($value) === 'false': |
197 | 197 | return 'false'; |
198 | 198 | case is_float($value) || is_numeric($value): |
199 | - return (string) $value; |
|
199 | + return (string)$value; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return var_export($node->content, true); |
@@ -64,15 +64,18 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | $php = new PHPMixin($node->tokens, self::PHP_MACRO_FUNCTION); |
67 | - foreach ($this->blocks->getNames() as $name) { |
|
67 | + foreach ($this->blocks->getNames() as $name) |
|
68 | + { |
|
68 | 69 | $block = $this->blocks->get($name); |
69 | 70 | |
70 | - if ($this->isReference($block)) { |
|
71 | + if ($this->isReference($block)) |
|
72 | + { |
|
71 | 73 | // resolved on later stage |
72 | 74 | continue; |
73 | 75 | } |
74 | 76 | |
75 | - if ($php->has($name)) { |
|
77 | + if ($php->has($name)) |
|
78 | + { |
|
76 | 79 | $php->set($name, $this->trimPHP($this->blocks->claim($name))); |
77 | 80 | } |
78 | 81 | } |
@@ -81,15 +84,18 @@ discard block |
||
81 | 84 | $node->tokens = token_get_all($node->content); |
82 | 85 | |
83 | 86 | $exists = new PHPMixin($node->tokens, self::PHP_MARCO_EXISTS_FUNCTION); |
84 | - foreach ($this->blocks->getNames() as $name) { |
|
87 | + foreach ($this->blocks->getNames() as $name) |
|
88 | + { |
|
85 | 89 | $block = $this->blocks->get($name); |
86 | 90 | |
87 | - if ($this->isReference($block)) { |
|
91 | + if ($this->isReference($block)) |
|
92 | + { |
|
88 | 93 | // resolved on later stage |
89 | 94 | continue; |
90 | 95 | } |
91 | 96 | |
92 | - if ($exists->has($name)) { |
|
97 | + if ($exists->has($name)) |
|
98 | + { |
|
93 | 99 | $exists->set($name, 'true'); |
94 | 100 | } |
95 | 101 | } |
@@ -111,10 +117,13 @@ discard block |
||
111 | 117 | */ |
112 | 118 | private function isReference($node): bool |
113 | 119 | { |
114 | - switch (true) { |
|
120 | + switch (true) |
|
121 | + { |
|
115 | 122 | case is_array($node): |
116 | - foreach ($node as $child) { |
|
117 | - if ($this->isReference($child)) { |
|
123 | + foreach ($node as $child) |
|
124 | + { |
|
125 | + if ($this->isReference($child)) |
|
126 | + { |
|
118 | 127 | return true; |
119 | 128 | } |
120 | 129 | } |
@@ -125,8 +134,10 @@ discard block |
||
125 | 134 | return $this->isReference($node->getValue()); |
126 | 135 | |
127 | 136 | case $node instanceof Mixin: |
128 | - foreach ($node->nodes as $child) { |
|
129 | - if ($this->isReference($child)) { |
|
137 | + foreach ($node->nodes as $child) |
|
138 | + { |
|
139 | + if ($this->isReference($child)) |
|
140 | + { |
|
130 | 141 | return true; |
131 | 142 | } |
132 | 143 | } |
@@ -146,10 +157,12 @@ discard block |
||
146 | 157 | */ |
147 | 158 | private function trimPHP($node): string |
148 | 159 | { |
149 | - switch (true) { |
|
160 | + switch (true) |
|
161 | + { |
|
150 | 162 | case is_array($node): |
151 | 163 | $result = []; |
152 | - foreach ($node as $child) { |
|
164 | + foreach ($node as $child) |
|
165 | + { |
|
153 | 166 | $result[] = $this->trimPHP($child); |
154 | 167 | } |
155 | 168 | |
@@ -157,7 +170,8 @@ discard block |
||
157 | 170 | |
158 | 171 | case $node instanceof Mixin: |
159 | 172 | $result = []; |
160 | - foreach ($node->nodes as $child) { |
|
173 | + foreach ($node->nodes as $child) |
|
174 | + { |
|
161 | 175 | $result[] = $this->trimPHP($child); |
162 | 176 | } |
163 | 177 | |
@@ -170,7 +184,8 @@ discard block |
||
170 | 184 | return trim($node->body); |
171 | 185 | |
172 | 186 | case $node instanceof PHP: |
173 | - if ($node->getContext()->getValue(PHP::ORIGINAL_BODY) !== null) { |
|
187 | + if ($node->getContext()->getValue(PHP::ORIGINAL_BODY) !== null) |
|
188 | + { |
|
174 | 189 | return $node->getContext()->getValue(PHP::ORIGINAL_BODY); |
175 | 190 | } |
176 | 191 | |
@@ -190,7 +205,8 @@ discard block |
||
190 | 205 | private function exportValue(Raw $node): string |
191 | 206 | { |
192 | 207 | $value = $node->content; |
193 | - switch (true) { |
|
208 | + switch (true) |
|
209 | + { |
|
194 | 210 | case strtolower($value) === 'true': |
195 | 211 | return 'true'; |
196 | 212 | case strtolower($value) === 'false': |
@@ -30,15 +30,15 @@ |
||
30 | 30 | */ |
31 | 31 | public function enterNode($node, VisitorContext $ctx) |
32 | 32 | { |
33 | - if (!$node instanceof Attr || $node->name !== self::AGGREGATE_ATTRIBUTE) { |
|
33 | + if (!$node instanceof Attr || $node->name !== self::AGGREGATE_ATTRIBUTE){ |
|
34 | 34 | return null; |
35 | 35 | } |
36 | 36 | |
37 | - if ($node->value instanceof Nil) { |
|
37 | + if ($node->value instanceof Nil){ |
|
38 | 38 | return new Aggregate($node->getContext()); |
39 | 39 | } |
40 | 40 | |
41 | - if (!is_string($node->value)) { |
|
41 | + if (!is_string($node->value)){ |
|
42 | 42 | return null; |
43 | 43 | } |
44 | 44 |
@@ -30,15 +30,18 @@ |
||
30 | 30 | */ |
31 | 31 | public function enterNode($node, VisitorContext $ctx) |
32 | 32 | { |
33 | - if (!$node instanceof Attr || $node->name !== self::AGGREGATE_ATTRIBUTE) { |
|
33 | + if (!$node instanceof Attr || $node->name !== self::AGGREGATE_ATTRIBUTE) |
|
34 | + { |
|
34 | 35 | return null; |
35 | 36 | } |
36 | 37 | |
37 | - if ($node->value instanceof Nil) { |
|
38 | + if ($node->value instanceof Nil) |
|
39 | + { |
|
38 | 40 | return new Aggregate($node->getContext()); |
39 | 41 | } |
40 | 42 | |
41 | - if (!is_string($node->value)) { |
|
43 | + if (!is_string($node->value)) |
|
44 | + { |
|
42 | 45 | return null; |
43 | 46 | } |
44 | 47 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function enterNode($node, VisitorContext $ctx) |
32 | 32 | { |
33 | - if ($node instanceof Tag && strpos($node->name, $this->stackKeyword) === 0) { |
|
33 | + if ($node instanceof Tag && strpos($node->name, $this->stackKeyword) === 0){ |
|
34 | 34 | return $this->registerAggregate(StackContext::on($ctx), $node); |
35 | 35 | } |
36 | 36 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | private function registerAggregate(StackContext $ctx, Tag $node) |
53 | 53 | { |
54 | 54 | $name = $this->stackName($node); |
55 | - if ($name === null) { |
|
55 | + if ($name === null){ |
|
56 | 56 | return $node; |
57 | 57 | } |
58 | 58 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | private function stackName(Tag $tag): ?string |
73 | 73 | { |
74 | 74 | $options = []; |
75 | - foreach ($tag->attrs as $attr) { |
|
76 | - if (is_string($attr->value)) { |
|
75 | + foreach ($tag->attrs as $attr){ |
|
76 | + if (is_string($attr->value)){ |
|
77 | 77 | $options[$attr->name] = trim($attr->value, '\'"'); |
78 | 78 | } |
79 | 79 | } |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | private function stackLevel(Tag $tag): int |
89 | 89 | { |
90 | 90 | $options = []; |
91 | - foreach ($tag->attrs as $attr) { |
|
92 | - if (is_string($attr->value)) { |
|
91 | + foreach ($tag->attrs as $attr){ |
|
92 | + if (is_string($attr->value)){ |
|
93 | 93 | $options[$attr->name] = trim($attr->value, '\'"'); |
94 | 94 | } |
95 | 95 | } |
@@ -30,7 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function enterNode($node, VisitorContext $ctx) |
32 | 32 | { |
33 | - if ($node instanceof Tag && strpos($node->name, $this->stackKeyword) === 0) { |
|
33 | + if ($node instanceof Tag && strpos($node->name, $this->stackKeyword) === 0) |
|
34 | + { |
|
34 | 35 | return $this->registerAggregate(StackContext::on($ctx), $node); |
35 | 36 | } |
36 | 37 | |
@@ -52,7 +53,8 @@ discard block |
||
52 | 53 | private function registerAggregate(StackContext $ctx, Tag $node) |
53 | 54 | { |
54 | 55 | $name = $this->stackName($node); |
55 | - if ($name === null) { |
|
56 | + if ($name === null) |
|
57 | + { |
|
56 | 58 | return $node; |
57 | 59 | } |
58 | 60 | |
@@ -72,8 +74,10 @@ discard block |
||
72 | 74 | private function stackName(Tag $tag): ?string |
73 | 75 | { |
74 | 76 | $options = []; |
75 | - foreach ($tag->attrs as $attr) { |
|
76 | - if (is_string($attr->value)) { |
|
77 | + foreach ($tag->attrs as $attr) |
|
78 | + { |
|
79 | + if (is_string($attr->value)) |
|
80 | + { |
|
77 | 81 | $options[$attr->name] = trim($attr->value, '\'"'); |
78 | 82 | } |
79 | 83 | } |
@@ -88,8 +92,10 @@ discard block |
||
88 | 92 | private function stackLevel(Tag $tag): int |
89 | 93 | { |
90 | 94 | $options = []; |
91 | - foreach ($tag->attrs as $attr) { |
|
92 | - if (is_string($attr->value)) { |
|
95 | + foreach ($tag->attrs as $attr) |
|
96 | + { |
|
97 | + if (is_string($attr->value)) |
|
98 | + { |
|
93 | 99 | $options[$attr->name] = trim($attr->value, '\'"'); |
94 | 100 | } |
95 | 101 | } |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function enterNode($node, VisitorContext $ctx) |
35 | 35 | { |
36 | - if ($node instanceof Tag) { |
|
36 | + if ($node instanceof Tag){ |
|
37 | 37 | return $this->makeBlock($node); |
38 | 38 | } |
39 | 39 | |
40 | - if ($node instanceof Inline) { |
|
40 | + if ($node instanceof Inline){ |
|
41 | 41 | $block = new Block($node->name, $node->getContext()); |
42 | - if ($node->value !== null) { |
|
42 | + if ($node->value !== null){ |
|
43 | 43 | $block->nodes[] = new Raw($node->value); |
44 | 44 | } |
45 | 45 | |
@@ -65,14 +65,14 @@ discard block |
||
65 | 65 | private function makeBlock(Tag $node): ?NodeInterface |
66 | 66 | { |
67 | 67 | $name = null; |
68 | - foreach ($this->prefix as $prefix) { |
|
69 | - if (strpos($node->name, $prefix) === 0) { |
|
68 | + foreach ($this->prefix as $prefix){ |
|
69 | + if (strpos($node->name, $prefix) === 0){ |
|
70 | 70 | $name = substr($node->name, strlen($prefix)); |
71 | 71 | break; |
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - if ($name === null) { |
|
75 | + if ($name === null){ |
|
76 | 76 | return null; |
77 | 77 | } |
78 | 78 |
@@ -33,13 +33,16 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function enterNode($node, VisitorContext $ctx) |
35 | 35 | { |
36 | - if ($node instanceof Tag) { |
|
36 | + if ($node instanceof Tag) |
|
37 | + { |
|
37 | 38 | return $this->makeBlock($node); |
38 | 39 | } |
39 | 40 | |
40 | - if ($node instanceof Inline) { |
|
41 | + if ($node instanceof Inline) |
|
42 | + { |
|
41 | 43 | $block = new Block($node->name, $node->getContext()); |
42 | - if ($node->value !== null) { |
|
44 | + if ($node->value !== null) |
|
45 | + { |
|
43 | 46 | $block->nodes[] = new Raw($node->value); |
44 | 47 | } |
45 | 48 | |
@@ -65,14 +68,17 @@ discard block |
||
65 | 68 | private function makeBlock(Tag $node): ?NodeInterface |
66 | 69 | { |
67 | 70 | $name = null; |
68 | - foreach ($this->prefix as $prefix) { |
|
69 | - if (strpos($node->name, $prefix) === 0) { |
|
71 | + foreach ($this->prefix as $prefix) |
|
72 | + { |
|
73 | + if (strpos($node->name, $prefix) === 0) |
|
74 | + { |
|
70 | 75 | $name = substr($node->name, strlen($prefix)); |
71 | 76 | break; |
72 | 77 | } |
73 | 78 | } |
74 | 79 | |
75 | - if ($name === null) { |
|
80 | + if ($name === null) |
|
81 | + { |
|
76 | 82 | return null; |
77 | 83 | } |
78 | 84 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function leaveNode($node, VisitorContext $ctx) |
35 | 35 | { |
36 | - if ($node instanceof Tag && strpos($node->name, $this->hiddenKeyword) === 0) { |
|
36 | + if ($node instanceof Tag && strpos($node->name, $this->hiddenKeyword) === 0){ |
|
37 | 37 | return new Hidden([$node]); |
38 | 38 | } |
39 | 39 |
@@ -33,7 +33,8 @@ |
||
33 | 33 | */ |
34 | 34 | public function leaveNode($node, VisitorContext $ctx) |
35 | 35 | { |
36 | - if ($node instanceof Tag && strpos($node->name, $this->hiddenKeyword) === 0) { |
|
36 | + if ($node instanceof Tag && strpos($node->name, $this->hiddenKeyword) === 0) |
|
37 | + { |
|
37 | 38 | return new Hidden([$node]); |
38 | 39 | } |
39 | 40 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool |
25 | 25 | { |
26 | - if ($node instanceof PHP) { |
|
26 | + if ($node instanceof PHP){ |
|
27 | 27 | $result->push($node->content, $node->getContext()); |
28 | 28 | return true; |
29 | 29 | } |
@@ -23,7 +23,8 @@ |
||
23 | 23 | */ |
24 | 24 | public function render(Compiler $compiler, Compiler\Result $result, NodeInterface $node): bool |
25 | 25 | { |
26 | - if ($node instanceof PHP) { |
|
26 | + if ($node instanceof PHP) |
|
27 | + { |
|
27 | 28 | $result->push($node->content, $node->getContext()); |
28 | 29 | return true; |
29 | 30 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | Compiler\Result $result, |
32 | 32 | NodeInterface $node |
33 | 33 | ): bool { |
34 | - switch (true) { |
|
34 | + switch (true){ |
|
35 | 35 | case $node instanceof Hidden: |
36 | 36 | return true; |
37 | 37 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $result->withinContext( |
40 | 40 | $node->getContext(), |
41 | 41 | function (Compiler\Result $source) use ($node, $compiler): void { |
42 | - foreach ($node->nodes as $child) { |
|
42 | + foreach ($node->nodes as $child){ |
|
43 | 43 | $compiler->compile($child, $source); |
44 | 44 | } |
45 | 45 | } |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | $result->withinContext( |
52 | 52 | $node->getContext(), |
53 | 53 | function (Compiler\Result $source) use ($node, $compiler): void { |
54 | - foreach ($node->nodes as $child) { |
|
55 | - if (is_string($child)) { |
|
54 | + foreach ($node->nodes as $child){ |
|
55 | + if (is_string($child)){ |
|
56 | 56 | $source->push($child, null); |
57 | 57 | continue; |
58 | 58 | } |
@@ -31,7 +31,8 @@ discard block |
||
31 | 31 | Compiler\Result $result, |
32 | 32 | NodeInterface $node |
33 | 33 | ): bool { |
34 | - switch (true) { |
|
34 | + switch (true) |
|
35 | + { |
|
35 | 36 | case $node instanceof Hidden: |
36 | 37 | return true; |
37 | 38 | |
@@ -39,7 +40,8 @@ discard block |
||
39 | 40 | $result->withinContext( |
40 | 41 | $node->getContext(), |
41 | 42 | function (Compiler\Result $source) use ($node, $compiler): void { |
42 | - foreach ($node->nodes as $child) { |
|
43 | + foreach ($node->nodes as $child) |
|
44 | + { |
|
43 | 45 | $compiler->compile($child, $source); |
44 | 46 | } |
45 | 47 | } |
@@ -51,8 +53,10 @@ discard block |
||
51 | 53 | $result->withinContext( |
52 | 54 | $node->getContext(), |
53 | 55 | function (Compiler\Result $source) use ($node, $compiler): void { |
54 | - foreach ($node->nodes as $child) { |
|
55 | - if (is_string($child)) { |
|
56 | + foreach ($node->nodes as $child) |
|
57 | + { |
|
58 | + if (is_string($child)) |
|
59 | + { |
|
56 | 60 | $source->push($child, null); |
57 | 61 | continue; |
58 | 62 | } |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function accepts(string $name): ?string |
51 | 51 | { |
52 | - if ($this->pattern === '' || $this->pattern === '*') { |
|
52 | + if ($this->pattern === '' || $this->pattern === '*'){ |
|
53 | 53 | // accept everything |
54 | 54 | return $name; |
55 | 55 | } |
56 | 56 | |
57 | 57 | $conditions = []; |
58 | - foreach (explode(';', $this->pattern) as $condition) { |
|
59 | - if (strpos($condition, ':') === false) { |
|
58 | + foreach (explode(';', $this->pattern) as $condition){ |
|
59 | + if (strpos($condition, ':') === false){ |
|
60 | 60 | //Invalid |
61 | 61 | continue; |
62 | 62 | } |
@@ -65,27 +65,27 @@ discard block |
||
65 | 65 | $conditions[$option] = $value; |
66 | 66 | } |
67 | 67 | |
68 | - if (isset($conditions['include'])) { |
|
68 | + if (isset($conditions['include'])){ |
|
69 | 69 | $include = explode(',', $conditions['include']); |
70 | - if (in_array($name, $include)) { |
|
70 | + if (in_array($name, $include)){ |
|
71 | 71 | return $name; |
72 | 72 | } |
73 | 73 | |
74 | 74 | return null; |
75 | 75 | } |
76 | 76 | |
77 | - if (isset($conditions['exclude'])) { |
|
77 | + if (isset($conditions['exclude'])){ |
|
78 | 78 | $exclude = explode(',', $conditions['exclude']); |
79 | - if (in_array($name, $exclude)) { |
|
79 | + if (in_array($name, $exclude)){ |
|
80 | 80 | return null; |
81 | 81 | } |
82 | 82 | |
83 | 83 | return $name; |
84 | 84 | } |
85 | 85 | |
86 | - if (isset($conditions['prefix'])) { |
|
86 | + if (isset($conditions['prefix'])){ |
|
87 | 87 | $conditions['prefix'] = rtrim($conditions['prefix'], ' *'); |
88 | - if (strpos($name, $conditions['prefix']) === 0) { |
|
88 | + if (strpos($name, $conditions['prefix']) === 0){ |
|
89 | 89 | return substr($name, strlen($conditions['prefix'])); |
90 | 90 | } |
91 | 91 |
@@ -49,14 +49,17 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function accepts(string $name): ?string |
51 | 51 | { |
52 | - if ($this->pattern === '' || $this->pattern === '*') { |
|
52 | + if ($this->pattern === '' || $this->pattern === '*') |
|
53 | + { |
|
53 | 54 | // accept everything |
54 | 55 | return $name; |
55 | 56 | } |
56 | 57 | |
57 | 58 | $conditions = []; |
58 | - foreach (explode(';', $this->pattern) as $condition) { |
|
59 | - if (strpos($condition, ':') === false) { |
|
59 | + foreach (explode(';', $this->pattern) as $condition) |
|
60 | + { |
|
61 | + if (strpos($condition, ':') === false) |
|
62 | + { |
|
60 | 63 | //Invalid |
61 | 64 | continue; |
62 | 65 | } |
@@ -65,27 +68,33 @@ discard block |
||
65 | 68 | $conditions[$option] = $value; |
66 | 69 | } |
67 | 70 | |
68 | - if (isset($conditions['include'])) { |
|
71 | + if (isset($conditions['include'])) |
|
72 | + { |
|
69 | 73 | $include = explode(',', $conditions['include']); |
70 | - if (in_array($name, $include)) { |
|
74 | + if (in_array($name, $include)) |
|
75 | + { |
|
71 | 76 | return $name; |
72 | 77 | } |
73 | 78 | |
74 | 79 | return null; |
75 | 80 | } |
76 | 81 | |
77 | - if (isset($conditions['exclude'])) { |
|
82 | + if (isset($conditions['exclude'])) |
|
83 | + { |
|
78 | 84 | $exclude = explode(',', $conditions['exclude']); |
79 | - if (in_array($name, $exclude)) { |
|
85 | + if (in_array($name, $exclude)) |
|
86 | + { |
|
80 | 87 | return null; |
81 | 88 | } |
82 | 89 | |
83 | 90 | return $name; |
84 | 91 | } |
85 | 92 | |
86 | - if (isset($conditions['prefix'])) { |
|
93 | + if (isset($conditions['prefix'])) |
|
94 | + { |
|
87 | 95 | $conditions['prefix'] = rtrim($conditions['prefix'], ' *'); |
88 | - if (strpos($name, $conditions['prefix']) === 0) { |
|
96 | + if (strpos($name, $conditions['prefix']) === 0) |
|
97 | + { |
|
89 | 98 | return substr($name, strlen($conditions['prefix'])); |
90 | 99 | } |
91 | 100 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | */ |
54 | 54 | public function peak(): ?string |
55 | 55 | { |
56 | - if ($this->offset + 1 > $this->length) { |
|
56 | + if ($this->offset + 1 > $this->length){ |
|
57 | 57 | return null; |
58 | 58 | } |
59 | 59 |
@@ -53,7 +53,8 @@ |
||
53 | 53 | */ |
54 | 54 | public function peak(): ?string |
55 | 55 | { |
56 | - if ($this->offset + 1 > $this->length) { |
|
56 | + if ($this->offset + 1 > $this->length) |
|
57 | + { |
|
57 | 58 | return null; |
58 | 59 | } |
59 | 60 |