SerialNumberGenerator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A sn() 0 5 1
A generatingSN() 0 9 2
A __construct() 0 3 1
1
<?php
2
/* 
3
    Author: Irfa Ardiansyah <[email protected]>
4
*/
5
namespace Irfa\SerialNumber\Core;
6
7
use Hidehalo\Nanoid\Client;
8
9
class SerialNumberGenerator extends ConfigInit
10
{
11
    private $sn;
12
13
    function __construct($config_array=null)
14
    {
15
        $this->runConfig($config_array);
16
    }
17
18
    protected function generatingSN()
19
    {
20
        for($i=1;$i<=intval($this->segment);$i++)
21
        {
22
            $this->sn .= $this->sn()->formattedId($this->charset,intval($this->length)).$this->seperator;
23
        }
24
25
        $sn = $this->sn;
26
        return rtrim($sn, $this->seperator);
27
    }
28
29
    private function sn()
30
    {
31
        $obj = new Client();
32
33
        return $obj;
34
    }
35
}
36