Total Complexity | 7 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class BlankNode implements iBlankNode |
||
19 | { |
||
20 | private string $id; |
||
21 | |||
22 | 4 | public function __construct(?string $id = null) |
|
23 | { |
||
24 | 4 | if (empty($id)) { |
|
25 | // if no ID was given, generate random unique string |
||
26 | 1 | $id = bin2hex(random_bytes(16)); |
|
27 | } |
||
28 | |||
29 | 4 | if (!str_starts_with($id, '_:')) { |
|
30 | 3 | $id = '_:'.$id; |
|
31 | } |
||
32 | |||
33 | 4 | $this->id = $id; |
|
34 | 4 | } |
|
35 | |||
36 | 1 | public function __toString(): string |
|
37 | { |
||
38 | 1 | return $this->id; |
|
39 | } |
||
40 | |||
41 | 1 | public function equals(Term $term): bool |
|
42 | { |
||
43 | 1 | return $this == $term; |
|
44 | } |
||
45 | |||
46 | 1 | public function getType(): string |
|
49 | } |
||
50 | |||
51 | 2 | public function getValue(): string |
|
54 | } |
||
55 | } |
||
56 |