• 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

57.14
/Classes/ViewHelpers/Math/ProductViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Math;
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\Traits\ArrayConsumingViewHelperTrait;
12
use FluidTYPO3\Vhs\Utility\ErrorUtility;
13

14
/**
15
 * ### Math: Product (multiplication)
16
 *
17
 * Product (multiplication) of $a and $b. A can be an array and $b a
18
 * number, in which case each member of $a gets multiplied by $b.
19
 * If $a is an array and $b is not provided then array_product is
20
 * used to return a single numeric value. If both $a and $b are
21
 * arrays, each member of $a is multiplied against the corresponding
22
 * member in $b compared using index.
23
 */
24
class ProductViewHelper extends AbstractMultipleMathViewHelper
25
{
26
    use ArrayConsumingViewHelperTrait;
27

28
    /**
29
     * @param mixed $a
30
     * @param mixed $b
31
     * @param array $arguments
32
     * @return mixed
33
     */
34
    protected static function calculateAction($a, $b, array $arguments)
35
    {
36
        $aIsIterable = static::assertIsArrayOrIterator($a);
3✔
37
        if (!$aIsIterable && $b === null && $arguments['fail']) {
3✔
38
            ErrorUtility::throwViewHelperException('Required argument "b" was not supplied', 1237823699);
×
39
        }
40
        if ($aIsIterable && null === $b) {
3✔
41
            $a = static::arrayFromArrayOrTraversableOrCSVStatic($a);
×
42
            return array_product($a);
×
43
        }
44
        return $a * $b;
3✔
45
    }
46
}
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