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
Branch master (57668c)
by Nikhil
13:19 queued 05:38
created

Guitar::sale()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent;
6
7
class Guitar extends Eloquent\Model
8
{
9
    /**
10
     * We do not want any timestamps.
11
     *
12
     * @var bool
13
     */
14
    public $timestamps = false;
15
16
    /**
17
     * The attributes that are not mass assignable.
18
     *
19
     * @var array
20
     */
21
    protected $guarded = [];
22
23
    /**
24
     * Sold guitars.
25
     *
26
     * @param $query
27
     *
28
     * @return Eloquent\Builder
29
     */
30
    public function scopeSold($query)
31
    {
32
        return $query->has('sale');
33
    }
34
35
    /**
36
     * Unsold Guitars.
37
     *
38
     * @param $query
39
     *
40
     * @return Eloquent\Builder
41
     */
42 1
    public function scopeUnsold($query)
43
    {
44 1
        return $query->doesntHave('sale');
45
    }
46
47
    /**
48
     * Make of the guitar.
49
     *
50
     * @return Eloquent\Relations\BelongsTo
51
     */
52
    public function make()
53
    {
54
        return $this->belongsTo(Make::class);
55
    }
56
57
    /**
58
     * Model of the guitar.
59
     *
60
     * @return Eloquent\Relations\BelongsTo
61
     */
62
    public function model()
63
    {
64
        return $this->belongsTo(Model::class);
65
    }
66
67
    /**
68
     * Rack where guitar is stored.
69
     *
70
     * @return Eloquent\Relations\BelongsTo
71
     */
72
    public function rack()
73
    {
74
        return $this->belongsTo(Rack::class);
75
    }
76
77
    /**
78
     * The shipment in which the guitar was bought.
79
     *
80
     * @return Eloquent\Relations\BelongsTo
81
     */
82
    public function purchase()
83
    {
84
        return $this->belongsTo(Purchase::class);
85
    }
86
87
    /**
88
     * Sale record of the guitar.
89
     *
90
     * @return Eloquent\Relations\HasOne
91
     */
92 1
    public function sale()
93
    {
94 1
        return $this->hasOne(Sale::class);
95
    }
96
97
    /**
98
     * Status of the guitar.
99
     * @return bool
100
     */
101
    public function isSold()
102
    {
103
        return ! is_null($this->sale);
0 ignored issues
show
Documentation introduced by
The property sale does not exist on object<App\Guitar>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
104
    }
105
}
106