Completed
Push — master ( afb6b5...977461 )
by Magnar Ovedal
06:50 queued 04:03
created

UpperCaseConverter::applyCurrent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stadly\PasswordPolice\Formatter;
6
7
use Stadly\PasswordPolice\CharTree;
8
use Stadly\PasswordPolice\CodeMap\UpperCaseMap;
9
use Stadly\PasswordPolice\Formatter;
10
11
final class UpperCaseConverter implements Formatter
12
{
13
    use Chaining;
14
15
    /**
16
     * @var Coder Upper case coder.
17
     */
18
    private $upperCaseCoder;
19
20 5
    public function __construct()
21
    {
22 5
        $this->upperCaseCoder = new Coder(new UpperCaseMap());
23 5
    }
24
25
    /**
26
     * @param CharTree $charTree Character tree to format.
27
     * @return CharTree Upper case converted variant of the character tree.
28
     */
29 5
    protected function applyCurrent(CharTree $charTree): CharTree
30
    {
31 5
        return $this->upperCaseCoder->apply($charTree);
32
    }
33
}
34