IgnoreScopePolicy   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A getScopes() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: GCC-MED
5
 * Date: 15/01/2018
6
 * Time: 11:49
7
 */
8
9
namespace OAuth2\ScopePolicy\Policies;
10
11
use OAuth2\Roles\ClientInterface;
12
13
/**
14
 * Class IgnoreScopePolicy
15
 * @package OAuth2\ScopePolicy\Policies
16
 *
17
 * @see https://tools.ietf.org/html/rfc6749#section-3.3
18
 * The authorization server MAY fully or partially ignore the scope
19
 * requested by the client, based on the authorization server policy or
20
 * the resource owner's instructions.
21
 */
22
class IgnoreScopePolicy implements ScopePolicyInterface
23
{
24
    /**
25
     * @var array
26
     */
27
    private $scopes;
28
29
    public function __construct(array $scopes)
30
    {
31
        if(empty($scopes)) {
32
            throw new \InvalidArgumentException('Scope must not be an empty array');
33
        }
34
        $this->scopes = $scopes;
35
    }
36
37
    public function getScopes(ClientInterface $client, ?array $scope): array
38
    {
39
        return $this->scopes;
40
    }
41
}