Completed
Pull Request — master (#887)
by
unknown
06:22 queued 35s
created

ScopeEntityTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 27
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addScope() 0 4 1
A getScopes() 0 4 1
1
<?php
2
3
namespace League\OAuth2\Server\Entities\Traits;
4
5
use League\OAuth2\Server\Entities\ScopeEntityInterface;
6
7
trait ScopeEntityTrait
8
{
9
    /**
10
     * @var ScopeEntityInterface[]
11
     */
12
    protected $scopes = [];
13
14
    /**
15
     * Associate a scope with the token.
16
     *
17
     * @param ScopeEntityInterface $scope
18
     */
19 17
    public function addScope(ScopeEntityInterface $scope)
20
    {
21 17
        $this->scopes[$scope->getIdentifier()] = $scope;
22 17
    }
23
24
    /**
25
     * Return an array of scopes associated with the token.
26
     *
27
     * @return ScopeEntityInterface[]
28
     */
29 13
    public function getScopes()
30
    {
31 13
        return array_values($this->scopes);
32
    }
33
}
34