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 ( 52cdd3...193efa )
by Sebastian
02:12
created

Relatable::getRelatableValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Spatie\Relatable;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\MorphTo;
7
8
/**
9
 * @property int $id
10
 * @property int $source_id
11
 * @property string $source_type
12
 * @property int $related_id
13
 * @property string $related_type
14
 */
15
class Relatable extends Model
16
{
17
    /** @var array */
18
    protected $guarded = [];
19
20
    /** @var string|null */
21
    protected $primaryKey = null;
22
23
    /** @var bool */
24
    public $incrementing = false;
25
26
    /** @var bool */
27
    public $timestamps = false;
28
29
    public function related() : MorphTo
30
    {
31
        return $this->morphTo('related');
32
    }
33
34
    public function source() : MorphTo
35
    {
36
        return $this->morphTo('source');
37
    }
38
39
    public function getTable() : string
40
    {
41
        return config('laravel-relatable.table', 'relatables');
42
    }
43
44
    public function getRelatableValues() : array
45
    {
46
        return collect($this->getAttributes())
47
            ->only('source_type', 'source_id', 'related_type', 'related_id')
48
            ->toArray();
49
    }
50
}
51