Completed
Push — master ( 86604e...2a88db )
by ARCANEDEV
12s
created

Http/Controllers/Admin/System/RoutesController.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php namespace Arcanesoft\Foundation\Http\Controllers\Admin\System;
2
3
use Arcanedev\RouteViewer\Contracts\RouteViewer;
4
use Arcanesoft\Foundation\Policies\RouteViewerPolicy;
5
6
/**
7
 * Class     RoutesController
8
 *
9
 * @package  Arcanesoft\Foundation\Http\Controllers\System
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class RoutesController extends Controller
13
{
14
    /* -----------------------------------------------------------------
15
     |  Properties
16
     | -----------------------------------------------------------------
17
     */
18
19
    /**
20
     * The route viewer instance.
21
     *
22
     * @var \Arcanedev\RouteViewer\Contracts\RouteViewer
23
     */
24
    protected $routeViewer;
25
26
    /* -----------------------------------------------------------------
27
     |  Constructor
28
     | -----------------------------------------------------------------
29
     */
30
31
    /**
32
     * RoutesController constructor.
33
     *
34
     * @param  \Arcanedev\RouteViewer\Contracts\RouteViewer  $routeViewer
35
     */
36
    public function __construct(RouteViewer $routeViewer)
37
    {
38
        parent::__construct();
39
40
        $this->routeViewer = $routeViewer;
41
42
        $this->setCurrentPage('foundation-system-routes');
43
        $this->addBreadcrumbRoute(trans('foundation::route-viewer.titles.routes'), 'admin::foundation.system.routes.index');
44
    }
45
46
    /* -----------------------------------------------------------------
47
     |  Main Methods
48
     | -----------------------------------------------------------------
49
     */
50
51
    public function index()
52
    {
53
        $this->authorize(RouteViewerPolicy::PERMISSION_LIST);
0 ignored issues
show
Documentation Bug introduced by
The method authorize does not exist on object<Arcanesoft\Founda...ystem\RoutesController>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
54
55
        $this->setTitle($title = trans('foundation::route-viewer.titles.routes-list'));
56
        $this->addBreadcrumb($title);
57
58
        return $this->view('admin.system.routes.list', [
59
            'routes' => $this->routeViewer->all()
60
        ]);
61
    }
62
}
63