Passed
Push — master ( 0e941b...0f3de7 )
by Conrad
08:36
created

ScopeService   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A hasScope() 0 6 1
1
<?php
2
3
namespace AdvancedLearning\Oauth2Server\Services;
4
5
use SilverStripe\Security\Member;
6
7
class ScopeService
8
{
9
    /**
10
     * Checks whether the member has the specified scope.
11
     *
12
     * @param string $name
13
     * @param Member $member
14
     *
15
     * @return bool
16
     */
17
    public function hasScope(string $name, Member $member): bool
18
    {
19
        return $member->Groups()->filter([
20
            'Scopes.Name' => $name
21
        ])->count() > 0;
22
    }
23
}