Passed
Push — master ( ecaff5...98df6c )
by Joao
13:38 queued 15s
created

HexUuidLiteral   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getUuidFromLiteral() 0 5 1
1
<?php
2
3
namespace RestTemplate\Util;
4
5
use ByJG\MicroOrm\Literal;
6
7
class HexUuidLiteral extends Literal
8
{
9
    public function __construct($value)
10
    {
11
        parent::__construct("X'" . str_replace("-", "", $value) . "'");
12
    }
13
14
    public static function getUuidFromLiteral($literal)
15
    {
16
        $value = $literal->__toString();
17
        $value = substr($value, 2, 8) . "-" . substr($value, 10, 4) . "-" . substr($value, 14, 4) . "-" . substr($value, 18, 4) . "-" . substr($value, 22, 12);
18
        return $value;
19
    }
20
}
21