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

PageRepository::enabled()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Mark
5
 * Date: 04/03/2016
6
 * Time: 23:07.
7
 */
8
9
namespace App\Classes\Repositories;
10
11
use App\Model\Page;
12
use Illuminate\Support\Collection;
13
use Illuminate\Database\Eloquent\Builder;
14
15
/**
16
 * Class PageRepository.
17
 *
18
 * @method Page withTrashed
19
 */
20
class PageRepository extends BaseRepository
21
{
22
    /**
23
     * @var Page|Builder|Collection
24
     */
25
    protected $model;
26
27
    /**
28
     * PageRepository constructor.
29
     *
30
     * @param Page $model
31
     */
32
    public function __construct(Page $model)
33
    {
34
        $this->model = $model;
35
    }
36
37
    public function allNormalPages()
38
    {
39
        return $this->model->where('special', '=', false)->get();
0 ignored issues
show
Bug introduced by
The call to Illuminate\Support\Collection::get() has too few arguments starting with key. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
        return $this->model->where('special', '=', false)->/** @scrutinizer ignore-call */ get();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
40
    }
41
42
    public function allSpecialPages()
43
    {
44
        return $this->model->where('special', '=', true)->get();
0 ignored issues
show
Bug introduced by
The call to Illuminate\Support\Collection::get() has too few arguments starting with key. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
        return $this->model->where('special', '=', true)->/** @scrutinizer ignore-call */ get();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
45
    }
46
47
    public function whereIdentifier(string $string)
48
    {
49
        return $this->model->where('identifier', $string)->first();
50
    }
51
52
    /**
53
     * @param $plugin_name
54
     * @return mixed
55
     */
56
    public function restoreTrashedPlugin($plugin_name)
57
    {
58
        return $this->model->withTrashed()->where('plugin', $plugin_name)->restore();
59
    }
60
61
    /**
62
     * @return mixed
63
     */
64
    public function makeList() : array
65
    {
66
        return $this->model->pluck('seo_title', 'id')->toArray();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->model->plu...itle', 'id')->toArray() could return the type Illuminate\Database\Eloq...nate\Support\Collection which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
67
    }
68
69
    /**
70
     * @deprecated
71
     */
72
    public function listAllPagesWithoutMenusAndEditable()
73
    {
74
        return $this->model->where('editable', true)->doesntHave('menu')->pluck('seo_title', 'id');
75
    }
76
77
    public function listPagesWithoutMenus()
78
    {
79
        return $this->model->doesntHave('menu')->get();
0 ignored issues
show
Bug introduced by
The call to Illuminate\Support\Collection::get() has too few arguments starting with key. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

79
        return $this->model->doesntHave('menu')->/** @scrutinizer ignore-call */ get();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
80
    }
81
82
    public function allPagesWithoutMenusAndEditable() : Collection
83
    {
84
        return $this->model->where('editable', true)->doesntHave('menus')->get();
0 ignored issues
show
Bug introduced by
The call to Illuminate\Support\Collection::get() has too few arguments starting with key. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

84
        return $this->model->where('editable', true)->doesntHave('menus')->/** @scrutinizer ignore-call */ get();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
85
    }
86
87
    /**
88
     * Get the page based on its name.
89
     *
90
     * @param $string
91
     * @return Page|array|\stdClass
92
     */
93
    public function whereName($string) : Page
94
    {
95
        return $this->model->where('slug', $string)->first();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->model->whe...lug', $string)->first() could return the type null which is incompatible with the type-hinted return App\Model\Page. Consider adding an additional type-check to rule them out.
Loading history...
96
    }
97
98
    /**
99
     * @param $string
100
     * @return Page
101
     */
102
    public function whereRoute($string) : Page
103
    {
104
        return $this->model->where('route', $string)->first();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->model->whe...ute', $string)->first() could return the type null which is incompatible with the type-hinted return App\Model\Page. Consider adding an additional type-check to rule them out.
Loading history...
105
    }
106
107
    /**
108
     * @param $string
109
     * @return Page
110
     */
111
    public function wherePlugin($string) : Page
112
    {
113
        return $this->model->where('plugin', $string)->first();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->model->whe...gin', $string)->first() could return the type null which is incompatible with the type-hinted return App\Model\Page. Consider adding an additional type-check to rule them out.
Loading history...
114
    }
115
116
    /**
117
     * Sitemap enabled pages.
118
     */
119
    public function whereSitemap() : Collection
120
    {
121
        return $this->model->where('sitemap', true)->where('enabled', true)->get();
0 ignored issues
show
Bug introduced by
The call to Illuminate\Support\Collection::get() has too few arguments starting with key. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

121
        return $this->model->where('sitemap', true)->where('enabled', true)->/** @scrutinizer ignore-call */ get();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
122
    }
123
124
    /**
125
     * Return all pages that are enabled.
126
     */
127
    public function enabled() : Collection
128
    {
129
        return $this->model->where('enabled', true)->get();
0 ignored issues
show
Bug introduced by
The call to Illuminate\Support\Collection::get() has too few arguments starting with key. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

129
        return $this->model->where('enabled', true)->/** @scrutinizer ignore-call */ get();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
130
    }
131
132
    public function frontendPageCollection()
133
    {
134
        return $this->model->with(['menu'])->get();
0 ignored issues
show
Bug introduced by
The call to Illuminate\Support\Collection::get() has too few arguments starting with key. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

134
        return $this->model->with(['menu'])->/** @scrutinizer ignore-call */ get();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
135
//        return $this->with(['menu' => function ($query) {
136
//            $query->with('parent');
137
//        }])->get();
138
    }
139
}
140