StrToUpper::apply()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Oliverde8\Component\RuleEngine\Rules;
6
7
use Oliverde8\Component\RuleEngine\Exceptions\RuleOptionMissingException;
8
9
/**
10
 * Class StrToLower
11
 *
12
 * @author    de Cramer Oliver<[email protected]>
13
 * @copyright 2018 Oliverde8
14
 * @package Oliverde8\Component\RuleEngine\Rules
15
 */
16
class StrToUpper extends AbstractRule
17
{
18
    /**
19 1
     * @inheritdoc
20
     */
21 1
    public function apply(array $rowData, array &$transformedData, array $options = []): string
22 1
    {
23
        $value = $options['value'];
24 1
        unset($options['value']);
25
26
        return strtoupper($this->ruleApplier->apply($rowData, $transformedData, $value, $options));
0 ignored issues
show
Bug introduced by
It seems like $this->ruleApplier->appl...Data, $value, $options) can also be of type null; however, parameter $string of strtoupper() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

26
        return strtoupper(/** @scrutinizer ignore-type */ $this->ruleApplier->apply($rowData, $transformedData, $value, $options));
Loading history...
27
    }
28
29
    /**
30 1
     * @inheritdoc
31
     */
32 1
    public function validate(array $options): void
33 1
    {
34
        $this->requireOption('value', $options);
35
    }
36
37
    /**
38 1
     * @inheritdoc
39
     */
40 1
    public function getRuleCode(): string
41
    {
42
        return 'str_upper';
43
    }
44
}