LoadRoutesFromBinders   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 29
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A loadRoutes() 0 8 2
1
<?php
2
3
namespace Mosaic\Routing\Loaders;
4
5
use Mosaic\Routing\RouteBinder;
6
use Mosaic\Routing\RouteLoader;
7
use Mosaic\Routing\Router;
8
9
class LoadRoutesFromBinders implements RouteLoader
10
{
11
    /**
12
     * @var RouteBinder[]
13
     */
14
    private $binders;
15
16
    /**
17
     * @param RouteBinder ...$binders
18
     */
19 5
    public function __construct(RouteBinder ...$binders)
20
    {
21 5
        $this->binders = $binders;
22 5
    }
23
24
    /**
25
     * @param Router $router
26
     *
27
     * @return Router
28
     */
29 2
    public function loadRoutes(Router $router) : Router
30
    {
31 2
        foreach ($this->binders as $binder) {
32 2
            $binder->bind($router);
33
        }
34
35 2
        return $router;
36
    }
37
}
38