UserId   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 3 1
A childCanBeSatisfied() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RemotelyLiving\Doorkeeper\Rules;
6
7
use RemotelyLiving\Doorkeeper\Identification;
8
use RemotelyLiving\Doorkeeper\RequestorInterface;
9
10
final class UserId extends AbstractRule
11
{
12
    private Identification\UserId $userId;
13
14
    /**
15
     * @param string|int $userId
16
     */
17
    public function __construct($userId)
18
    {
19
        $this->userId = new Identification\UserId($userId);
20
    }
21
22
    public function getValue()
23
    {
24
        return $this->userId->getIdentifier();
25
    }
26
27
    protected function childCanBeSatisfied(RequestorInterface $requestor = null): bool
28
    {
29
        return $this->requestorHasMatchingId($requestor, $this->userId);
30
    }
31
}
32