SerialNumberGenerator::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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