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.
Completed
Push — master ( 0ebcf3...2447f9 )
by Vadim
02:08
created

LockedBehavior::unlock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: vadim
5
 * Date: 05.02.16
6
 * Time: 12:57
7
 */
8
9
namespace sibds\components;
10
11
12
use yii\base\Behavior;
13
14
class LockedBehavior extends Behavior
15
{
16
    public $lockedAttribute;
17
18
    public $valueLock = true;
19
    public $valueUnlock = false;
20
21
    public function events()
22
    {
23
        return [
24
            ActiveRecord::EVENT_BEFORE_INSERT => 'getDefaultValue',
25
        ];
26
    }
27
28
    public function getDefaultValue( $event )
1 ignored issue
show
Unused Code introduced by
The parameter $event is not used and could be removed.

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

Loading history...
29
    {
30
        $owner = $this->owner;
31
        if ($owner->hasAttribute($this->lockedAttribute))
32
            if (empty($owner->{$this->lockedAttribute}) || is_null($owner->{$this->lockedAttribute}))
33
                $owner->{$this->lockedAttribute} = $this->valueUnlock;
34
    }
35
36
    public function lock()
37
    {
38
        /* @var $owner BaseActiveRecord */
39
        $owner = $this->owner;
40
41
        $owner->{$this->lockedAttribute} = $this->valueLock;
42
        $owner->save();
43
    }
44
45
    public function unlock()
46
    {
47
        /* @var $owner BaseActiveRecord */
48
        $owner = $this->owner;
49
50
        $owner->{$this->lockedAttribute} = $this->valueUnlock;
51
        $owner->save();
52
    }
53
}