RouteUrlsNormalizer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 17
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 6 1
A normalizeUrl() 0 7 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\Plugins\WatchingStrategies\Routes;
4
5
final class RouteUrlsNormalizer
6
{
7 48
    public function normalize($method, $args)
8
    {
9 48
        $method = str_replace('VisitUrl', 'SendGet', $method);
10 48
        $method = str_replace('whenYouSend', '', $method);
11
12 48
        return [$this->normalizeUrl($args, strtoupper($method))];
13
    }
14
15
    private function normalizeUrl($urls, $verb = 'GET')
16
    {
17 48
        $removeSlash = function ($url) use ($verb) {
18 48
            return $verb.ltrim($url, '/');
19 48
        };
20
21 48
        return array_map($removeSlash, $urls);
22
    }
23
}
24