RoutesTrait::registerRoutes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 1
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
namespace Nip\Router\ServiceProvider\Traits;
4
5
use Nip\Router\Router;
6
7
/**
8
 * Trait RoutesTrait
9
 * @package Nip\Router\ServiceProvider\Traits
10
 */
11
trait RoutesTrait
12
{
13 3
    public function registerRoutes()
14
    {
15
        $this->getContainer()->singleton('routes', function () {
0 ignored issues
show
Bug introduced by
It seems like getContainer() 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

15
        $this->/** @scrutinizer ignore-call */ 
16
               getContainer()->singleton('routes', function () {
Loading history...
16 1
            return $this->getContainer()->get('router')->getRoutes();
17 3
        });
18 3
    }
19
}
20