UserId   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 17
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 15 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RemotelyLiving\Doorkeeper\Identification;
6
7
use Ramsey\Uuid;
8
9
final class UserId extends AbstractIdentification
10
{
11
    protected function validate($value): void
12
    {
13
        if (is_int($value)) {
14
            return;
15
        }
16
17
        if (Uuid\Uuid::isValid((string) $value)) {
18
            return;
19
        }
20
21
        if (is_string($value)) {
22
            return;
23
        }
24
25
        throw new \InvalidArgumentException("{$value} is not an integer or uuid");
26
    }
27
}
28