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

IsStringViewHelper::initializeArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
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