Completed
Push — master ( 64cd9f...411f65 )
by Alexandre
02:13
created

ErrorScopePolicy::getScopes()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 6
cp 0
crap 6
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: GCC-MED
5
 * Date: 15/01/2018
6
 * Time: 10:20
7
 */
8
9
namespace OAuth2\ScopePolicy\Policies;
10
11
12
use OAuth2\Exceptions\OAuthException;
13
use OAuth2\Roles\ClientInterface;
14
15
class ErrorScopePolicy implements ScopePolicyInterface
16
{
17
    /**
18
     * @param ClientInterface $client
19
     * @param string|null $scope
20
     * @return array|null
21
     * @throws OAuthException
22
     */
23
    function getScopes(ClientInterface $client, ?string $scope): array
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
24
    {
25
        if (is_null($scope)) {
26
            throw new OAuthException('invalid_scope',
27
                'The request is missing the required parameter scope.',
28
                'https://tools.ietf.org/html/rfc6749#section-4.1');
29
        }
30
        return explode(' ', $scope);
31
    }
32
}