Passed
Push — release-11.0.x ( 910681...ed160c )
by Rafael
11:00
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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApacheSolrForTypo3\Tika\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\Solr\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
    protected static function evaluateCondition($arguments = null)
50
    {
51
        return isset($arguments['value']) && is_string($arguments['value']);
52
    }
53
}
54