Passed
Pull Request — master (#1138)
by Abdul Malik
12:49
created
src/Views/src/Engine/AbstractEngine.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
     public function getLoader(): LoaderInterface
30 30
     {
31
-        if (empty($this->loader)) {
31
+        if (empty($this->loader)){
32 32
             throw new EngineException('No associated loader found');
33 33
         }
34 34
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@
 block discarded – undo
28 28
 
29 29
     public function getLoader(): LoaderInterface
30 30
     {
31
-        if (empty($this->loader)) {
31
+        if (empty($this->loader))
32
+        {
32 33
             throw new EngineException('No associated loader found');
33 34
         }
34 35
 
Please login to merge, or discard this patch.
src/Views/src/Engine/Native/NativeEngine.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     public function __construct(
17 17
         private readonly ContainerInterface $container,
18 18
         string $extension = self::EXTENSION
19
-    ) {
19
+    ){
20 20
         $this->extension = $extension;
21 21
     }
22 22
 
Please login to merge, or discard this patch.
src/Views/src/Engine/Native/NativeView.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     public function __construct(
16 16
         private readonly ViewSource $view,
17 17
         private readonly ContainerInterface $container
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     public function render(array $data = []): string
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
         \ob_start();
24 24
         $__outputLevel__ = \ob_get_level();
25 25
 
26
-        try {
26
+        try{
27 27
             ContainerScope::runScope($this->container, function () use ($data): void {
28 28
                 \extract($data, EXTR_OVERWRITE);
29 29
                 // render view in context and output buffer scope, context can be accessed using $this->context
30 30
                 require $this->view->getFilename();
31 31
             });
32
-        } catch (\Throwable $throwable) {
33
-            while (\ob_get_level() >= $__outputLevel__) {
32
+        }catch (\Throwable $throwable){
33
+            while (\ob_get_level() >= $__outputLevel__){
34 34
                 \ob_end_clean();
35 35
             }
36 36
 
37 37
             throw new RenderException($throwable);
38
-        } finally {
38
+        }finally{
39 39
             //Closing all nested buffers
40
-            while (\ob_get_level() > $__outputLevel__) {
40
+            while (\ob_get_level() > $__outputLevel__){
41 41
                 \ob_end_clean();
42 42
             }
43 43
         }
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,21 +23,28 @@
 block discarded – undo
23 23
         \ob_start();
24 24
         $__outputLevel__ = \ob_get_level();
25 25
 
26
-        try {
26
+        try
27
+        {
27 28
             ContainerScope::runScope($this->container, function () use ($data): void {
28 29
                 \extract($data, EXTR_OVERWRITE);
29 30
                 // render view in context and output buffer scope, context can be accessed using $this->context
30 31
                 require $this->view->getFilename();
31 32
             });
32
-        } catch (\Throwable $throwable) {
33
-            while (\ob_get_level() >= $__outputLevel__) {
33
+        }
34
+        catch (\Throwable $throwable)
35
+        {
36
+            while (\ob_get_level() >= $__outputLevel__)
37
+            {
34 38
                 \ob_end_clean();
35 39
             }
36 40
 
37 41
             throw new RenderException($throwable);
38
-        } finally {
42
+        }
43
+        finally
44
+        {
39 45
             //Closing all nested buffers
40
-            while (\ob_get_level() > $__outputLevel__) {
46
+            while (\ob_get_level() > $__outputLevel__)
47
+            {
41 48
                 \ob_end_clean();
42 49
             }
43 50
         }
Please login to merge, or discard this patch.
src/Views/src/ViewSource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
         private readonly string $filename,
16 16
         private readonly string $namespace,
17 17
         private readonly string $name
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     /**
Please login to merge, or discard this patch.
src/Views/src/Exception/RenderException.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
 
11 11
     public function __construct(\Throwable $previous = null)
12 12
     {
13
-        parent::__construct((string) $previous?->getMessage(), (int) ($previous?->getCode() ?? 0), $previous);
14
-        $this->file = (string) $previous?->getFile();
15
-        $this->line = (int) $previous?->getLine();
13
+        parent::__construct((string)$previous?->getMessage(), (int)($previous?->getCode() ?? 0), $previous);
14
+        $this->file = (string)$previous?->getFile();
15
+        $this->line = (int)$previous?->getLine();
16 16
     }
17 17
 
18 18
     /**
Please login to merge, or discard this patch.
src/Views/src/Exception/CompileException.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 
11 11
     public function __construct(\Throwable $previous = null)
12 12
     {
13
-        parent::__construct((string) $previous?->getMessage(), (int) ($previous?->getCode() ?? 0), $previous);
13
+        parent::__construct((string)$previous?->getMessage(), (int)($previous?->getCode() ?? 0), $previous);
14 14
 
15
-        $this->file = (string) $previous?->getFile();
16
-        $this->line = (int) $previous?->getLine();
15
+        $this->file = (string)$previous?->getFile();
16
+        $this->line = (int)$previous?->getLine();
17 17
     }
18 18
 
19 19
     /**
Please login to merge, or discard this patch.
src/Views/src/Context/ValueDependency.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         private readonly string $name,
18 18
         private mixed $value,
19 19
         array $variants = null
20
-    ) {
20
+    ){
21 21
         $this->variants = $variants ?? [$value];
22 22
     }
23 23
 
Please login to merge, or discard this patch.
src/Views/src/Event/ViewNotFound.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,6 +8,6 @@
 block discarded – undo
8 8
 {
9 9
     public function __construct(
10 10
         public readonly string $path,
11
-    ) {
11
+    ){
12 12
     }
13 13
 }
Please login to merge, or discard this patch.
src/Views/src/ViewLoader.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         FilesInterface $files = null,
26 26
         private readonly string $defaultNamespace = self::DEFAULT_NAMESPACE,
27 27
         private readonly ?EventDispatcherInterface $dispatcher = null,
28
-    ) {
28
+    ){
29 29
         $this->files = $files ?? new Files();
30 30
     }
31 31
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function getExtension(): ?string
41 41
     {
42
-        if ($this->parser !== null) {
42
+        if ($this->parser !== null){
43 43
             return $this->parser->getExtension();
44 44
         }
45 45
 
@@ -50,24 +50,24 @@  discard block
 block discarded – undo
50 50
      * @psalm-assert-if-true non-empty-string $filename
51 51
      * @psalm-assert-if-true ViewPath $parsed
52 52
      */
53
-    public function exists(string $path, string &$filename = null, ViewPath &$parsed = null): bool
53
+    public function exists(string $path, string &$filename = null, ViewPath & $parsed = null): bool
54 54
     {
55
-        if (empty($this->parser)) {
55
+        if (empty($this->parser)){
56 56
             throw new LoaderException('Unable to locate view source, no extension has been associated.');
57 57
         }
58 58
 
59 59
         $parsed = $this->parser->parse($path);
60
-        if ($parsed === null) {
60
+        if ($parsed === null){
61 61
             return false;
62 62
         }
63 63
 
64
-        if (!isset($this->namespaces[$parsed->getNamespace()])) {
64
+        if (!isset($this->namespaces[$parsed->getNamespace()])){
65 65
             return false;
66 66
         }
67 67
 
68
-        foreach ((array)$this->namespaces[$parsed->getNamespace()] as $directory) {
68
+        foreach ((array)$this->namespaces[$parsed->getNamespace()] as $directory){
69 69
             $directory = $this->files->normalizePath($directory, true);
70
-            if ($this->files->exists(\sprintf('%s%s', $directory, $parsed->getBasename()))) {
70
+            if ($this->files->exists(\sprintf('%s%s', $directory, $parsed->getBasename()))){
71 71
                 $filename = \sprintf('%s%s', $directory, $parsed->getBasename());
72 72
 
73 73
                 return true;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
     public function load(string $path): ViewSource
81 81
     {
82
-        if (!$this->exists($path, $filename, $parsed)) {
82
+        if (!$this->exists($path, $filename, $parsed)){
83 83
             $this->dispatcher?->dispatch(new ViewNotFound($path));
84 84
 
85 85
             throw new LoaderException(\sprintf('Unable to load view `%s`, file does not exist.', $path));
@@ -94,21 +94,21 @@  discard block
 block discarded – undo
94 94
 
95 95
     public function list(string $namespace = null): array
96 96
     {
97
-        if (empty($this->parser)) {
97
+        if (empty($this->parser)){
98 98
             throw new LoaderException('Unable to list view sources, no extension has been associated.');
99 99
         }
100 100
 
101 101
         $result = [];
102
-        foreach ($this->namespaces as $ns => $directories) {
103
-            if (!empty($namespace) && $namespace != $ns) {
102
+        foreach ($this->namespaces as $ns => $directories){
103
+            if (!empty($namespace) && $namespace != $ns){
104 104
                 continue;
105 105
             }
106 106
 
107
-            foreach ((array)$directories as $directory) {
107
+            foreach ((array)$directories as $directory){
108 108
                 $files = $this->files->getFiles($directory);
109 109
 
110
-                foreach ($files as $filename) {
111
-                    if (!$this->parser->match($filename)) {
110
+                foreach ($files as $filename){
111
+                    if (!$this->parser->match($filename)){
112 112
                         // does not belong to this loader
113 113
                         continue;
114 114
                     }
Please login to merge, or discard this patch.
Braces   +26 added lines, -13 removed lines patch added patch discarded remove patch
@@ -39,7 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function getExtension(): ?string
41 41
     {
42
-        if ($this->parser !== null) {
42
+        if ($this->parser !== null)
43
+        {
43 44
             return $this->parser->getExtension();
44 45
         }
45 46
 
@@ -52,22 +53,27 @@  discard block
 block discarded – undo
52 53
      */
53 54
     public function exists(string $path, string &$filename = null, ViewPath &$parsed = null): bool
54 55
     {
55
-        if (empty($this->parser)) {
56
+        if (empty($this->parser))
57
+        {
56 58
             throw new LoaderException('Unable to locate view source, no extension has been associated.');
57 59
         }
58 60
 
59 61
         $parsed = $this->parser->parse($path);
60
-        if ($parsed === null) {
62
+        if ($parsed === null)
63
+        {
61 64
             return false;
62 65
         }
63 66
 
64
-        if (!isset($this->namespaces[$parsed->getNamespace()])) {
67
+        if (!isset($this->namespaces[$parsed->getNamespace()]))
68
+        {
65 69
             return false;
66 70
         }
67 71
 
68
-        foreach ((array)$this->namespaces[$parsed->getNamespace()] as $directory) {
72
+        foreach ((array)$this->namespaces[$parsed->getNamespace()] as $directory)
73
+        {
69 74
             $directory = $this->files->normalizePath($directory, true);
70
-            if ($this->files->exists(\sprintf('%s%s', $directory, $parsed->getBasename()))) {
75
+            if ($this->files->exists(\sprintf('%s%s', $directory, $parsed->getBasename())))
76
+            {
71 77
                 $filename = \sprintf('%s%s', $directory, $parsed->getBasename());
72 78
 
73 79
                 return true;
@@ -79,7 +85,8 @@  discard block
 block discarded – undo
79 85
 
80 86
     public function load(string $path): ViewSource
81 87
     {
82
-        if (!$this->exists($path, $filename, $parsed)) {
88
+        if (!$this->exists($path, $filename, $parsed))
89
+        {
83 90
             $this->dispatcher?->dispatch(new ViewNotFound($path));
84 91
 
85 92
             throw new LoaderException(\sprintf('Unable to load view `%s`, file does not exist.', $path));
@@ -94,21 +101,27 @@  discard block
 block discarded – undo
94 101
 
95 102
     public function list(string $namespace = null): array
96 103
     {
97
-        if (empty($this->parser)) {
104
+        if (empty($this->parser))
105
+        {
98 106
             throw new LoaderException('Unable to list view sources, no extension has been associated.');
99 107
         }
100 108
 
101 109
         $result = [];
102
-        foreach ($this->namespaces as $ns => $directories) {
103
-            if (!empty($namespace) && $namespace != $ns) {
110
+        foreach ($this->namespaces as $ns => $directories)
111
+        {
112
+            if (!empty($namespace) && $namespace != $ns)
113
+            {
104 114
                 continue;
105 115
             }
106 116
 
107
-            foreach ((array)$directories as $directory) {
117
+            foreach ((array)$directories as $directory)
118
+            {
108 119
                 $files = $this->files->getFiles($directory);
109 120
 
110
-                foreach ($files as $filename) {
111
-                    if (!$this->parser->match($filename)) {
121
+                foreach ($files as $filename)
122
+                {
123
+                    if (!$this->parser->match($filename))
124
+                    {
112 125
                         // does not belong to this loader
113 126
                         continue;
114 127
                     }
Please login to merge, or discard this patch.