RouteLoaderTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 12
ccs 0
cts 4
cp 0
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadFromIncludedPhp() 0 6 2
1
<?php
2
3
namespace Nip\Router\RouteCollections\Traits;
4
5
use Symfony\Component\Routing\RouteCollection;
6
7
/**
8
 * Trait RouteLoaderTrait
9
 * @package Nip\Router\RouteCollections\Traits
10
 */
11
trait RouteLoaderTrait
12
{
13
14
    /**
15
     * @param $path
16
     */
17
    public function loadFromIncludedPhp($path)
18
    {
19
        /** @noinspection PhpIncludeInspection */
20
        $collection = require $path;
21
        if ($collection instanceof RouteCollection) {
22
            $this->addCollection($collection);
0 ignored issues
show
Bug introduced by
It seems like addCollection() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

22
            $this->/** @scrutinizer ignore-call */ 
23
                   addCollection($collection);
Loading history...
23
        }
24
    }
25
}
26