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

IdFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 27
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 1
A createId() 0 4 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