Passed
Pull Request — main (#3378)
by Mario
50:21 queued 18:39
created

IsStringViewHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 40%

Importance

Changes 0
Metric Value
wmc 3
eloc 4
c 0
b 0
f 0
dl 0
loc 24
ccs 2
cts 5
cp 0.4
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A evaluateCondition() 0 3 2
A initializeArguments() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the TYPO3 CMS project.
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17
18
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Backend;
19
20
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
21
22
/**
23
 * Condition for checking if type is a string.
24
 *
25
 * @todo: Find TYPO3/Fluid core way for that trouble and reuse it on {@link \ApacheSolrForTypo3\Tika\ViewHelpers\Backend\IsStringViewHelper}
26
 */
27
class IsStringViewHelper extends AbstractConditionViewHelper
28
{
29
    /**
30
     * Initialize ViewHelper arguments
31
     *
32
     * @noinspection PhpUnused
33
     */
34
    public function initializeArguments()
35
    {
36
        parent::initializeArguments();
37
        $this->registerArgument('value', 'mixed', 'Value to be verified.', true);
38
    }
39
40
    /**
41
     * This method decides if the condition is true or false
42
     *
43
     * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper.
44
     * @return bool
45
     * @noinspection PhpMissingReturnTypeInspection
46
     * @noinspection PhpUnused
47
     */
48 2
    protected static function evaluateCondition($arguments = null)
49
    {
50 2
        return isset($arguments['value']) && is_string($arguments['value']);
51
    }
52
}
53