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 ( ee15e1...d26226 )
by Mark
03:59
created

Page::setSitemap()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 9.4285
1
<?php
2
3
namespace App\Model;
4
5
use Carbon\Carbon;
6
use Illuminate\Database\Eloquent\Collection;
7
use OwenIt\Auditing\Auditable;
8
use App\Classes\Interfaces\AuditInterface;
9
use Illuminate\Database\Eloquent\SoftDeletes;
10
use Illuminate\Database\Eloquent\Relations\HasMany;
11
use Illuminate\Database\Eloquent\Model as EloquentModel;
12
13
/**
14
 * Class Pages.
15
 *
16
 * @property Account getPublisher
17
 * @property Redirect redirect
18
 * @property HasMany $menus
19
 *
20
 * @property int $id
21
 * @property string $slug
22
 * @property string $content
23
 * @property string $banner
24
 * @property string $seo_title
25
 * @property string $seo_description
26
 * @property string $seo_keywords
27
 * @property int $views
28
 * @property bool $sitemap
29
 * @property bool $enabled
30
 * @property string $plugin
31
 * @property int $editable
32
 * @property int $creator_id
33
 * @property int $editor_id
34
 *
35
 * @property Carbon $deleted_at
36
 * @property Carbon $created_at
37
 * @property Carbon $updated_at
38
 */
39
class Page extends EloquentModel implements AuditInterface
40
{
41
    /*
42
     * Laravel Deleting.
43
     * @ https://laravel.com/docs/5.5/eloquent#soft-deleting
44
     */
45
    use SoftDeletes;
46
    /*
47
     * Laravel Audits.
48
     * @ http://www.laravel-auditing.com
49
     */
50
    use Auditable;
51
52
    /**
53
     * The table associated with the model.
54
     *
55
     * @var string
56
     */
57
    protected $table = 'pages';
58
59
    /**
60
     * The table date columns, casted to Carbon.
61
     *
62
     * @var array
63
     */
64
    protected $dates = ['created_at', 'updated_at', 'deleted_at'];
65
66
    /**
67
     * Attributes to exclude from the Audit.
68
     *
69
     * @var array
70
     */
71
    protected $auditExclude = [
72
        'views',
73
    ];
74
75
    /**
76
     * Increment the view count of the page.
77
     *
78
     * @return int
79
     */
80
    public function incrementViews()
81
    {
82
        return $this->views = $this->views + 1;
83
    }
84
85
    /**
86
     * A page can have many menus. (Polymorphic)
87
     *
88
     * @return Collection|HasMany
89
     */
90
    public function menus()
91
    {
92
        return $this->hasMany(Menu::class, 'page_id', 'id');
93
    }
94
95
    /**
96
     * A page can have many menus. (Polymorphic)
97
     *
98
     * @return Menu|\Illuminate\Database\Eloquent\Relations\HasOne
99
     */
100
    public function menu()
101
    {
102
        return $this->hasOne(Menu::class, 'page_id', 'id');
103
    }
104
105
    /**
106
     * A page can have a redirect to another url, external or internal.
107
     *
108
     * @return Redirect|\Illuminate\Database\Eloquent\Relations\HasOne
109
     */
110
    public function redirect()
111
    {
112
        return $this->hasOne(Redirect::class, 'from', 'id');
113
    }
114
115
116
    /**
117
     * Get the creator model of the eloquent model.
118
     *
119
     * @return Account|\Illuminate\Database\Eloquent\Relations\BelongsTo
120
     */
121
    public function creator()
122
    {
123
        return $this->belongsTo(Account::class, 'creator_id', 'id');
124
    }
125
126
    /**
127
     * Get the creator model of the eloquent model.
128
     *
129
     * @return Account|\Illuminate\Database\Eloquent\Relations\BelongsTo
130
     */
131
    public function editor()
132
    {
133
        return $this->belongsTo(Account::class, 'editor_id', 'id');
134
    }
135
136
    /**
137
     * Generate a link for the audit log.
138
     *
139
     * @return string
140
     */
141
    public function auditTitle()
142
    {
143
        return $this->seo_title;
144
    }
145
146
    /**
147
     * Generate a url to the audited data.
148
     *
149
     * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use string.

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...
150
     */
151
    public function auditUrl()
152
    {
153
        return route('admin.pages.edit', $this->slug);
0 ignored issues
show
Documentation introduced by
$this->slug is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
154
    }
155
}
156