RouteActionNormalizer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A normalizeAction() 0 11 2
A normalize() 0 3 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\Plugins\WatchingStrategies\Routes;
4
5
use Illuminate\Support\Str;
6
7
final class RouteActionNormalizer
8
{
9 10
    public function normalize($method, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $method is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

9
    public function normalize(/** @scrutinizer ignore-unused */ $method, $args)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
10
    {
11 10
        return [$this->normalizeAction($args)];
12
    }
13
14
    public function normalizeAction($actions)
15
    {
16 10
        $addNamespace = function ($action) {
17 10
            if (Str::startsWith($action, '\\')) {
18 8
                return $action;
19
            }
20
21 2
            return app()->getNamespace().'Http\\Controllers\\'.$action;
0 ignored issues
show
introduced by
The method getNamespace() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
            return app()->/** @scrutinizer ignore-call */ getNamespace().'Http\\Controllers\\'.$action;
Loading history...
22 10
        };
23
24 10
        return array_map($addNamespace, $actions);
25
    }
26
}
27