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

FluidTYPO3 / vhs / 10213662489

02 Aug 2024 09:55AM UTC coverage: 72.717% (-0.05%) from 72.762%
10213662489

push

github

NamelessCoder
[TER] 7.0.4

5533 of 7609 relevant lines covered (72.72%)

13.49 hits per line

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

41.67
/Classes/ViewHelpers/Extension/AbstractExtensionViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Extension;
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\Utility\RequestResolver;
12
use TYPO3\CMS\Core\Utility\GeneralUtility;
13
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
14
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
15
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
16

17
/**
18
 * Base class: Extension ViewHelpers
19
 */
20
abstract class AbstractExtensionViewHelper extends AbstractViewHelper
21
{
22
    /**
23
     * @var boolean
24
     */
25
    protected $escapeOutput = false;
26

27
    public function initializeArguments(): void
28
    {
29
        $this->registerArgument('extensionName', 'string', 'Name, in UpperCamelCase, of the extension to be checked');
30✔
30
    }
31

32
    protected static function getExtensionKey(array $arguments, RenderingContextInterface $renderingContext): string
33
    {
34
        /** @var string $extensionName */
35
        $extensionName = static::getExtensionName($arguments, $renderingContext);
30✔
36
        return GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName);
30✔
37
    }
38

39
    /**
40
     * @return mixed
41
     */
42
    protected static function getExtensionName(array $arguments, RenderingContextInterface $renderingContext)
43
    {
44
        /** @var RenderingContext $renderingContext */
45
        if (isset($arguments['extensionName']) && !empty($arguments['extensionName'])) {
30✔
46
            return $arguments['extensionName'];
30✔
47
        }
48
        $extensionName = RequestResolver::resolveControllerExtensionNameFromRenderingContext($renderingContext);
×
49
        if (empty($extensionName)) {
×
50
            throw new \RuntimeException(
×
51
                'Unable to read extension name from ControllerContext and value not manually specified',
×
52
                1364167519
×
53
            );
×
54
        }
55
        return $extensionName;
×
56
    }
57
}
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