IDGenerator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 3
c 1
b 0
f 1
dl 0
loc 16
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A newTraceID() 0 3 2
A newSpanID() 0 3 1
1
<?php
2
/**
3
 * Identify generator
4
 * User: moyo
5
 * Date: 24/11/2017
6
 * Time: 2:22 PM
7
 */
8
9
namespace Carno\Tracing\Chips;
10
11
trait IDGenerator
12
{
13
    /**
14
     * @return string
15
     */
16
    protected function newTraceID() : string
17
    {
18
        return bin2hex(random_bytes(defined('TRACING_ID_128BIT') ? 16 : 8));
19
    }
20
21
    /**
22
     * @return string
23
     */
24
    protected function newSpanID() : string
25
    {
26
        return bin2hex(random_bytes(8));
27
    }
28
}
29