• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CPS-IT / handlebars / 22660183928

04 Mar 2026 07:53AM UTC coverage: 90.285% (-8.8%) from 99.094%
22660183928

push

github

eliashaeussler
Merge branch '1.x'

1277 of 1418 new or added lines in 66 files covered. (90.06%)

2 existing lines in 1 file now uncovered.

1329 of 1472 relevant lines covered (90.29%)

6.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
/Classes/Renderer/Variables/TypoScriptVariableProvider.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "handlebars".
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17

18
namespace CPSIT\Typo3Handlebars\Renderer\Variables;
19

20
use CPSIT\Typo3Handlebars\Configuration;
21
use TYPO3\CMS\Extbase;
22

23
/**
24
 * TypoScriptVariableProvider
25
 *
26
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
27
 * @license GPL-2.0-or-later
28
 */
29
final class TypoScriptVariableProvider implements VariableProvider
30
{
31
    /**
32
     * @var array<string, mixed>|null
33
     */
34
    private ?array $variables = null;
35

36
    public function __construct(
5✔
37
        private readonly Extbase\Configuration\ConfigurationManagerInterface $configurationManager,
38
    ) {}
5✔
39

40
    public function get(): array
3✔
41
    {
42
        if ($this->variables === null) {
3✔
43
            $this->variables = $this->fetchVariables();
3✔
44
        }
45

46
        return $this->variables;
3✔
47
    }
48

49
    public function offsetExists(mixed $offset): bool
1✔
50
    {
51
        return isset($this->get()[$offset]);
1✔
52
    }
53

54
    public function offsetGet(mixed $offset): mixed
1✔
55
    {
56
        return $this->get()[$offset] ?? null;
1✔
57
    }
58

59
    public function offsetSet(mixed $offset, mixed $value): never
1✔
60
    {
61
        throw new \LogicException('Variables cannot be modified.', 1736274326);
1✔
62
    }
63

64
    public function offsetUnset(mixed $offset): never
1✔
65
    {
66
        throw new \LogicException('Variables cannot be modified.', 1736274336);
1✔
67
    }
68

NEW
69
    public static function getPriority(): int
×
70
    {
NEW
71
        return 50;
×
72
    }
73

74
    /**
75
     * @return array<string, mixed>
76
     */
77
    private function fetchVariables(): array
3✔
78
    {
79
        $typoScriptConfiguration = $this->configurationManager->getConfiguration(
3✔
80
            Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK,
3✔
81
            Configuration\Extension::NAME,
3✔
82
        );
3✔
83

84
        return $typoScriptConfiguration['variables'] ?? [];
3✔
85
    }
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc