Completed
Push — master ( 6770d0...dd2856 )
by Julián
07:05
created

UlidIdentityGenerator::generate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/*
4
 * identity-extra (https://github.com/phpgears/identity-extra).
5
 * Identity objects for PHP.
6
 *
7
 * @license MIT
8
 * @link https://github.com/phpgears/identity-extra
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Gears\Identity\Extra;
15
16
use Gears\Identity\IdentityGenerator;
17
use Ulid\Ulid;
18
19
/**
20
 * Universally Unique Lexicographically Sortable ID identity generator.
21
 */
22
class UlidIdentityGenerator implements IdentityGenerator
23
{
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @return UlidIdentity
28
     */
29
    public function generate()
30
    {
31
        return UlidIdentity::fromString((string) Ulid::generate());
32
    }
33
}
34