@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public function getID(): string |
21 | 21 | { |
22 | 22 | $calculated = ''; |
23 | - foreach ($this->dependencies as $dependency) { |
|
23 | + foreach ($this->dependencies as $dependency){ |
|
24 | 24 | $calculated .= \sprintf('[%s=%s]', $dependency->getName(), $dependency->getValue()); |
25 | 25 | } |
26 | 26 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | public function resolveValue(string $dependency): mixed |
49 | 49 | { |
50 | - if (!isset($this->dependencies[$dependency])) { |
|
50 | + if (!isset($this->dependencies[$dependency])){ |
|
51 | 51 | throw new ContextException(\sprintf('Undefined context dependency \'%s\'.', $dependency)); |
52 | 52 | } |
53 | 53 |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | public function getID(): string |
21 | 21 | { |
22 | 22 | $calculated = ''; |
23 | - foreach ($this->dependencies as $dependency) { |
|
23 | + foreach ($this->dependencies as $dependency) |
|
24 | + { |
|
24 | 25 | $calculated .= \sprintf('[%s=%s]', $dependency->getName(), $dependency->getValue()); |
25 | 26 | } |
26 | 27 | |
@@ -47,7 +48,8 @@ discard block |
||
47 | 48 | |
48 | 49 | public function resolveValue(string $dependency): mixed |
49 | 50 | { |
50 | - if (!isset($this->dependencies[$dependency])) { |
|
51 | + if (!isset($this->dependencies[$dependency])) |
|
52 | + { |
|
51 | 53 | throw new ContextException(\sprintf('Undefined context dependency \'%s\'.', $dependency)); |
52 | 54 | } |
53 | 55 |
@@ -28,7 +28,7 @@ |
||
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 |
@@ -28,7 +28,8 @@ |
||
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 |
@@ -16,7 +16,7 @@ |
||
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 |
@@ -15,7 +15,7 @@ discard block |
||
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 |
||
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 | } |
@@ -23,21 +23,28 @@ |
||
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 | } |
@@ -15,7 +15,7 @@ |
||
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 | /** |
@@ -10,9 +10,9 @@ |
||
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 | /** |
@@ -10,10 +10,10 @@ |
||
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 | /** |
@@ -17,7 +17,7 @@ |
||
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 |
@@ -8,6 +8,6 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | public readonly string $path, |
11 | - ) { |
|
11 | + ){ |
|
12 | 12 | } |
13 | 13 | } |