Completed
Push — master ( 24ab37...36f73c )
by Derek Stephen
01:35
created

ScopeRepository::getScopeEntityByIdentifier()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 7

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 9
loc 9
ccs 0
cts 7
cp 0
rs 9.6666
cc 2
eloc 7
nc 2
nop 1
crap 6
1
<?php
2
3
namespace OAuth\Repository;
4
5
use Doctrine\ORM\EntityRepository;
6
use League\OAuth2\Server\Entities\ClientEntityInterface;
7
use League\OAuth2\Server\Entities\ScopeEntityInterface;
8
use League\OAuth2\Server\Repositories\ScopeRepositoryInterface;
9
10
class ScopeRepository extends EntityRepository implements ScopeRepositoryInterface
11
{
12
    /**
13
     * @param string $identifier
14
     * @return mixed
15
     */
16 View Code Duplication
    public function getScopeEntityByIdentifier($identifier)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
    {
18
        $qb = $this->createQueryBuilder('s');
19
        $qb->where('s.identifier = :id');
20
        $qb->setParameter('id', $identifier);
21
        $query = $qb->getQuery();
22
        $result = $query->getResult();
23
        return empty($result) ? null : $result[0];
24
    }
25
26
    /**
27
     * @param array|ScopeEntityInterface[] $scopes
28
     * @param string $grantType
29
     * @param ClientEntityInterface $clientEntity
30
     * @param null|string|null $userIdentifier
31
     * @return mixed
32
     */
33
    public function finalizeScopes(array $scopes, $grantType, ClientEntityInterface $clientEntity, $userIdentifier = null)
34
    {
35
        // TODO: Implement finalizeScopes() method.
36
        return $scopes; // until we figure out what we need to do in here
37
    }
38
}