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

CPS-IT / handlebars / 15435790164

04 Jun 2025 07:02AM UTC coverage: 90.653% (-2.3%) from 92.973%
15435790164

Pull #433

github

web-flow
Merge 38624bcbf into 739d62199
Pull Request #433: [!!!][FEATURE] Switch rendering library to `devtheorem/php-handlebars`

57 of 83 new or added lines in 9 files covered. (68.67%)

1096 of 1209 relevant lines covered (90.65%)

3.99 hits per line

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

0.0
/Classes/Renderer/Component/Layout/HandlebarsLayoutStack.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "handlebars".
7
 *
8
 * Copyright (C) 2025 Elias Häußler <e.haeussler@familie-redlich.de>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace Fr\Typo3Handlebars\Renderer\Component\Layout;
25

26
use TYPO3\CMS\Core;
27

28
/**
29
 * HandlebarsLayoutStack
30
 *
31
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
32
 * @license GPL-2.0-or-later
33
 */
34
final class HandlebarsLayoutStack implements Core\SingletonInterface
35
{
36
    /**
37
     * @var HandlebarsLayout[]
38
     */
39
    private array $stack = [];
40

NEW
41
    public function push(HandlebarsLayout $layout): self
×
42
    {
NEW
43
        $this->stack[] = $layout;
×
44

NEW
45
        return $this;
×
46
    }
47

NEW
48
    public function pop(): ?HandlebarsLayout
×
49
    {
NEW
50
        return array_pop($this->stack);
×
51
    }
52

NEW
53
    public function first(): ?HandlebarsLayout
×
54
    {
NEW
55
        $first = reset($this->stack);
×
56

NEW
57
        if ($first === false) {
×
NEW
58
            return null;
×
59
        }
60

NEW
61
        return $first;
×
62
    }
63

NEW
64
    public function last(): ?HandlebarsLayout
×
65
    {
NEW
66
        $last = end($this->stack);
×
67

NEW
68
        if ($last === false) {
×
NEW
69
            return null;
×
70
        }
71

NEW
72
        return $last;
×
73
    }
74

75
    /**
76
     * @return HandlebarsLayout[]
77
     */
NEW
78
    public function all(): array
×
79
    {
NEW
80
        return $this->stack;
×
81
    }
82

NEW
83
    public function reverse(): self
×
84
    {
NEW
85
        $clone = clone $this;
×
NEW
86
        $clone->stack = array_reverse($this->stack);
×
87

NEW
88
        return $clone;
×
89
    }
90

NEW
91
    public function reset(): void
×
92
    {
NEW
93
        $this->stack = [];
×
94
    }
95

96
    /**
97
     * @phpstan-assert-if-false HandlebarsLayout $this->pop()
98
     * @phpstan-assert-if-false HandlebarsLayout $this->first()
99
     * @phpstan-assert-if-false HandlebarsLayout $this->last()
100
     */
NEW
101
    public function isEmpty(): bool
×
102
    {
NEW
103
        return $this->stack === [];
×
104
    }
105
}
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