OrderedUuidIdentityGenerator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A generate() 0 9 2
1
<?php
2
3
/*
4
 * identity (https://github.com/phpgears/identity).
5
 * Identity objects for PHP.
6
 *
7
 * @license MIT
8
 * @link https://github.com/phpgears/identity
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Gears\Identity;
15
16
use Gears\Identity\Exception\UnsupportedIdentityException;
17
use Ramsey\Uuid\Uuid;
18
19
/**
20
 * UUID version 6 (ordered UUID) identity generator.
21
 */
22
class OrderedUuidIdentityGenerator implements IdentityGenerator
23
{
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @return UuidIdentity
28
     */
29
    public function generate()
30
    {
31
        if (!\interface_exists('Ramsey\Uuid\DeprecatedUuidInterface')) {
32
            throw new UnsupportedIdentityException(
33
                'Ordered UUID (version 6) not available. Update ramsey/uuid to version ^4.0.'
34
            );
35
        }
36
37
        return UuidIdentity::fromString(Uuid::uuid6()->toString());
0 ignored issues
show
Bug introduced by
The method uuid6() does not exist on Ramsey\Uuid\Uuid. Did you maybe mean uuid3()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
        return UuidIdentity::fromString(Uuid::/** @scrutinizer ignore-call */ uuid6()->toString());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
    }
39
}
40