GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( b2510c...ee0bb8 )
by
unknown
12:46
created

Restore::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 12
loc 12
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
ccs 0
cts 10
cp 0
crap 2
rs 9.4285
1
<?php
2
3
4
namespace SleepingOwl\Admin\Form\Buttons;
5
6
/**
7
 * Class Save.
8
 */
9 View Code Duplication
class Restore extends FormButton
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
10
{
11
    protected $show = true;
12
    protected $name = 'restore';
13
    protected $iconClass = 'fa-reply';
14
15
    public function __construct()
16
    {
17
        $this->setText(trans('sleeping_owl::lang.table.restore'));
18
    }
19
20
    /**
21
     * Init Cancel Button.
22
     */
23
    public function initialize()
24
    {
25
        parent::initialize();
26
27
        $this->setHtmlAttributes([
28
            'type'  => 'submit',
29
            'name'  => 'next_action',
30
            'class' => 'btn btn-warning',
31
            'data-url'=> $this->getModelConfiguration()->getRestoreUrl($this->getModel()->getKey()),
32
            'data-redirect'=> $this->getModelConfiguration()->getEditUrl($this->getModel()->getKey()),
33
        ]);
34
    }
35
36
    /**
37
     * @return bool
38
     */
39
    public function canShow()
40
    {
41
        if (is_null($this->getModel()->getKey()) || ! $this->show) {
42
            return false;
43
        }
44
45
        $this->show = $this->isTrashed() &&
46
            $this->getModelConfiguration()->isRestorable($this->getModel());
47
    }
48
}
49