CheckPupilGenderStep::process()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 17
rs 9.9
c 0
b 0
f 0
cc 3
nc 3
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Jtotty\Steps;
6
7
use Port\Steps\Step;
8
9
class CheckPupilGenderStep implements Step
10
{
11
    public function process($item, callable $next)
12
    {
13
        switch (strtoupper(substr($item['Gender'], 0, 1))) {
14
            case 'F':
15
                $item['Gender'] = 'F';
16
                break;
17
18
            case 'M':
19
                $item['Gender'] = 'M';
20
                break;
21
22
            default:
23
                $item['Gender'] = 'invalid';
24
                break;
25
        }
26
27
        return $next($item);
28
    }
29
}
30