Passed
Push — master ( 9f2c4f...e942df )
by Aleksei
17:57 queued 05:15
created
src/Cache/src/Config/CacheConfig.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function getDefaultStorage(): string
33 33
     {
34
-        if (!\is_string($this->config['default'])) {
34
+        if (!\is_string($this->config['default'])){
35 35
             throw new InvalidArgumentException('Default cache storage config value must be a string');
36 36
         }
37 37
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function getStorageConfig(string $name): array
42 42
     {
43
-        if (!isset($this->config['storages'][$name])) {
43
+        if (!isset($this->config['storages'][$name])){
44 44
             throw new InvalidArgumentException(
45 45
                 \sprintf('Config for storage `%s` is not defined.', $name)
46 46
             );
@@ -48,19 +48,19 @@  discard block
 block discarded – undo
48 48
 
49 49
         $config = $this->config['storages'][$name];
50 50
 
51
-        if (!isset($config['type'])) {
51
+        if (!isset($config['type'])){
52 52
             throw new InvalidArgumentException(
53 53
                 \sprintf('Storage type for `%s` is not defined.', $name)
54 54
             );
55 55
         }
56 56
 
57
-        if (!\is_string($config['type'])) {
57
+        if (!\is_string($config['type'])){
58 58
             throw new InvalidArgumentException(
59 59
                 \sprintf('Storage type value for `%s` must be a string', $name)
60 60
             );
61 61
         }
62 62
 
63
-        if (isset($this->config['typeAliases'][$config['type']])) {
63
+        if (isset($this->config['typeAliases'][$config['type']])){
64 64
             $config['type'] = $this->config['typeAliases'][$config['type']];
65 65
         }
66 66
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function getDefaultStorage(): string
33 33
     {
34
-        if (!\is_string($this->config['default'])) {
34
+        if (!\is_string($this->config['default']))
35
+        {
35 36
             throw new InvalidArgumentException('Default cache storage config value must be a string');
36 37
         }
37 38
 
@@ -40,7 +41,8 @@  discard block
 block discarded – undo
40 41
 
41 42
     public function getStorageConfig(string $name): array
42 43
     {
43
-        if (!isset($this->config['storages'][$name])) {
44
+        if (!isset($this->config['storages'][$name]))
45
+        {
44 46
             throw new InvalidArgumentException(
45 47
                 \sprintf('Config for storage `%s` is not defined.', $name)
46 48
             );
@@ -48,19 +50,22 @@  discard block
 block discarded – undo
48 50
 
49 51
         $config = $this->config['storages'][$name];
50 52
 
51
-        if (!isset($config['type'])) {
53
+        if (!isset($config['type']))
54
+        {
52 55
             throw new InvalidArgumentException(
53 56
                 \sprintf('Storage type for `%s` is not defined.', $name)
54 57
             );
55 58
         }
56 59
 
57
-        if (!\is_string($config['type'])) {
60
+        if (!\is_string($config['type']))
61
+        {
58 62
             throw new InvalidArgumentException(
59 63
                 \sprintf('Storage type value for `%s` must be a string', $name)
60 64
             );
61 65
         }
62 66
 
63
-        if (isset($this->config['typeAliases'][$config['type']])) {
67
+        if (isset($this->config['typeAliases'][$config['type']]))
68
+        {
64 69
             $config['type'] = $this->config['typeAliases'][$config['type']];
65 70
         }
66 71
 
Please login to merge, or discard this patch.
src/Cache/src/Storage/InteractsWithTime.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         return new \DateTimeImmutable();
22 22
     }
23 23
 
24
-    private function ttlToTimestamp(null|int|\DateInterval|\DateTimeInterface $ttl = null): int
24
+    private function ttlToTimestamp(null | int | \DateInterval | \DateTimeInterface $ttl = null): int
25 25
     {
26 26
         return match (true) {
27 27
             $ttl instanceof \DateInterval => $this->now()->add($ttl)->getTimestamp(),
Please login to merge, or discard this patch.
src/Cache/src/Storage/ArrayStorage.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function __construct(
19 19
         private readonly int $ttl = 2_592_000
20
-    ) {
20
+    ){
21 21
     }
22 22
 
23 23
     public function get(string $key, mixed $default = null): mixed
24 24
     {
25
-        if (!isset($this->storage[$key])) {
25
+        if (!isset($this->storage[$key])){
26 26
             return $default;
27 27
         }
28 28
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
         $expiresAt = $item['timestamp'] ?? 0;
32 32
 
33
-        if ($expiresAt !== 0 && \time() >= $expiresAt) {
33
+        if ($expiresAt !== 0 && \time() >= $expiresAt){
34 34
             $this->delete($key);
35 35
 
36 36
             return $default;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         return $item['value'];
40 40
     }
41 41
 
42
-    public function set(string $key, mixed $value, null|int|\DateInterval|\DateTimeInterface $ttl = null): bool
42
+    public function set(string $key, mixed $value, null | int | \DateInterval | \DateTimeInterface $ttl = null): bool
43 43
     {
44 44
         $this->storage[$key] = [
45 45
             'value' => $value,
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function delete(string $key): bool
53 53
     {
54
-        if ($this->has($key)) {
54
+        if ($this->has($key)){
55 55
             unset($this->storage[$key]);
56 56
 
57 57
             return true;
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $return = [];
73 73
 
74
-        foreach ($keys as $key) {
74
+        foreach ($keys as $key){
75 75
             $return[$key] = $this->get($key, $default);
76 76
         }
77 77
 
78 78
         return $return;
79 79
     }
80 80
 
81
-    public function setMultiple(iterable $values, null|int|\DateInterval|\DateTimeInterface $ttl = null): bool
81
+    public function setMultiple(iterable $values, null | int | \DateInterval | \DateTimeInterface $ttl = null): bool
82 82
     {
83
-        foreach ($values as $key => $value) {
83
+        foreach ($values as $key => $value){
84 84
             $this->set($key, $value, $ttl);
85 85
         }
86 86
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $state = null;
93 93
 
94
-        foreach ($keys as $key) {
94
+        foreach ($keys as $key){
95 95
             $result = $this->delete($key);
96 96
 
97 97
             $state = \is_null($state) ? $result : $result && $state;
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
 
23 23
     public function get(string $key, mixed $default = null): mixed
24 24
     {
25
-        if (!isset($this->storage[$key])) {
25
+        if (!isset($this->storage[$key]))
26
+        {
26 27
             return $default;
27 28
         }
28 29
 
@@ -30,7 +31,8 @@  discard block
 block discarded – undo
30 31
 
31 32
         $expiresAt = $item['timestamp'] ?? 0;
32 33
 
33
-        if ($expiresAt !== 0 && \time() >= $expiresAt) {
34
+        if ($expiresAt !== 0 && \time() >= $expiresAt)
35
+        {
34 36
             $this->delete($key);
35 37
 
36 38
             return $default;
@@ -51,7 +53,8 @@  discard block
 block discarded – undo
51 53
 
52 54
     public function delete(string $key): bool
53 55
     {
54
-        if ($this->has($key)) {
56
+        if ($this->has($key))
57
+        {
55 58
             unset($this->storage[$key]);
56 59
 
57 60
             return true;
@@ -71,7 +74,8 @@  discard block
 block discarded – undo
71 74
     {
72 75
         $return = [];
73 76
 
74
-        foreach ($keys as $key) {
77
+        foreach ($keys as $key)
78
+        {
75 79
             $return[$key] = $this->get($key, $default);
76 80
         }
77 81
 
@@ -80,7 +84,8 @@  discard block
 block discarded – undo
80 84
 
81 85
     public function setMultiple(iterable $values, null|int|\DateInterval|\DateTimeInterface $ttl = null): bool
82 86
     {
83
-        foreach ($values as $key => $value) {
87
+        foreach ($values as $key => $value)
88
+        {
84 89
             $this->set($key, $value, $ttl);
85 90
         }
86 91
 
@@ -91,7 +96,8 @@  discard block
 block discarded – undo
91 96
     {
92 97
         $state = null;
93 98
 
94
-        foreach ($keys as $key) {
99
+        foreach ($keys as $key)
100
+        {
95 101
             $result = $this->delete($key);
96 102
 
97 103
             $state = \is_null($state) ? $result : $result && $state;
Please login to merge, or discard this patch.
src/Cache/src/Storage/FileStorage.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         private readonly FilesInterface $files,
17 17
         private readonly string $path,
18 18
         private readonly int $ttl = 2_592_000
19
-    ) {
19
+    ){
20 20
     }
21 21
 
22 22
     public function get(string $key, mixed $default = null): mixed
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
         return $this->getPayload($key)['value'] ?? $default;
25 25
     }
26 26
 
27
-    public function set(string $key, mixed $value, null|int|\DateInterval|\DateTimeInterface $ttl = null): bool
27
+    public function set(string $key, mixed $value, null | int | \DateInterval | \DateTimeInterface $ttl = null): bool
28 28
     {
29 29
         return $this->files->write(
30 30
             $this->makePath($key),
31
-            $this->ttlToTimestamp($ttl) . \serialize($value),
31
+            $this->ttlToTimestamp($ttl).\serialize($value),
32 32
             null,
33 33
             true
34 34
         );
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
     public function delete(string $key): bool
38 38
     {
39
-        if ($this->has($key)) {
39
+        if ($this->has($key)){
40 40
             return $this->files->delete($this->makePath($key));
41 41
         }
42 42
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function clear(): bool
47 47
     {
48
-        if (!$this->files->isDirectory($this->path)) {
48
+        if (!$this->files->isDirectory($this->path)){
49 49
             return false;
50 50
         }
51 51
 
@@ -58,18 +58,18 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $result = [];
60 60
 
61
-        foreach ($keys as $key) {
61
+        foreach ($keys as $key){
62 62
             $result[$key] = $this->get($key, $default);
63 63
         }
64 64
 
65 65
         return $result;
66 66
     }
67 67
 
68
-    public function setMultiple(iterable $values, null|int|\DateInterval|\DateTimeInterface $ttl = null): bool
68
+    public function setMultiple(iterable $values, null | int | \DateInterval | \DateTimeInterface $ttl = null): bool
69 69
     {
70 70
         $state = null;
71 71
 
72
-        foreach ($values as $key => $value) {
72
+        foreach ($values as $key => $value){
73 73
             $result = $this->set($key, $value, $ttl);
74 74
             $state = \is_null($state) ? $result : $result && $state;
75 75
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     public function deleteMultiple(iterable $keys): bool
81 81
     {
82 82
         $state = null;
83
-        foreach ($keys as $key) {
83
+        foreach ($keys as $key){
84 84
             $result = $this->delete($key);
85 85
             $state = \is_null($state) ? $result : $result && $state;
86 86
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     {
101 101
         $parts = \array_slice(\str_split($hash = \sha1($key), 2), 0, 2);
102 102
 
103
-        return $this->path . '/' . \implode('/', $parts) . '/' . $hash;
103
+        return $this->path.'/'.\implode('/', $parts).'/'.$hash;
104 104
     }
105 105
 
106 106
     /**
@@ -110,25 +110,25 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $path = $this->makePath($key);
112 112
 
113
-        try {
114
-            $expire = (int) \substr(
113
+        try{
114
+            $expire = (int)\substr(
115 115
                 $contents = $this->files->read($path),
116 116
                 0,
117 117
                 10
118 118
             );
119
-        } catch (FileNotFoundException) {
119
+        }catch (FileNotFoundException){
120 120
             return $this->makeEmptyPayload();
121 121
         }
122 122
 
123
-        if (\time() >= $expire) {
123
+        if (\time() >= $expire){
124 124
             $this->delete($key);
125 125
 
126 126
             return $this->makeEmptyPayload();
127 127
         }
128 128
 
129
-        try {
129
+        try{
130 130
             $data = \unserialize(\substr($contents, 10));
131
-        } catch (\Exception) {
131
+        }catch (\Exception){
132 132
             $this->delete($key);
133 133
 
134 134
             return $this->makeEmptyPayload();
Please login to merge, or discard this patch.
Braces   +22 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
     public function delete(string $key): bool
38 38
     {
39
-        if ($this->has($key)) {
39
+        if ($this->has($key))
40
+        {
40 41
             return $this->files->delete($this->makePath($key));
41 42
         }
42 43
 
@@ -45,7 +46,8 @@  discard block
 block discarded – undo
45 46
 
46 47
     public function clear(): bool
47 48
     {
48
-        if (!$this->files->isDirectory($this->path)) {
49
+        if (!$this->files->isDirectory($this->path))
50
+        {
49 51
             return false;
50 52
         }
51 53
 
@@ -58,7 +60,8 @@  discard block
 block discarded – undo
58 60
     {
59 61
         $result = [];
60 62
 
61
-        foreach ($keys as $key) {
63
+        foreach ($keys as $key)
64
+        {
62 65
             $result[$key] = $this->get($key, $default);
63 66
         }
64 67
 
@@ -69,7 +72,8 @@  discard block
 block discarded – undo
69 72
     {
70 73
         $state = null;
71 74
 
72
-        foreach ($values as $key => $value) {
75
+        foreach ($values as $key => $value)
76
+        {
73 77
             $result = $this->set($key, $value, $ttl);
74 78
             $state = \is_null($state) ? $result : $result && $state;
75 79
         }
@@ -80,7 +84,8 @@  discard block
 block discarded – undo
80 84
     public function deleteMultiple(iterable $keys): bool
81 85
     {
82 86
         $state = null;
83
-        foreach ($keys as $key) {
87
+        foreach ($keys as $key)
88
+        {
84 89
             $result = $this->delete($key);
85 90
             $state = \is_null($state) ? $result : $result && $state;
86 91
         }
@@ -110,25 +115,32 @@  discard block
 block discarded – undo
110 115
     {
111 116
         $path = $this->makePath($key);
112 117
 
113
-        try {
118
+        try
119
+        {
114 120
             $expire = (int) \substr(
115 121
                 $contents = $this->files->read($path),
116 122
                 0,
117 123
                 10
118 124
             );
119
-        } catch (FileNotFoundException) {
125
+        }
126
+        catch (FileNotFoundException)
127
+        {
120 128
             return $this->makeEmptyPayload();
121 129
         }
122 130
 
123
-        if (\time() >= $expire) {
131
+        if (\time() >= $expire)
132
+        {
124 133
             $this->delete($key);
125 134
 
126 135
             return $this->makeEmptyPayload();
127 136
         }
128 137
 
129
-        try {
138
+        try
139
+        {
130 140
             $data = \unserialize(\substr($contents, 10));
131
-        } catch (\Exception) {
141
+        }
142
+        catch (\Exception)
143
+        {
132 144
             $this->delete($key);
133 145
 
134 146
             return $this->makeEmptyPayload();
Please login to merge, or discard this patch.
src/Stempler/src/Loader/DirectoryLoader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     public function __construct(
15 15
         private readonly string $directory,
16 16
         private readonly string $extension = '.dark.php'
17
-    ) {
17
+    ){
18 18
     }
19 19
 
20 20
     /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             $this->extension
31 31
         );
32 32
 
33
-        if (!\file_exists($filename)) {
33
+        if (!\file_exists($filename)){
34 34
             throw new LoaderException(\sprintf('Unable to load `%s`, no such file', $path));
35 35
         }
36 36
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@
 block discarded – undo
30 30
             $this->extension
31 31
         );
32 32
 
33
-        if (!\file_exists($filename)) {
33
+        if (!\file_exists($filename))
34
+        {
34 35
             throw new LoaderException(\sprintf('Unable to load `%s`, no such file', $path));
35 36
         }
36 37
 
Please login to merge, or discard this patch.
src/Stempler/src/Loader/StringLoader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 
18 18
     public function load(string $path): Source
19 19
     {
20
-        if (!\array_key_exists($path, $this->paths)) {
20
+        if (!\array_key_exists($path, $this->paths)){
21 21
             throw new LoaderException(\sprintf('Unable to load path `%s`', $path));
22 22
         }
23 23
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@
 block discarded – undo
17 17
 
18 18
     public function load(string $path): Source
19 19
     {
20
-        if (!\array_key_exists($path, $this->paths)) {
20
+        if (!\array_key_exists($path, $this->paths))
21
+        {
21 22
             throw new LoaderException(\sprintf('Unable to load path `%s`', $path));
22 23
         }
23 24
 
Please login to merge, or discard this patch.
src/Stempler/src/Builder.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         private readonly LoaderInterface $loader,
36 36
         private readonly Parser $parser = new Parser(),
37 37
         private readonly Compiler $compiler = new Compiler()
38
-    ) {
38
+    ){
39 39
     }
40 40
 
41 41
     public function getLoader(): LoaderInterface
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function compileTemplate(Template $tpl): Result
82 82
     {
83
-        try {
84
-            if (isset($this->visitors[self::STAGE_COMPILE])) {
83
+        try{
84
+            if (isset($this->visitors[self::STAGE_COMPILE])){
85 85
                 $traverser = new Traverser($this->visitors[self::STAGE_COMPILE]);
86 86
                 $tpl = $traverser->traverse([$tpl])[0];
87 87
             }
88 88
 
89 89
             return $this->compiler->compile($tpl);
90
-        } catch (CompilerException $e) {
90
+        }catch (CompilerException $e){
91 91
             throw $this->mapException($e);
92 92
         }
93 93
     }
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
         $source = $this->loader->load($path);
101 101
         $stream = new StringStream($source->getContent());
102 102
 
103
-        try {
103
+        try{
104 104
             $tpl = $this->parser->withPath($path)->parse($stream);
105 105
             $tpl->setContext(new Context(
106 106
                 new Token(Token::TYPE_RAW, 0, ''),
107 107
                 $path
108 108
             ));
109
-        } catch (ParserException $e) {
109
+        }catch (ParserException $e){
110 110
             throw $this->mapException($e);
111 111
         }
112 112
 
113
-        try {
113
+        try{
114 114
             return $this->process($tpl);
115
-        } catch (ContextExceptionInterface $e) {
115
+        }catch (ContextExceptionInterface $e){
116 116
             throw $this->mapException($e);
117
-        } catch (\Throwable $e) {
117
+        }catch (\Throwable $e){
118 118
             throw $e;
119 119
         }
120 120
     }
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
      */
125 125
     private function process(Template $template): Template
126 126
     {
127
-        if (isset($this->visitors[self::STAGE_PREPARE])) {
127
+        if (isset($this->visitors[self::STAGE_PREPARE])){
128 128
             $traverser = new Traverser($this->visitors[self::STAGE_PREPARE]);
129 129
             $template = $traverser->traverse([$template])[0];
130 130
         }
131 131
 
132
-        if (isset($this->visitors[self::STAGE_TRANSFORM])) {
132
+        if (isset($this->visitors[self::STAGE_TRANSFORM])){
133 133
             $traverser = new Traverser($this->visitors[self::STAGE_TRANSFORM]);
134 134
             $template = $traverser->traverse([$template])[0];
135 135
         }
136 136
 
137
-        if (isset($this->visitors[self::STAGE_FINALIZE])) {
137
+        if (isset($this->visitors[self::STAGE_FINALIZE])){
138 138
             $traverser = new Traverser($this->visitors[self::STAGE_FINALIZE]);
139 139
             $template = $traverser->traverse([$template])[0];
140 140
         }
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
      */
148 148
     private function mapException(ContextExceptionInterface $e): ContextExceptionInterface
149 149
     {
150
-        if ($e->getContext()->getPath() === null) {
150
+        if ($e->getContext()->getPath() === null){
151 151
             return $e;
152 152
         }
153 153
 
154
-        try {
154
+        try{
155 155
             $source = $this->loader->load($e->getContext()->getPath());
156
-        } catch (LoaderException) {
156
+        }catch (LoaderException){
157 157
             return $e;
158 158
         }
159 159
 
160
-        if ($source->getFilename() === null) {
160
+        if ($source->getFilename() === null){
161 161
             return $e;
162 162
         }
163 163
 
Please login to merge, or discard this patch.
Braces   +35 added lines, -15 removed lines patch added patch discarded remove patch
@@ -80,14 +80,18 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function compileTemplate(Template $tpl): Result
82 82
     {
83
-        try {
84
-            if (isset($this->visitors[self::STAGE_COMPILE])) {
83
+        try
84
+        {
85
+            if (isset($this->visitors[self::STAGE_COMPILE]))
86
+            {
85 87
                 $traverser = new Traverser($this->visitors[self::STAGE_COMPILE]);
86 88
                 $tpl = $traverser->traverse([$tpl])[0];
87 89
             }
88 90
 
89 91
             return $this->compiler->compile($tpl);
90
-        } catch (CompilerException $e) {
92
+        }
93
+        catch (CompilerException $e)
94
+        {
91 95
             throw $this->mapException($e);
92 96
         }
93 97
     }
@@ -100,21 +104,29 @@  discard block
 block discarded – undo
100 104
         $source = $this->loader->load($path);
101 105
         $stream = new StringStream($source->getContent());
102 106
 
103
-        try {
107
+        try
108
+        {
104 109
             $tpl = $this->parser->withPath($path)->parse($stream);
105 110
             $tpl->setContext(new Context(
106 111
                 new Token(Token::TYPE_RAW, 0, ''),
107 112
                 $path
108 113
             ));
109
-        } catch (ParserException $e) {
114
+        }
115
+        catch (ParserException $e)
116
+        {
110 117
             throw $this->mapException($e);
111 118
         }
112 119
 
113
-        try {
120
+        try
121
+        {
114 122
             return $this->process($tpl);
115
-        } catch (ContextExceptionInterface $e) {
123
+        }
124
+        catch (ContextExceptionInterface $e)
125
+        {
116 126
             throw $this->mapException($e);
117
-        } catch (\Throwable $e) {
127
+        }
128
+        catch (\Throwable $e)
129
+        {
118 130
             throw $e;
119 131
         }
120 132
     }
@@ -124,17 +136,20 @@  discard block
 block discarded – undo
124 136
      */
125 137
     private function process(Template $template): Template
126 138
     {
127
-        if (isset($this->visitors[self::STAGE_PREPARE])) {
139
+        if (isset($this->visitors[self::STAGE_PREPARE]))
140
+        {
128 141
             $traverser = new Traverser($this->visitors[self::STAGE_PREPARE]);
129 142
             $template = $traverser->traverse([$template])[0];
130 143
         }
131 144
 
132
-        if (isset($this->visitors[self::STAGE_TRANSFORM])) {
145
+        if (isset($this->visitors[self::STAGE_TRANSFORM]))
146
+        {
133 147
             $traverser = new Traverser($this->visitors[self::STAGE_TRANSFORM]);
134 148
             $template = $traverser->traverse([$template])[0];
135 149
         }
136 150
 
137
-        if (isset($this->visitors[self::STAGE_FINALIZE])) {
151
+        if (isset($this->visitors[self::STAGE_FINALIZE]))
152
+        {
138 153
             $traverser = new Traverser($this->visitors[self::STAGE_FINALIZE]);
139 154
             $template = $traverser->traverse([$template])[0];
140 155
         }
@@ -147,17 +162,22 @@  discard block
 block discarded – undo
147 162
      */
148 163
     private function mapException(ContextExceptionInterface $e): ContextExceptionInterface
149 164
     {
150
-        if ($e->getContext()->getPath() === null) {
165
+        if ($e->getContext()->getPath() === null)
166
+        {
151 167
             return $e;
152 168
         }
153 169
 
154
-        try {
170
+        try
171
+        {
155 172
             $source = $this->loader->load($e->getContext()->getPath());
156
-        } catch (LoaderException) {
173
+        }
174
+        catch (LoaderException)
175
+        {
157 176
             return $e;
158 177
         }
159 178
 
160
-        if ($source->getFilename() === null) {
179
+        if ($source->getFilename() === null)
180
+        {
161 181
             return $e;
162 182
         }
163 183
 
Please login to merge, or discard this patch.
src/Stempler/src/Node/Aggregate.php 2 patches
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,14 +35,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Stempler/src/Node/HTML/Tag.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
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 = [];
Please login to merge, or discard this patch.