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

FluidTYPO3 / vhs / 28587738246

02 Jul 2026 11:50AM UTC coverage: 69.886% (+0.1%) from 69.743%
28587738246

push

github

NamelessCoder
[TASK] Remove some always-true or always-false conditions

0 of 2 new or added lines in 2 files covered. (0.0%)

4827 of 6907 relevant lines covered (69.89%)

4.33 hits per line

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

58.82
/Classes/ViewHelpers/Render/AbstractRenderViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Render;
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 TYPO3\CMS\Core\Utility\GeneralUtility;
13
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
14
use TYPO3\CMS\Fluid\View\StandaloneView;
15
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
16
use TYPO3Fluid\Fluid\View\ViewInterface;
17

18
/**
19
 * ### Base class for all rendering ViewHelpers.
20
 *
21
 * If errors occur they can be graciously ignored and
22
 * replaced by a small error message or the error itself.
23
 */
24
abstract class AbstractRenderViewHelper extends AbstractViewHelper
25
{
26
    /**
27
     * @var ConfigurationManagerInterface
28
     */
29
    protected $configurationManager;
30

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

36
    public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager): void
37
    {
38
        $this->configurationManager = $configurationManager;
18✔
39
    }
40

41
    public function initializeArguments(): void
42
    {
43
        $this->registerArgument(
8✔
44
            'onError',
8✔
45
            'string',
8✔
46
            'Optional error message to display if error occur while rendering. If NULL, lets the error Exception ' .
8✔
47
            'pass trough (and break rendering)'
8✔
48
        );
8✔
49
        $this->registerArgument(
8✔
50
            'graceful',
8✔
51
            'boolean',
8✔
52
            'If forced to FALSE, errors are not caught but rather "transmitted" as every other error would be',
8✔
53
            false,
8✔
54
            false
8✔
55
        );
8✔
56
    }
57

58
    protected static function getPreparedNamespaces(array $arguments): array
59
    {
60
        $namespaces = [];
×
61
        foreach ((array) $arguments['namespaces'] as $namespaceIdentifier => $namespace) {
×
62
            $addedOverriddenNamespace = '{namespace ' . $namespaceIdentifier . '=' . $namespace . '}';
×
63
            $namespaces[] = $addedOverriddenNamespace;
×
64
        }
65
        return $namespaces;
×
66
    }
67

68
    protected static function getPreparedClonedView(RenderingContextInterface $renderingContext): StandaloneView
69
    {
70
        $view = static::getPreparedView();
×
71
        $newRenderingContext = $view->getRenderingContext();
×
NEW
72
        if (method_exists($renderingContext, 'getRequest') && method_exists($newRenderingContext, 'setRequest')) {
×
73
            $newRenderingContext->setRequest($renderingContext->getRequest());
×
74
        }
75
        $variables = (array) $renderingContext->getVariableProvider()->getAll();
×
76
        $view->assignMultiple($variables);
×
77
        return $view;
×
78
    }
79

80
    /**
81
     * @param \TYPO3\CMS\Extbase\Mvc\View\ViewInterface|ViewInterface $view
82
     */
83
    protected static function renderView($view, array $arguments): string
84
    {
85
        try {
86
            /** @var string|null $content */
87
            $content = $view->render();
2✔
88
        } catch (\Exception $error) {
2✔
89
            if (!($arguments['graceful'] ?? false)) {
2✔
90
                throw $error;
2✔
91
            }
92
            $content = $error->getMessage() . ' (' . $error->getCode() . ')';
×
93
        }
94
        return (string) $content;
×
95
    }
96

97
    protected static function getPreparedView(): StandaloneView
98
    {
99
        /** @var StandaloneView $view */
100
        $view = GeneralUtility::makeInstance(StandaloneView::class);
2✔
101
        return $view;
2✔
102
    }
103
}
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