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 ( acddd6...241850 )
by Cristian
12:39
created

Page   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 4
dl 0
loc 91
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Backpack\PageManager\app\Models;
4
5
use Backpack\CRUD\CrudTrait;
6
use Illuminate\Database\Eloquent\Model;
7
use Cviebrock\EloquentSluggable\Sluggable;
8
use Cviebrock\EloquentSluggable\SluggableScopeHelpers;
9
10
class Page extends Model
11
{
12
    use CrudTrait;
13
    use Sluggable;
14
    use SluggableScopeHelpers;
15
16
    /*
17
    |--------------------------------------------------------------------------
18
    | GLOBAL VARIABLES
19
    |--------------------------------------------------------------------------
20
    */
21
22
    protected $table = 'pages';
23
    protected $primaryKey = 'id';
24
    public $timestamps = true;
25
    // protected $guarded = ['id'];
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
26
    protected $fillable = ['template', 'name', 'title', 'slug', 'content', 'extras'];
27
    // protected $hidden = [];
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
28
    // protected $dates = [];
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
29
    protected $fakeColumns = ['extras'];
30
31
    /**
32
     * Return the sluggable configuration array for this model.
33
     *
34
     * @return array
35
     */
36
    public function sluggable()
37
    {
38
        return [
39
            'slug' => [
40
                'source' => 'slug_or_title',
41
            ],
42
        ];
43
    }
44
45
    /*
46
    |--------------------------------------------------------------------------
47
    | FUNCTIONS
48
    |--------------------------------------------------------------------------
49
    */
50
51
    public function getTemplateName()
52
    {
53
        return str_replace('_', ' ', title_case($template->name))
54
    }
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected '}', expecting ';'
Loading history...
55
56
    public function getPageLink()
57
    {
58
        return url($this->slug);
59
    }
60
61
    public function getOpenButton()
62
    {
63
        return '<a class="btn btn-default btn-xs" href="'.$this->getPageLink().'" target="_blank">'.
64
            '<i class="fa fa-eye"></i> '.trans('backpack::pagemanager.open').'</a>';
65
    }
66
67
    /*
68
    |--------------------------------------------------------------------------
69
    | RELATIONS
70
    |--------------------------------------------------------------------------
71
    */
72
73
    /*
74
    |--------------------------------------------------------------------------
75
    | SCOPES
76
    |--------------------------------------------------------------------------
77
    */
78
79
    /*
80
    |--------------------------------------------------------------------------
81
    | ACCESORS
82
    |--------------------------------------------------------------------------
83
    */
84
85
    // The slug is created automatically from the "name" field if no slug exists.
86
    public function getSlugOrTitleAttribute()
87
    {
88
        if ($this->slug != '') {
89
            return $this->slug;
90
        }
91
92
        return $this->title;
93
    }
94
95
    /*
96
    |--------------------------------------------------------------------------
97
    | MUTATORS
98
    |--------------------------------------------------------------------------
99
    */
100
}
101