RouteRegistrar::forwardCallToRouter()   A
last analyzed

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\Routing\Registrar;
9
use Illuminate\Routing\Router;
10
use Illuminate\Support\Traits\ForwardsCalls;
11
12
/**
13
 * Class     RouteRegistrar
14
 *
15
 * @author   ARCANEDEV <[email protected]>
16
 *
17
 * @method  \Illuminate\Routing\RouteRegistrar  bind(string $key, \Closure $binder)
18
 * @method  void                                map()
19
 * @method  void                                bindings()
20
 *
21
 * @mixin  \Illuminate\Routing\RouteRegistrar
22
 */
23
abstract class RouteRegistrar
24
{
25
    /* -----------------------------------------------------------------
26
     |  Traits
27
     | -----------------------------------------------------------------
28
     */
29
30
    use RegistersRouteClasses,
31
        ForwardsCalls;
32
33
    /* -----------------------------------------------------------------
34
     |  Other Methods
35
     | -----------------------------------------------------------------
36
     */
37
38
    /**
39
     * Pass dynamic methods onto the router instance.
40
     *
41
     * @param  string  $method
42
     * @param  array   $parameters
43
     *
44
     * @return mixed
45
     */
46 114
    public function __call($method, $parameters)
47
    {
48 114
        return $this->forwardCallToRouter(
49 57
            app(Router::class), $method, $parameters
50
        );
51
    }
52
53
    /**
54
     * Pass dynamic methods onto the router instance.
55
     *
56
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
57
     * @param  string                                   $method
58
     * @param  array                                    $parameters
59
     *
60
     * @return mixed
61
     */
62 114
    protected function forwardCallToRouter(Registrar $router, $method, $parameters)
63
    {
64 114
        return $this->forwardCallTo($router, $method, $parameters);
65
    }
66
}
67