@@ -24,7 +24,7 @@  | 
                                                    ||
| 24 | 24 | */  | 
                                                        
| 25 | 25 | public function __construct(  | 
                                                        
| 26 | 26 | public array $nodes = [],  | 
                                                        
| 27 | -    ) {} | 
                                                        |
| 27 | +    ){} | 
                                                        |
| 28 | 28 | |
| 29 | 29 | public function setContext(?Context $context = null): void  | 
                                                        
| 30 | 30 |      { | 
                                                        
@@ -24,7 +24,8 @@  | 
                                                    ||
| 24 | 24 | */  | 
                                                        
| 25 | 25 | public function __construct(  | 
                                                        
| 26 | 26 | public array $nodes = [],  | 
                                                        
| 27 | -    ) {} | 
                                                        |
| 27 | +    ) { | 
                                                        |
| 28 | +}  | 
                                                        |
| 28 | 29 | |
| 29 | 30 | public function setContext(?Context $context = null): void  | 
                                                        
| 30 | 31 |      { | 
                                                        
@@ -45,12 +45,12 @@ discard block  | 
                                                    ||
| 45 | 45 | $builder = new Builder($loader);  | 
                                                        
| 46 | 46 | |
| 47 | 47 | $builder->addVisitor(  | 
                                                        
| 48 | -            new class implements VisitorInterface { | 
                                                        |
| 48 | +            new class implements VisitorInterface{ | 
                                                        |
| 49 | 49 | |
| 50 | 50 | public function enterNode(mixed $node, VisitorContext $ctx): mixed  | 
                                                        
| 51 | 51 |                  { | 
                                                        
| 52 | 52 | $n = $ctx->getCurrentNode();  | 
                                                        
| 53 | -                    if ($n instanceof Template) { | 
                                                        |
| 53 | +                    if ($n instanceof Template){ | 
                                                        |
| 54 | 54 | $import = m::mock(ImportInterface::class);  | 
                                                        
| 55 | 55 |                          $import->shouldNotReceive('resolve'); | 
                                                        
| 56 | 56 | $n->setAttribute(ImportContext::class, [$import]);  | 
                                                        
@@ -94,16 +94,16 @@ discard block  | 
                                                    ||
| 94 | 94 | $template = new Template();  | 
                                                        
| 95 | 95 | |
| 96 | 96 | $builder->addVisitor(  | 
                                                        
| 97 | -            new class($builder, $template) implements VisitorInterface { | 
                                                        |
| 97 | +            new class($builder, $template) implements VisitorInterface{ | 
                                                        |
| 98 | 98 | public function __construct(  | 
                                                        
| 99 | 99 | private readonly Builder $builder,  | 
                                                        
| 100 | 100 | private readonly Template $template,  | 
                                                        
| 101 | -                ) {} | 
                                                        |
| 101 | +                ){} | 
                                                        |
| 102 | 102 | |
| 103 | 103 | public function enterNode(mixed $node, VisitorContext $ctx): mixed  | 
                                                        
| 104 | 104 |                  { | 
                                                        
| 105 | 105 | $n = $ctx->getCurrentNode();  | 
                                                        
| 106 | -                    if ($n instanceof Template) { | 
                                                        |
| 106 | +                    if ($n instanceof Template){ | 
                                                        |
| 107 | 107 | $import = m::mock(ImportInterface::class);  | 
                                                        
| 108 | 108 | $import  | 
                                                        
| 109 | 109 |                              ->shouldReceive('resolve') | 
                                                        
@@ -45,12 +45,14 @@ discard block  | 
                                                    ||
| 45 | 45 | $builder = new Builder($loader);  | 
                                                        
| 46 | 46 | |
| 47 | 47 | $builder->addVisitor(  | 
                                                        
| 48 | -            new class implements VisitorInterface { | 
                                                        |
| 48 | + new class implements VisitorInterface  | 
                                                        |
| 49 | +            { | 
                                                        |
| 49 | 50 | |
| 50 | 51 | public function enterNode(mixed $node, VisitorContext $ctx): mixed  | 
                                                        
| 51 | 52 |                  { | 
                                                        
| 52 | 53 | $n = $ctx->getCurrentNode();  | 
                                                        
| 53 | -                    if ($n instanceof Template) { | 
                                                        |
| 54 | + if ($n instanceof Template)  | 
                                                        |
| 55 | +                    { | 
                                                        |
| 54 | 56 | $import = m::mock(ImportInterface::class);  | 
                                                        
| 55 | 57 |                          $import->shouldNotReceive('resolve'); | 
                                                        
| 56 | 58 | $n->setAttribute(ImportContext::class, [$import]);  | 
                                                        
@@ -94,16 +96,19 @@ discard block  | 
                                                    ||
| 94 | 96 | $template = new Template();  | 
                                                        
| 95 | 97 | |
| 96 | 98 | $builder->addVisitor(  | 
                                                        
| 97 | -            new class($builder, $template) implements VisitorInterface { | 
                                                        |
| 99 | + new class($builder, $template) implements VisitorInterface  | 
                                                        |
| 100 | +            { | 
                                                        |
| 98 | 101 | public function __construct(  | 
                                                        
| 99 | 102 | private readonly Builder $builder,  | 
                                                        
| 100 | 103 | private readonly Template $template,  | 
                                                        
| 101 | -                ) {} | 
                                                        |
| 104 | +                ) { | 
                                                        |
| 105 | +}  | 
                                                        |
| 102 | 106 | |
| 103 | 107 | public function enterNode(mixed $node, VisitorContext $ctx): mixed  | 
                                                        
| 104 | 108 |                  { | 
                                                        
| 105 | 109 | $n = $ctx->getCurrentNode();  | 
                                                        
| 106 | -                    if ($n instanceof Template) { | 
                                                        |
| 110 | + if ($n instanceof Template)  | 
                                                        |
| 111 | +                    { | 
                                                        |
| 107 | 112 | $import = m::mock(ImportInterface::class);  | 
                                                        
| 108 | 113 | $import  | 
                                                        
| 109 | 114 |                              ->shouldReceive('resolve') | 
                                                        
@@ -18,15 +18,15 @@ discard block  | 
                                                    ||
| 18 | 18 | */  | 
                                                        
| 19 | 19 | public static function hasPrefix(string $tag, ?string $prefix): bool  | 
                                                        
| 20 | 20 |      { | 
                                                        
| 21 | -        if ($prefix === null) { | 
                                                        |
| 21 | +        if ($prefix === null){ | 
                                                        |
| 22 | 22 | return true;  | 
                                                        
| 23 | 23 | }  | 
                                                        
| 24 | 24 | |
| 25 | -        if (!\str_starts_with($tag, $prefix)) { | 
                                                        |
| 25 | +        if (!\str_starts_with($tag, $prefix)){ | 
                                                        |
| 26 | 26 | return false;  | 
                                                        
| 27 | 27 | }  | 
                                                        
| 28 | 28 | |
| 29 | -        if (!\in_array($tag[\strlen($prefix)], self::SEPARATOR, true)) { | 
                                                        |
| 29 | +        if (!\in_array($tag[\strlen($prefix)], self::SEPARATOR, true)){ | 
                                                        |
| 30 | 30 | return false;  | 
                                                        
| 31 | 31 | }  | 
                                                        
| 32 | 32 | |
@@ -35,10 +35,10 @@ discard block  | 
                                                    ||
| 35 | 35 | |
| 36 | 36 | public static function stripPrefix(string $tag, ?string $prefix): string  | 
                                                        
| 37 | 37 |      { | 
                                                        
| 38 | -        if (!self::hasPrefix($tag, $prefix)) { | 
                                                        |
| 38 | +        if (!self::hasPrefix($tag, $prefix)){ | 
                                                        |
| 39 | 39 | return $tag;  | 
                                                        
| 40 | 40 | }  | 
                                                        
| 41 | 41 | |
| 42 | - return \substr($tag, \strlen((string) $prefix) + 1);  | 
                                                        |
| 42 | + return \substr($tag, \strlen((string)$prefix) + 1);  | 
                                                        |
| 43 | 43 | }  | 
                                                        
| 44 | 44 | }  | 
                                                        
| 45 | 45 | \ No newline at end of file  | 
                                                        
@@ -18,15 +18,18 @@ discard block  | 
                                                    ||
| 18 | 18 | */  | 
                                                        
| 19 | 19 | public static function hasPrefix(string $tag, ?string $prefix): bool  | 
                                                        
| 20 | 20 |      { | 
                                                        
| 21 | -        if ($prefix === null) { | 
                                                        |
| 21 | + if ($prefix === null)  | 
                                                        |
| 22 | +        { | 
                                                        |
| 22 | 23 | return true;  | 
                                                        
| 23 | 24 | }  | 
                                                        
| 24 | 25 | |
| 25 | -        if (!\str_starts_with($tag, $prefix)) { | 
                                                        |
| 26 | + if (!\str_starts_with($tag, $prefix))  | 
                                                        |
| 27 | +        { | 
                                                        |
| 26 | 28 | return false;  | 
                                                        
| 27 | 29 | }  | 
                                                        
| 28 | 30 | |
| 29 | -        if (!\in_array($tag[\strlen($prefix)], self::SEPARATOR, true)) { | 
                                                        |
| 31 | + if (!\in_array($tag[\strlen($prefix)], self::SEPARATOR, true))  | 
                                                        |
| 32 | +        { | 
                                                        |
| 30 | 33 | return false;  | 
                                                        
| 31 | 34 | }  | 
                                                        
| 32 | 35 | |
@@ -35,7 +38,8 @@ discard block  | 
                                                    ||
| 35 | 38 | |
| 36 | 39 | public static function stripPrefix(string $tag, ?string $prefix): string  | 
                                                        
| 37 | 40 |      { | 
                                                        
| 38 | -        if (!self::hasPrefix($tag, $prefix)) { | 
                                                        |
| 41 | + if (!self::hasPrefix($tag, $prefix))  | 
                                                        |
| 42 | +        { | 
                                                        |
| 39 | 43 | return $tag;  | 
                                                        
| 40 | 44 | }  | 
                                                        
| 41 | 45 | |
@@ -23,19 +23,19 @@ discard block  | 
                                                    ||
| 23 | 23 | private string $path,  | 
                                                        
| 24 | 24 | private ?string $prefix = null,  | 
                                                        
| 25 | 25 | ?Context $context = null,  | 
                                                        
| 26 | -    ) { | 
                                                        |
| 26 | +    ){ | 
                                                        |
| 27 | 27 | $this->context = $context;  | 
                                                        
| 28 | 28 | }  | 
                                                        
| 29 | 29 | |
| 30 | 30 | public function resolve(Builder $builder, string $name): ?Template  | 
                                                        
| 31 | 31 |      { | 
                                                        
| 32 | -        if ($this->template === null) { | 
                                                        |
| 32 | +        if ($this->template === null){ | 
                                                        |
| 33 | 33 | $this->template = $builder->load($this->path);  | 
                                                        
| 34 | 34 | }  | 
                                                        
| 35 | 35 | |
| 36 | 36 | $path = $name;  | 
                                                        
| 37 | -        if ($this->prefix !== null) { | 
                                                        |
| 38 | -            if (!TagHelper::hasPrefix($name, $this->prefix)) { | 
                                                        |
| 37 | +        if ($this->prefix !== null){ | 
                                                        |
| 38 | +            if (!TagHelper::hasPrefix($name, $this->prefix)){ | 
                                                        |
| 39 | 39 | return null;  | 
                                                        
| 40 | 40 | }  | 
                                                        
| 41 | 41 | |
@@ -43,9 +43,9 @@ discard block  | 
                                                    ||
| 43 | 43 | }  | 
                                                        
| 44 | 44 | |
| 45 | 45 | /** @var ImportInterface $import */  | 
                                                        
| 46 | -        foreach ($this->template->getAttribute(ImportContext::class, []) as $import) { | 
                                                        |
| 46 | +        foreach ($this->template->getAttribute(ImportContext::class, []) as $import){ | 
                                                        |
| 47 | 47 | $tpl = $import->resolve($builder, $path);  | 
                                                        
| 48 | -            if ($tpl !== null) { | 
                                                        |
| 48 | +            if ($tpl !== null){ | 
                                                        |
| 49 | 49 | return $tpl;  | 
                                                        
| 50 | 50 | }  | 
                                                        
| 51 | 51 | }  | 
                                                        
@@ -29,13 +29,16 @@ discard block  | 
                                                    ||
| 29 | 29 | |
| 30 | 30 | public function resolve(Builder $builder, string $name): ?Template  | 
                                                        
| 31 | 31 |      { | 
                                                        
| 32 | -        if ($this->template === null) { | 
                                                        |
| 32 | + if ($this->template === null)  | 
                                                        |
| 33 | +        { | 
                                                        |
| 33 | 34 | $this->template = $builder->load($this->path);  | 
                                                        
| 34 | 35 | }  | 
                                                        
| 35 | 36 | |
| 36 | 37 | $path = $name;  | 
                                                        
| 37 | -        if ($this->prefix !== null) { | 
                                                        |
| 38 | -            if (!TagHelper::hasPrefix($name, $this->prefix)) { | 
                                                        |
| 38 | + if ($this->prefix !== null)  | 
                                                        |
| 39 | +        { | 
                                                        |
| 40 | + if (!TagHelper::hasPrefix($name, $this->prefix))  | 
                                                        |
| 41 | +            { | 
                                                        |
| 39 | 42 | return null;  | 
                                                        
| 40 | 43 | }  | 
                                                        
| 41 | 44 | |
@@ -43,9 +46,11 @@ discard block  | 
                                                    ||
| 43 | 46 | }  | 
                                                        
| 44 | 47 | |
| 45 | 48 | /** @var ImportInterface $import */  | 
                                                        
| 46 | -        foreach ($this->template->getAttribute(ImportContext::class, []) as $import) { | 
                                                        |
| 49 | + foreach ($this->template->getAttribute(ImportContext::class, []) as $import)  | 
                                                        |
| 50 | +        { | 
                                                        |
| 47 | 51 | $tpl = $import->resolve($builder, $path);  | 
                                                        
| 48 | -            if ($tpl !== null) { | 
                                                        |
| 52 | + if ($tpl !== null)  | 
                                                        |
| 53 | +            { | 
                                                        |
| 49 | 54 | return $tpl;  | 
                                                        
| 50 | 55 | }  | 
                                                        
| 51 | 56 | }  | 
                                                        
@@ -22,20 +22,20 @@  | 
                                                    ||
| 22 | 22 | public string $path,  | 
                                                        
| 23 | 23 | ?string $prefix,  | 
                                                        
| 24 | 24 | ?Context $context = null,  | 
                                                        
| 25 | -    ) { | 
                                                        |
| 25 | +    ){ | 
                                                        |
| 26 | 26 | $this->prefix = $prefix ?? \substr($path, \strrpos($path, '/') + 1);  | 
                                                        
| 27 | 27 | $this->context = $context;  | 
                                                        
| 28 | 28 | }  | 
                                                        
| 29 | 29 | |
| 30 | 30 | public function resolve(Builder $builder, string $name): ?Template  | 
                                                        
| 31 | 31 |      { | 
                                                        
| 32 | -        if (!TagHelper::hasPrefix($name, $this->prefix)) { | 
                                                        |
| 32 | +        if (!TagHelper::hasPrefix($name, $this->prefix)){ | 
                                                        |
| 33 | 33 | return null;  | 
                                                        
| 34 | 34 | }  | 
                                                        
| 35 | 35 | |
| 36 | 36 | $path = TagHelper::stripPrefix($name, $this->prefix);  | 
                                                        
| 37 | 37 |          $path = \str_replace('.', DIRECTORY_SEPARATOR, $path); | 
                                                        
| 38 | 38 | |
| 39 | - return $builder->load($this->path . DIRECTORY_SEPARATOR . $path);  | 
                                                        |
| 39 | + return $builder->load($this->path.DIRECTORY_SEPARATOR.$path);  | 
                                                        |
| 40 | 40 | }  | 
                                                        
| 41 | 41 | }  | 
                                                        
@@ -29,7 +29,8 @@  | 
                                                    ||
| 29 | 29 | |
| 30 | 30 | public function resolve(Builder $builder, string $name): ?Template  | 
                                                        
| 31 | 31 |      { | 
                                                        
| 32 | -        if (!TagHelper::hasPrefix($name, $this->prefix)) { | 
                                                        |
| 32 | + if (!TagHelper::hasPrefix($name, $this->prefix))  | 
                                                        |
| 33 | +        { | 
                                                        |
| 33 | 34 | return null;  | 
                                                        
| 34 | 35 | }  | 
                                                        
| 35 | 36 | |