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

RouteSituations   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 10
dl 0
loc 23
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 15 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