Passed
Pull Request — release-11.2.x (#3594)
by Markus
14:43 queued 10:47
created

IsStringViewHelper::evaluateCondition()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Backend;
4
5
/***************************************************************
6
 *  Copyright notice
7
 *
8
 *  (c) 2017 Rafael Kähm <[email protected]>
9
 *  All rights reserved
10
 *
11
 *  This script is part of the TYPO3 project. The TYPO3 project is
12
 *  free software; you can redistribute it and/or modify
13
 *  it under the terms of the GNU General Public License as published by
14
 *  the Free Software Foundation; either version 3 of the License, or
15
 *  (at your option) any later version.
16
 *
17
 *  The GNU General Public License can be found at
18
 *  http://www.gnu.org/copyleft/gpl.html.
19
 *
20
 *  This script is distributed in the hope that it will be useful,
21
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 *  GNU General Public License for more details.
24
 *
25
 *  This copyright notice MUST APPEAR in all copies of the script!
26
 ***************************************************************/
27
28
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
29
30
/**
31
 * Condition for checking if type is a string.
32
 */
33
class IsStringViewHelper extends AbstractConditionViewHelper
34
{
35
36
    /**
37
     * Initialize ViewHelper arguments
38
     */
39
    public function initializeArguments()
40
    {
41
        parent::initializeArguments();
42
        $this->registerArgument('value', 'mixed', 'Value to be verified.', true);
43
    }
44
45
    /**
46
     * This method decides if the condition is true or false
47
     *
48
     * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper.
49
     * @return bool
50
     */
51
    protected static function evaluateCondition($arguments = null)
52
    {
53 2
        return isset($arguments['value']) && is_string($arguments['value']);
54
    }
55
}
56