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.

PushSubscription   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 81.82%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 54
ccs 9
cts 11
cp 0.8182
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
/**
8
 * @property string $endpoint
9
 * @property string|null $public_key
10
 * @property string|null $auth_token
11
 * @property string|null $content_encoding
12
 * @property \Illuminate\Database\Eloquent\Model $subscribable
13
 */
14
class PushSubscription extends Model
15
{
16
    /**
17
     * The attributes that are mass assignable.
18
     *
19
     * @var array
20
     */
21
    protected $fillable = [
22
        'endpoint',
23
        'public_key',
24
        'auth_token',
25
        'content_encoding',
26
    ];
27
28
    /**
29
     * Create a new model instance.
30
     *
31
     * @param  array $attributes
32
     * @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...
33
     */
34 11
    public function __construct(array $attributes = [])
35
    {
36 11
        if (! isset($this->connection)) {
37 11
            $this->setConnection(config('webpush.database_connection'));
38
        }
39
40 11
        if (! isset($this->table)) {
41 11
            $this->setTable(config('webpush.table_name'));
42
        }
43
44 11
        parent::__construct($attributes);
45 11
    }
46
47
    /**
48
     * Get the model related to the subscription.
49
     *
50
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
51
     */
52
    public function subscribable()
53
    {
54
        return $this->morphTo();
55
    }
56
57
    /**
58
     * Find a subscription by the given endpint.
59
     *
60
     * @param  string $endpoint
61
     * @return static|null
62
     */
63 9
    public static function findByEndpoint($endpoint)
64
    {
65 9
        return static::where('endpoint', $endpoint)->first();
66
    }
67
}
68