Passed
Push — master ( 99eb02...369f6b )
by Iman
02:44
created

RouteSituations::normalize()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 15
ccs 10
cts 10
cp 1
rs 9.9666
c 0
b 0
f 0
cc 3
nc 3
nop 2
crap 3
1
<?php
2
3
namespace Imanghafoori\HeyMan\WatchingStrategies\Routes;
4
5
final class RouteSituations
6
{
7
    /**
8
     * @param $method
9
     * @param $args
10
     *
11
     * @return array
12
     */
13 61
    public function normalize($method, $args): array
14
    {
15 61
        $normalizer = resolve(RouteNormalizer::class);
16 61
        $method = str_replace('whenYou', '', $method);
17 61
        if ($method == 'CallAction') {
18 10
            return [$normalizer->normalizeAction($args)];
19
        }
20 54
        if ($method == 'HitRouteName') {
21 11
            return [$args];
22
        }
23
24 43
        $method = str_replace('VisitUrl', 'SendGet', $method);
25 43
        $method = str_replace('Send', '', $method);
26
27 43
        return [$normalizer->normalizeUrl($args, strtoupper($method))];
28
    }
29
}
30