Janitor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A routes() 0 15 2
A getFacadeAccessor() 0 3 1
1
<?php
2
3
namespace Signifly\Janitor\Facades;
4
5
use Illuminate\Support\Facades\Facade;
6
use Illuminate\Support\Facades\Route;
7
use Signifly\Janitor\Contracts\Factory;
8
use Signifly\Janitor\RouteRegistrar;
9
10
/**
11
 * @see \Signifly\Janitor\JanitorManager
12
 */
13
class Janitor extends Facade
14
{
15
    /**
16
     * Get the registered name of the component.
17
     *
18
     * @return string
19
     */
20
    protected static function getFacadeAccessor()
21
    {
22
        return Factory::class;
23
    }
24
25
    /**
26
     * Binds the Janitor routes into the controller.
27
     *
28
     * @param  callable|null  $callback
29
     * @param  array  $options
30
     * @return void
31
     */
32
    public static function routes($callback = null, array $options = [])
33
    {
34
        $callback = $callback ?: function ($router) {
35
            $router->all();
36
        };
37
38
        $defaultOptions = [
39
            'namespace' => '\Signifly\Janitor\Http\Controllers',
40
            'as' => 'janitor.',
41
        ];
42
43
        $options = array_merge($defaultOptions, $options);
44
45
        Route::group($options, function ($router) use ($callback) {
46
            $callback(new RouteRegistrar($router));
47
        });
48
    }
49
}
50