MissingScopeException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A scopes() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Oauth\Exceptions;
6
7
use Illuminate\Support\Arr;
8
use Illuminate\Auth\Access\AuthorizationException;
9
10
class MissingScopeException extends AuthorizationException
11
{
12
    /**
13
     * The scopes that the user did not have.
14
     *
15
     * @var array
16
     */
17
    protected $scopes;
18
19
    /**
20
     * Create a new missing scope exception.
21
     *
22
     * @param array|string $scopes
23
     * @param string       $message
24
     *
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
    public function __construct($scopes = [], $message = 'Invalid scope(s) provided.')
28
    {
29
        parent::__construct($message);
30
31
        $this->scopes = Arr::wrap($scopes);
32
    }
33
34
    /**
35
     * Get the scopes that the user did not have.
36
     *
37
     * @return array
38
     */
39
    public function scopes()
40
    {
41
        return $this->scopes;
42
    }
43
}
44