@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function __construct( |
26 | 26 | Context $context = null, |
27 | 27 | public string $pattern = '*' |
28 | - ) { |
|
28 | + ){ |
|
29 | 29 | $this->context = $context; |
30 | 30 | } |
31 | 31 | |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function accepts(string $name): ?string |
37 | 37 | { |
38 | - if ($this->pattern === '' || $this->pattern === '*') { |
|
38 | + if ($this->pattern === '' || $this->pattern === '*'){ |
|
39 | 39 | // accept everything |
40 | 40 | return $name; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $conditions = []; |
44 | - foreach (\explode(';', $this->pattern) as $condition) { |
|
45 | - if (!\str_contains($condition, ':')) { |
|
44 | + foreach (\explode(';', $this->pattern) as $condition){ |
|
45 | + if (!\str_contains($condition, ':')){ |
|
46 | 46 | //Invalid |
47 | 47 | continue; |
48 | 48 | } |
@@ -51,27 +51,27 @@ discard block |
||
51 | 51 | $conditions[$option] = $value; |
52 | 52 | } |
53 | 53 | |
54 | - if (isset($conditions['include'])) { |
|
54 | + if (isset($conditions['include'])){ |
|
55 | 55 | $include = \explode(',', $conditions['include']); |
56 | - if (\in_array($name, $include)) { |
|
56 | + if (\in_array($name, $include)){ |
|
57 | 57 | return $name; |
58 | 58 | } |
59 | 59 | |
60 | 60 | return null; |
61 | 61 | } |
62 | 62 | |
63 | - if (isset($conditions['exclude'])) { |
|
63 | + if (isset($conditions['exclude'])){ |
|
64 | 64 | $exclude = \explode(',', $conditions['exclude']); |
65 | - if (\in_array($name, $exclude)) { |
|
65 | + if (\in_array($name, $exclude)){ |
|
66 | 66 | return null; |
67 | 67 | } |
68 | 68 | |
69 | 69 | return $name; |
70 | 70 | } |
71 | 71 | |
72 | - if (isset($conditions['prefix'])) { |
|
72 | + if (isset($conditions['prefix'])){ |
|
73 | 73 | $conditions['prefix'] = \rtrim($conditions['prefix'], ' *'); |
74 | - if (\str_starts_with($name, $conditions['prefix'])) { |
|
74 | + if (\str_starts_with($name, $conditions['prefix'])){ |
|
75 | 75 | return substr($name, \strlen($conditions['prefix'])); |
76 | 76 | } |
77 | 77 |
@@ -35,14 +35,17 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function accepts(string $name): ?string |
37 | 37 | { |
38 | - if ($this->pattern === '' || $this->pattern === '*') { |
|
38 | + if ($this->pattern === '' || $this->pattern === '*') |
|
39 | + { |
|
39 | 40 | // accept everything |
40 | 41 | return $name; |
41 | 42 | } |
42 | 43 | |
43 | 44 | $conditions = []; |
44 | - foreach (\explode(';', $this->pattern) as $condition) { |
|
45 | - if (!\str_contains($condition, ':')) { |
|
45 | + foreach (\explode(';', $this->pattern) as $condition) |
|
46 | + { |
|
47 | + if (!\str_contains($condition, ':')) |
|
48 | + { |
|
46 | 49 | //Invalid |
47 | 50 | continue; |
48 | 51 | } |
@@ -51,27 +54,33 @@ discard block |
||
51 | 54 | $conditions[$option] = $value; |
52 | 55 | } |
53 | 56 | |
54 | - if (isset($conditions['include'])) { |
|
57 | + if (isset($conditions['include'])) |
|
58 | + { |
|
55 | 59 | $include = \explode(',', $conditions['include']); |
56 | - if (\in_array($name, $include)) { |
|
60 | + if (\in_array($name, $include)) |
|
61 | + { |
|
57 | 62 | return $name; |
58 | 63 | } |
59 | 64 | |
60 | 65 | return null; |
61 | 66 | } |
62 | 67 | |
63 | - if (isset($conditions['exclude'])) { |
|
68 | + if (isset($conditions['exclude'])) |
|
69 | + { |
|
64 | 70 | $exclude = \explode(',', $conditions['exclude']); |
65 | - if (\in_array($name, $exclude)) { |
|
71 | + if (\in_array($name, $exclude)) |
|
72 | + { |
|
66 | 73 | return null; |
67 | 74 | } |
68 | 75 | |
69 | 76 | return $name; |
70 | 77 | } |
71 | 78 | |
72 | - if (isset($conditions['prefix'])) { |
|
79 | + if (isset($conditions['prefix'])) |
|
80 | + { |
|
73 | 81 | $conditions['prefix'] = \rtrim($conditions['prefix'], ' *'); |
74 | - if (\str_starts_with($name, $conditions['prefix'])) { |
|
82 | + if (\str_starts_with($name, $conditions['prefix'])) |
|
83 | + { |
|
75 | 84 | return substr($name, \strlen($conditions['prefix'])); |
76 | 85 | } |
77 | 86 |
@@ -19,10 +19,10 @@ |
||
19 | 19 | use ContextTrait; |
20 | 20 | |
21 | 21 | public function __construct( |
22 | - public Mixin|string $name, |
|
22 | + public Mixin | string $name, |
|
23 | 23 | public mixed $value, |
24 | 24 | Context $context = null |
25 | - ) { |
|
25 | + ){ |
|
26 | 26 | $this->context = $context; |
27 | 27 | } |
28 | 28 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | public bool $void = false; |
26 | 26 | |
27 | - public Mixin|string|null $name = null; |
|
27 | + public Mixin | string | null $name = null; |
|
28 | 28 | |
29 | 29 | /** @var Attr[] */ |
30 | 30 | public array $attrs = []; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct( |
26 | 26 | public array $nodes = [] |
27 | - ) { |
|
27 | + ){ |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setContext(Context $context = null): void |
@@ -17,9 +17,9 @@ |
||
17 | 17 | use ContextTrait; |
18 | 18 | |
19 | 19 | public function __construct( |
20 | - public string|int|float $content, |
|
20 | + public string | int | float $content, |
|
21 | 21 | Context $context = null |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | $this->context = $context; |
24 | 24 | } |
25 | 25 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | /** @internal */ |
24 | 24 | public array $tokens, |
25 | 25 | Context $context = null |
26 | - ) { |
|
26 | + ){ |
|
27 | 27 | $this->context = $context; |
28 | 28 | } |
29 | 29 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | string $message, |
16 | 16 | private Context $context, |
17 | 17 | \Throwable $previous = null |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | parent::__construct($message, 0, $previous); |
20 | 20 | } |
21 | 21 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function __construct( |
16 | 16 | string $message, |
17 | 17 | private readonly Token $token |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | $message = \sprintf('%s at offset %s', $message, $token->offset); |
20 | 20 | parent::__construct($message, 0, null); |
21 | 21 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | trait MixinTrait |
14 | 14 | { |
15 | - private function parseToken(Parser $parser, Token $token): Mixin|Raw|string |
|
15 | + private function parseToken(Parser $parser, Token $token): Mixin | Raw | string |
|
16 | 16 | { |
17 | - if ($token->tokens === []) { |
|
18 | - if ($token->type === Token::TYPE_RAW) { |
|
17 | + if ($token->tokens === []){ |
|
18 | + if ($token->type === Token::TYPE_RAW){ |
|
19 | 19 | return new Raw($token->content); |
20 | 20 | } |
21 | 21 |
@@ -14,8 +14,10 @@ |
||
14 | 14 | { |
15 | 15 | private function parseToken(Parser $parser, Token $token): Mixin|Raw|string |
16 | 16 | { |
17 | - if ($token->tokens === []) { |
|
18 | - if ($token->type === Token::TYPE_RAW) { |
|
17 | + if ($token->tokens === []) |
|
18 | + { |
|
19 | + if ($token->type === Token::TYPE_RAW) |
|
20 | + { |
|
19 | 21 | return new Raw($token->content); |
20 | 22 | } |
21 | 23 |