LoadRoutesFromBinders::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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