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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 54
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 3
A subscribable() 0 4 1
A findByEndpoint() 0 4 1
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