Client::firstParty()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 6
rs 10
1
<?php
2
3
namespace CodexShaper\DBM\MongoDB\Passport;
4
5
use Jenssegers\Mongodb\Eloquent\Model;
0 ignored issues
show
Bug introduced by
The type Jenssegers\Mongodb\Eloquent\Model was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class Client extends Model
8
{
9
    /**
10
     * The database table used by the model.
11
     *
12
     * @var string
13
     */
14
    protected $table = 'oauth_clients';
15
16
    /**
17
     * The guarded attributes on the model.
18
     *
19
     * @var array
20
     */
21
    protected $guarded = [];
22
23
    /**
24
     * The attributes excluded from the model's JSON form.
25
     *
26
     * @var array
27
     */
28
    protected $hidden = [
29
        'secret',
30
    ];
31
32
    /**
33
     * The attributes that should be cast to native types.
34
     *
35
     * @var array
36
     */
37
    protected $casts = [
38
        'personal_access_client' => 'bool',
39
        'password_client'        => 'bool',
40
        'revoked'                => 'bool',
41
    ];
42
43
    /**
44
     * Get all of the authentication codes for the client.
45
     *
46
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
47
     */
48
    public function authCodes()
49
    {
50
        return $this->hasMany(AuthCode::class);
51
    }
52
53
    /**
54
     * Get all of the tokens that belong to the client.
55
     *
56
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
57
     */
58
    public function tokens()
59
    {
60
        return $this->hasMany(Token::class);
61
    }
62
63
    /**
64
     * Determine if the client is a "first party" client.
65
     *
66
     * @return bool
67
     */
68
    public function firstParty()
69
    {
70
        return $this->personal_access_client || $this->password_client;
71
    }
72
73
    /**
74
     * Determine if the client should skip the authorization prompt.
75
     *
76
     * @return bool
77
     */
78
    public function skipsAuthorization()
79
    {
80
        return false;
81
    }
82
83
    /**
84
     * Determine if the client is a confidential client.
85
     *
86
     * @return bool
87
     */
88
    public function confidential()
89
    {
90
        return ! empty($this->secret);
91
    }
92
}
93