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

FluidTYPO3 / vhs / 30001290505

23 Jul 2026 10:57AM UTC coverage: 70.309% (-1.7%) from 72.022%
30001290505

push

github

NamelessCoder
[TER] 8.0.0

4819 of 6854 relevant lines covered (70.31%)

6.54 hits per line

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

95.45
/Classes/ViewHelpers/Iterator/ImplodeViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Iterator;
3

4
/*
5
 * This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.md file that was distributed with this source code.
9
 */
10

11
use FluidTYPO3\Vhs\Core\ViewHelper\AbstractViewHelper;
12
use FluidTYPO3\Vhs\Traits\ArrayConsumingViewHelperTrait;
13
use FluidTYPO3\Vhs\Traits\TemplateVariableViewHelperTrait;
14
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
15

16
/**
17
 * Implode ViewHelper
18
 *
19
 * Implodes an array or array-convertible object by $glue.
20
 */
21
class ImplodeViewHelper extends AbstractViewHelper
22
{
23
    use TemplateVariableViewHelperTrait;
24
    use ArrayConsumingViewHelperTrait;
25

26
    /**
27
     * @var boolean
28
     */
29
    protected $escapeChildren = false;
30

31
    /**
32
     * @var boolean
33
     */
34
    protected $escapeOutput = false;
35

36
    public function initializeArguments(): void
37
    {
38
        parent::initializeArguments();
3✔
39

40
        $this->registerArgument('content', 'array', 'Array or array-convertible object to be imploded by glue');
3✔
41
        $this->registerArgument(
3✔
42
            'glue',
3✔
43
            'string',
3✔
44
            'String used as glue in the string to be exploded. To read a constant (like PHP_EOL) use v:const.',
3✔
45
            false,
3✔
46
            ','
3✔
47
        );
3✔
48
        $this->registerAsArgument();
3✔
49
    }
50

51
    /**
52
     * @return mixed
53
     */
54
    public static function renderStatic(
55
        array $arguments,
56
        \Closure $renderChildrenClosure,
57
        RenderingContextInterface $renderingContext
58
    ) {
59
        /** @var string|null $as */
60
        $as = $arguments['as'];
6✔
61
        /** @var array $content */
62
        $content = !empty($as)
6✔
63
            ? $arguments['content']
×
64
            : ($arguments['content'] ?? $renderChildrenClosure());
6✔
65
        /** @var string $glue */
66
        $glue = $arguments['glue'];
6✔
67
        $output = implode($glue, $content);
6✔
68
        return static::renderChildrenWithVariableOrReturnInputStatic(
6✔
69
            $output,
6✔
70
            $as,
6✔
71
            $renderingContext,
6✔
72
            $renderChildrenClosure
6✔
73
        );
6✔
74
    }
75
}
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