Passed
Push — master ( 5d259d...069a18 )
by Conrad
02:00
created

ScopeRepository::finalizeScopes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 6
nc 1
nop 4
1
<?php
2
3
namespace AdvancedLearning\Oauth2Server\Repositories;
4
5
use AdvancedLearning\Oauth2Server\Models\Scope;
6
use League\OAuth2\Server\Entities\ClientEntityInterface;
7
use League\OAuth2\Server\Repositories\ScopeRepositoryInterface;
8
9
class ScopeRepository implements ScopeRepositoryInterface
10
{
11
    /**
12
     * {@inheritDoc}
13
     */
14
    public function getScopeEntityByIdentifier($identifier)
15
    {
16
        if ($scope = Scope::get()->filter(['Name' => $identifier])->first()) {
0 ignored issues
show
Unused Code introduced by Conrad Dobbs
$scope is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
17
            return new \AdvancedLearning\Oauth2Server\Entities\Scope($identifier);
18
        }
19
    }
20
21
    /**
22
     * {@inheritDoc}
23
     */
24
    public function finalizeScopes(
25
        array $scopes,
26
        $grantType,
27
        ClientEntityInterface $clientEntity,
28
        $userIdentifier = null
29
    ) {
30
        return $scopes;
31
    }
32
}
33