Failed Conditions
Push — master ( 5f60a5...9b80eb )
by Rafael
21:42
created

IsStringViewHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 25%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 23
ccs 2
cts 8
cp 0.25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A evaluateCondition() 0 3 2
A initializeArguments() 0 4 1
1
<?php
2
namespace ApacheSolrForTypo3\Solr\ViewHelpers\Backend;
3
4
/***************************************************************
5
 *  Copyright notice
6
 *
7
 *  (c) 2017 Rafael Kähm <[email protected]>
8
 *  All rights reserved
9
 *
10
 *  This script is part of the TYPO3 project. The TYPO3 project is
11
 *  free software; you can redistribute it and/or modify
12
 *  it under the terms of the GNU General Public License as published by
13
 *  the Free Software Foundation; either version 3 of the License, or
14
 *  (at your option) any later version.
15
 *
16
 *  The GNU General Public License can be found at
17
 *  http://www.gnu.org/copyleft/gpl.html.
18
 *
19
 *  This script is distributed in the hope that it will be useful,
20
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 *  GNU General Public License for more details.
23
 *
24
 *  This copyright notice MUST APPEAR in all copies of the script!
25
 ***************************************************************/
26
27
28
use TYPO3\CMS\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
     * @return void
40
     */
41
    public function initializeArguments()
42
    {
43
        parent::initializeArguments();
44
        $this->registerArgument('value', 'mixed', 'Value to be verified.', true);
45
    }
46
47
    /**
48
     * This method decides if the condition is true or false
49
     *
50
     * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper.
51
     * @return bool
52
     */
53 2
    protected static function evaluateCondition($arguments = null)
54
    {
55 2
        return (isset($arguments['value']) && is_string($arguments['value']));
56
    }
57
}
58