Completed
Push — master ( 184560...9805df )
by ARCANEDEV
21s queued 18s
created

RouteRegistrar::forwardCallToRouter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
nc 1
dl 0
loc 4
ccs 2
cts 2
cp 1
c 0
b 0
f 0
cc 1
nop 3
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanedev\Support\Routing;
6
7
use Arcanedev\Support\Routing\Concerns\RegistersRouteClasses;
8
use Illuminate\Contracts\Foundation\Application;
9
use Illuminate\Contracts\Routing\Registrar;
10
use Illuminate\Routing\Router;
11
use Illuminate\Support\Traits\ForwardsCalls;
12
13
/**
14
 * Class     RouteRegistrar
15
 *
16
 * @package  Arcanedev\Support\Routing
17
 * @author   ARCANEDEV <[email protected]>
18
 *
19
 * @method  \Illuminate\Routing\RouteRegistrar  bind(string $key, \Closure $binder)
20
 * @method  void                                map()
21
 * @method  void                                bindings()
22
 *
23
 * @mixin  \Illuminate\Routing\RouteRegistrar
24
 */
25
abstract class RouteRegistrar
26
{
27
    /* -----------------------------------------------------------------
28
     |  Traits
29
     | -----------------------------------------------------------------
30
     */
31
32
    use RegistersRouteClasses,
33
        ForwardsCalls;
34
35
    /* -----------------------------------------------------------------
36
     |  Other Methods
37
     | -----------------------------------------------------------------
38
     */
39
40
    /**
41
     * Pass dynamic methods onto the router instance.
42
     *
43
     * @param  string  $method
44
     * @param  array   $parameters
45
     *
46
     * @return mixed
47
     */
48 114
    public function __call($method, $parameters)
49
    {
50 114
        return $this->forwardCallToRouter(
51 114
            app(Router::class), $method, $parameters
52
        );
53
    }
54
55
    /**
56
     * Pass dynamic methods onto the router instance.
57
     *
58
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
59
     * @param  string                                   $method
60
     * @param  array                                    $parameters
61
     *
62
     * @return mixed
63
     */
64 114
    protected function forwardCallToRouter(Registrar $router, $method, $parameters)
65
    {
66 114
        return $this->forwardCallTo($router, $method, $parameters);
67
    }
68
}
69