Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( 7fd57f...ddf3cc )
by Mark
02:55
created

GeneratePageRoutes::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Console\Commands;
4
5
use App\Classes\PageRouteBuilder;
6
use App\Classes\Repositories\MenuRepository;
7
use App\Classes\Repositories\PageRepository;
8
use App\Model\Menu;
9
use App\Model\Page;
10
use Illuminate\Console\Command;
11
12
class GeneratePageRoutes extends Command
13
{
14
15
    /**
16
     * @var MenuRepository
17
     */
18
    private $menus;
19
20
    /**
21
     * The name and signature of the console command.
22
     *
23
     * @var string
24
     */
25
    protected $signature = 'page.routes.generate';
26
27
    /**
28
     * The console command description.
29
     *
30
     * @var string
31
     */
32
    protected $description = 'Generate the page routes based on the linked menus.';
33
34
    /**
35
     * Create a new command instance.
36
     *
37
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
38
     */
39
    public function __construct(MenuRepository $menus)
40
    {
41
        parent::__construct();
42
43
        $this->menus = $menus;
44
    }
45
46
    /**
47
     * Execute the console command.
48
     *
49
     * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use boolean.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
50
     */
51
    public function handle()
52
    {
53
        /** @var Menu $menu */
54
        foreach ($this->menus->all() as $menu)
55
        {
56
            PageRouteBuilder::link($menu->page, $menu);
57
58
            $this->info("{$menu->title} was linked to {$menu->page->slug}");
59
        }
60
61
        return true;
62
    }
63
}
64