Passed
Pull Request — release-11.5.x (#3206)
by Michael
41:07
created

IsStringViewHelper::evaluateCondition()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Backend;
6
7
/*
8
 * This file is part of the TYPO3 CMS project.
9
 *
10
 * It is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU General Public License, either version 2
12
 * of the License, or any later version.
13
 *
14
 * For the full copyright and license information, please read the
15
 * LICENSE.txt file that was distributed with this source code.
16
 *
17
 * The TYPO3 project - inspiring people to share!
18
 */
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
    /**
31
     * Initialize ViewHelper arguments
32
     *
33
     * @noinspection PhpUnused
34
     */
35
    public function initializeArguments()
36
    {
37
        parent::initializeArguments();
38
        $this->registerArgument('value', 'mixed', 'Value to be verified.', true);
39
    }
40
41
    /**
42
     * This method decides if the condition is true or false
43
     *
44
     * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper.
45
     * @return bool
46
     * @noinspection PhpMissingReturnTypeInspection
47
     * @noinspection PhpUnused
48
     */
49 2
    protected static function evaluateCondition($arguments = null)
50
    {
51 2
        return isset($arguments['value']) && is_string($arguments['value']);
52
    }
53
}
54