@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | private readonly ?string $storage = null, |
| 18 | 18 | private readonly int $ttl = 86400, |
| 19 | 19 | private readonly string $prefix = 'session:' |
| 20 | - ) { |
|
| 20 | + ){ |
|
| 21 | 21 | $this->cache = $storageProvider->storage($this->storage); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | return true; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function gc(int $max_lifetime): int|false |
|
| 39 | + public function gc(int $max_lifetime): int | false |
|
| 40 | 40 | { |
| 41 | 41 | return 0; |
| 42 | 42 | } |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * @throws InvalidArgumentException |
| 51 | 51 | */ |
| 52 | - public function read(string $id): string|false |
|
| 52 | + public function read(string $id): string | false |
|
| 53 | 53 | { |
| 54 | 54 | $result = $this->cache->get($this->getKey($id)); |
| 55 | 55 | |
| 56 | - return (string) $result; |
|
| 56 | + return (string)$result; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -66,6 +66,6 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | private function getKey(string $id): string |
| 68 | 68 | { |
| 69 | - return $this->prefix . $id; |
|
| 69 | + return $this->prefix.$id; |
|
| 70 | 70 | } |
| 71 | 71 | } |
@@ -26,11 +26,11 @@ |
||
| 26 | 26 | SampleBootWithMethodBoot::class, |
| 27 | 27 | SampleBoot::class, |
| 28 | 28 | ], [ |
| 29 | - static function(Container $container, SampleBoot $boot) { |
|
| 29 | + static function (Container $container, SampleBoot $boot){ |
|
| 30 | 30 | $container->bind('efg', $boot); |
| 31 | 31 | } |
| 32 | 32 | ], [ |
| 33 | - static function(Container $container, SampleBoot $boot) { |
|
| 33 | + static function (Container $container, SampleBoot $boot){ |
|
| 34 | 34 | $container->bind('ghi', $boot); |
| 35 | 35 | } |
| 36 | 36 | ]); |
@@ -26,11 +26,13 @@ |
||
| 26 | 26 | SampleBootWithMethodBoot::class, |
| 27 | 27 | SampleBoot::class, |
| 28 | 28 | ], [ |
| 29 | - static function(Container $container, SampleBoot $boot) { |
|
| 29 | + static function(Container $container, SampleBoot $boot) |
|
| 30 | + { |
|
| 30 | 31 | $container->bind('efg', $boot); |
| 31 | 32 | } |
| 32 | 33 | ], [ |
| 33 | - static function(Container $container, SampleBoot $boot) { |
|
| 34 | + static function(Container $container, SampleBoot $boot) |
|
| 35 | + { |
|
| 34 | 36 | $container->bind('ghi', $boot); |
| 35 | 37 | } |
| 36 | 38 | ]); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public function __construct( |
| 17 | 17 | private readonly ScopeInterface $scope, |
| 18 | 18 | protected readonly InitializerInterface $initializer |
| 19 | - ) { |
|
| 19 | + ){ |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function getClasses(): array |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | private readonly ResolverInterface $resolver, |
| 22 | 22 | InitializerInterface $initializer, |
| 23 | 23 | ?InvokerStrategyInterface $invokerStrategy = null |
| 24 | - ) { |
|
| 24 | + ){ |
|
| 25 | 25 | parent::__construct($scope, $initializer); |
| 26 | 26 | |
| 27 | 27 | $this->invokerStrategy = $invokerStrategy ?? new DefaultInvokerStrategy(...$this->resolver->resolveArguments( |
@@ -30,9 +30,9 @@ |
||
| 30 | 30 | \preg_replace_callback( |
| 31 | 31 | $this->pattern, |
| 32 | 32 | static function (array $matches) use ($context) { |
| 33 | - try { |
|
| 33 | + try{ |
|
| 34 | 34 | return $context->resolveValue($matches['name']) ?? $matches['default'] ?? null; |
| 35 | - } catch (ContextException $e) { |
|
| 35 | + }catch (ContextException $e){ |
|
| 36 | 36 | return $matches['default'] ?? throw $e; |
| 37 | 37 | } |
| 38 | 38 | }, |
@@ -29,10 +29,14 @@ |
||
| 29 | 29 | return $source->withCode( |
| 30 | 30 | \preg_replace_callback( |
| 31 | 31 | $this->pattern, |
| 32 | - static function (array $matches) use ($context) { |
|
| 33 | - try { |
|
| 32 | + static function (array $matches) use ($context) |
|
| 33 | + { |
|
| 34 | + try |
|
| 35 | + { |
|
| 34 | 36 | return $context->resolveValue($matches['name']) ?? $matches['default'] ?? null; |
| 35 | - } catch (ContextException $e) { |
|
| 37 | + } |
|
| 38 | + catch (ContextException $e) |
|
| 39 | + { |
|
| 36 | 40 | return $matches['default'] ?? throw $e; |
| 37 | 41 | } |
| 38 | 42 | }, |
@@ -69,8 +69,8 @@ |
||
| 69 | 69 | protected function getSource(string $path): ViewSource |
| 70 | 70 | { |
| 71 | 71 | $loader = new ViewLoader([ |
| 72 | - 'default' => __DIR__ . '/fixtures/default', |
|
| 73 | - 'other' => __DIR__ . '/fixtures/other', |
|
| 72 | + 'default' => __DIR__.'/fixtures/default', |
|
| 73 | + 'other' => __DIR__.'/fixtures/other', |
|
| 74 | 74 | ]); |
| 75 | 75 | |
| 76 | 76 | return $loader->withExtension('php')->load($path); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function __construct( |
| 38 | 38 | private readonly ConfiguratorInterface $config |
| 39 | - ) { |
|
| 39 | + ){ |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function init(ContainerInterface $container, ViewsBootloader $views): void |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $views->addEngine(StemplerEngine::class); |
| 78 | 78 | |
| 79 | - if ($container->has(LocaleProcessor::class)) { |
|
| 79 | + if ($container->has(LocaleProcessor::class)){ |
|
| 80 | 80 | $this->addProcessor(LocaleProcessor::class); |
| 81 | - } else { |
|
| 81 | + }else{ |
|
| 82 | 82 | $this->addProcessor(NullLocaleProcessor::class); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function addDirective(string|Autowire|Directive\DirectiveRendererInterface $directive): void |
|
| 86 | + public function addDirective(string | Autowire | Directive\DirectiveRendererInterface $directive): void |
|
| 87 | 87 | { |
| 88 | 88 | $this->config->modify( |
| 89 | 89 | StemplerConfig::CONFIG, |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | ); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function addProcessor(string|Autowire|ProcessorInterface $processor): void |
|
| 94 | + public function addProcessor(string | Autowire | ProcessorInterface $processor): void |
|
| 95 | 95 | { |
| 96 | 96 | $this->config->modify( |
| 97 | 97 | StemplerConfig::CONFIG, |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | ); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function addVisitor(string|Autowire|VisitorInterface $visitor, int $stage = Builder::STAGE_COMPILE): void |
|
| 102 | + public function addVisitor(string | Autowire | VisitorInterface $visitor, int $stage = Builder::STAGE_COMPILE): void |
|
| 103 | 103 | { |
| 104 | 104 | $this->config->modify( |
| 105 | 105 | StemplerConfig::CONFIG, |
| 106 | - new Append('visitors.' . $stage, null, $visitor) |
|
| 106 | + new Append('visitors.'.$stage, null, $visitor) |
|
| 107 | 107 | ); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | ViewsConfig $viewConfig |
| 114 | 114 | ): StemplerEngine { |
| 115 | 115 | $cache = null; |
| 116 | - if ($viewConfig->isCacheEnabled()) { |
|
| 116 | + if ($viewConfig->isCacheEnabled()){ |
|
| 117 | 117 | $cache = new StemplerCache($viewConfig->getCacheDirectory()); |
| 118 | 118 | } |
| 119 | 119 | |
@@ -76,9 +76,12 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $views->addEngine(StemplerEngine::class); |
| 78 | 78 | |
| 79 | - if ($container->has(LocaleProcessor::class)) { |
|
| 79 | + if ($container->has(LocaleProcessor::class)) |
|
| 80 | + { |
|
| 80 | 81 | $this->addProcessor(LocaleProcessor::class); |
| 81 | - } else { |
|
| 82 | + } |
|
| 83 | + else |
|
| 84 | + { |
|
| 82 | 85 | $this->addProcessor(NullLocaleProcessor::class); |
| 83 | 86 | } |
| 84 | 87 | } |
@@ -113,7 +116,8 @@ discard block |
||
| 113 | 116 | ViewsConfig $viewConfig |
| 114 | 117 | ): StemplerEngine { |
| 115 | 118 | $cache = null; |
| 116 | - if ($viewConfig->isCacheEnabled()) { |
|
| 119 | + if ($viewConfig->isCacheEnabled()) |
|
| 120 | + { |
|
| 117 | 121 | $cache = new StemplerCache($viewConfig->getCacheDirectory()); |
| 118 | 122 | } |
| 119 | 123 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | private readonly InvokerStrategyInterface $invoker, |
| 13 | 13 | ScopeInterface $scope, |
| 14 | 14 | InitializerInterface $initializer |
| 15 | - ) { |
|
| 15 | + ){ |
|
| 16 | 16 | parent::__construct($scope, $initializer); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function __construct( |
| 8 | 8 | private readonly array $values |
| 9 | - ) { |
|
| 9 | + ){ |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | public function __toString() |