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

src/Repositories/ScopeRepository.php (1 issue)

Check for unnecessary variable assignments.

Unused Code Major

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
$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