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 ( fe092f...f32e18 )
by Cretu
09:19
created

PushSubscription::subscribable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace NotificationChannels\WebPush;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class PushSubscription extends Model
8
{
9
    /**
10
     * The attributes that are mass assignable.
11
     *
12
     * @var array
13
     */
14
    protected $fillable = [
15
        'endpoint',
16
        'public_key',
17
        'auth_token',
18
        'content_encoding',
19
    ];
20
21
    /**
22
     * Create a new model instance.
23
     *
24
     * @param  array $attributes
25
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
26
     */
27 1
    public function __construct(array $attributes = [])
28
    {
29 1
        if (! isset($this->connection)) {
30
            $this->setConnection(config('webpush.database_connection'));
31
        }
32
33
        if (! isset($this->table)) {
34
            $this->setTable(config('webpush.table_name'));
35
        }
36
37
        parent::__construct($attributes);
38 9
    }
39
40 9
    /**
41
     * Get the model related to the subscription.
42
     *
43
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
44
     */
45
    public function subscribable()
46
    {
47
        return $this->morphTo();
48
    }
49
50
    /**
51
     * Find a subscription by the given endpint.
52
     *
53
     * @param  string $endpoint
54
     * @return static|null
55
     */
56
    public static function findByEndpoint($endpoint)
57
    {
58
        return static::where('endpoint', $endpoint)->first();
59
    }
60
}
61