Completed
Push — master ( e0022c...a004d3 )
by Hannes
02:13 queued 01:15
created

IdFactory::createId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace byrokrat\id;
4
5
/**
6
 * Create ID objects from raw id string
7
 */
8
class IdFactory
9
{
10
    /**
11
     * @deprecated Will be removed in version 2. Use createId() instead.
12
     */
13
    public function create($raw)
14
    {
15
        trigger_error(
16
            'create() is deprecated and will be removed in version 2. Use createId() instead.',
17
            E_USER_DEPRECATED
18
        );
19
20
        return $this->createId($raw);
21
    }
22
23
    /**
24
     * Create ID object from raw id string
25
     *
26
     * @param  string $raw Raw id string
27
     * @return IdInterface
28
     * @throws Exception\UnableToCreateIdException If unable to create id
29
     */
30 1
    public function createId($raw)
31
    {
32 1
        throw new Exception\UnableToCreateIdException("Unable to create ID for number '{$raw}'");
33
    }
34
}
35