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

MenuRepository::whereParent()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Mark
5
 * Date: 13/03/2016
6
 * Time: 19:52.
7
 */
8
9
namespace App\Classes\Repositories;
10
11
use App\Model\Menu;
12
use Illuminate\Support\Collection;
13
use Illuminate\Database\Eloquent\Builder;
14
use Illuminate\Database\Eloquent\Relations\HasMany;
15
16
/**
17
 * Class MenuRepository.
18
 *
19
 * @method Menu withTrashed
20
 */
21
class MenuRepository extends BaseRepository
22
{
23
    /**
24
     * @var Menu|Builder|Collection
25
     */
26
    protected $model;
27
28
    /**
29
     * PageRepository constructor.
30
     *
31
     * @param Menu $model
32
     */
33
    public function __construct(Menu $model)
34
    {
35
        $this->model = $model;
36
    }
37
38
    /**
39
     * Frontend requires that a organised list of menus is returned.
40
     *
41
     * @return \Illuminate\Database\Eloquent\Collection|static[]
42
     */
43
    public function organisedMenuList()
44
    {
45
        return $this->model->whereNull('parent_id')->where('status', true)->with('page')->orderBy('order', 'asc')->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

45
        return $this->model->whereNull('parent_id')->where('status', true)->with('page')->orderBy('order', 'asc')->/** @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...
46
    }
47
48
    /**
49
     * Top level menus, without any further parents.
50
     *
51
     * @return \Illuminate\Database\Eloquent\Collection|static[]
52
     */
53
    public function whereTopLevel()
54
    {
55
        return $this->model->whereNull('parent_id')->orderBy('order', 'asc')->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

55
        return $this->model->whereNull('parent_id')->orderBy('order', 'asc')->/** @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...
56
    }
57
58
    public function whereTopLevelEditable()
59
    {
60
        return $this->model->where('lock', false)->whereNull('parent_id')->orderBy('order', 'asc')->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

60
        return $this->model->where('lock', false)->whereNull('parent_id')->orderBy('order', 'asc')->/** @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...
61
    }
62
63
    /**
64
     * Where the menu belongs to a another menu.
65
     *
66
     * @param int $integer
67
     * @return \Illuminate\Database\Eloquent\Collection|static[]
68
     */
69
    public function whereParent(int $integer)
70
    {
71
        return ($integer == 1) ? $this->whereTopLevel() : $this->model->where('parent_id', $integer)->orderBy('order', 'asc')->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

71
        return ($integer == 1) ? $this->whereTopLevel() : $this->model->where('parent_id', $integer)->orderBy('order', 'asc')->/** @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...
72
    }
73
74
    /**
75
     * @return \Illuminate\Database\Eloquent\Collection|static[]
76
     */
77
    public function allParentsWithChildren()
78
    {
79
        return $this->model->whereNull('parent_id')->with(['children' => function (HasMany $children) {
0 ignored issues
show
Unused Code introduced by
The parameter $children is not used and could be removed. ( Ignorable by Annotation )

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

79
        return $this->model->whereNull('parent_id')->with(['children' => function (/** @scrutinizer ignore-unused */ HasMany $children) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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
        }])->orderBy('order', 'asc')->/** @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
        }])->orderBy('order', 'asc')->get();
81
    }
82
}
83