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

CPS-IT / handlebars-forms / 23242418874

18 Mar 2026 11:26AM UTC coverage: 0.0%. Remained the same
23242418874

push

github

eliashaeussler
[BUGFIX] Ignore unsupported `ValueCollector` cache identifiers

0 of 6 new or added lines in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

0 of 760 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/Classes/ContentObject/Context/ValueCollector.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "handlebars_forms".
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\Typo3HandlebarsForms\ContentObject\Context;
19

20
use CPSIT\Typo3HandlebarsForms\ContentObject;
21
use Symfony\Component\DependencyInjection;
22
use TYPO3\CMS\Core;
23

24
/**
25
 * ValueCollector
26
 *
27
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
28
 * @license GPL-2.0-or-later
29
 *
30
 * @internal
31
 */
32
final readonly class ValueCollector
33
{
34
    private const CACHE_IDENTIFIER_PREFIX = 'HandlebarsFormsValue_';
35

36
    public function __construct(
×
37
        #[DependencyInjection\Attribute\Autowire(service: 'cache.runtime')]
38
        private Core\Cache\Frontend\FrontendInterface $cache,
39
    ) {}
×
40

41
    public function save(ContentObject\AbstractHandlebarsFormsContentObject $contentObject, mixed $value): string
×
42
    {
43
        $identifier = Core\Utility\StringUtility::getUniqueId(
×
44
            self::CACHE_IDENTIFIER_PREFIX . spl_object_hash($contentObject),
×
45
        );
×
46

47
        $this->cache->set($identifier, $value);
×
48

49
        return $identifier;
×
50
    }
51

52
    public function load(string $identifier): mixed
×
53
    {
NEW
54
        if (!$this->isValidIdentifier($identifier)) {
×
NEW
55
            return null;
×
56
        }
57

58
        if (!$this->cache->has($identifier)) {
×
59
            return null;
×
60
        }
61

62
        return $this->cache->get($identifier);
×
63
    }
64

65
    public function has(string $identifier): bool
×
66
    {
NEW
67
        if (!$this->isValidIdentifier($identifier)) {
×
NEW
68
            return false;
×
69
        }
70

UNCOV
71
        return $this->cache->has($identifier);
×
72
    }
73

NEW
74
    private function isValidIdentifier(string $identifier): bool
×
75
    {
NEW
76
        return str_starts_with($identifier, self::CACHE_IDENTIFIER_PREFIX);
×
77
    }
78
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc