@@ -24,7 +24,7 @@ |
||
24 | 24 | public function boot() |
25 | 25 | { |
26 | 26 | $this->publishes([ |
27 | - __DIR__.'/../config/irfa/' => config_path('irfa')],'php-serial-number'); |
|
27 | + __DIR__.'/../config/irfa/' => config_path('irfa')], 'php-serial-number'); |
|
28 | 28 | |
29 | 29 | |
30 | 30 | } |
@@ -23,16 +23,16 @@ |
||
23 | 23 | |
24 | 24 | private function setConfig() |
25 | 25 | { |
26 | - if (function_exists('config') and function_exists('app')) {//Load Config For Laravel |
|
26 | + if (function_exists('config') and function_exists('app')) {//Load Config For Laravel |
|
27 | 27 | if(!empty(config('irfa.serial_number'))) |
28 | 28 | { |
29 | 29 | $this->laravelConfig(); |
30 | 30 | } else{ |
31 | 31 | $this->generalConfig(); |
32 | 32 | } |
33 | - } else{//Load Config for Non-Laravel |
|
33 | + } else{//Load Config for Non-Laravel |
|
34 | 34 | $this->generalConfig(); |
35 | - } |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | private function laravelConfig() |
38 | 38 | { |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | protected $seperator; |
12 | 12 | protected $charset; |
13 | 13 | |
14 | - protected function runConfig($config_array=null) |
|
14 | + protected function runConfig($config_array = null) |
|
15 | 15 | { |
16 | - if(empty($config_array)) |
|
16 | + if (empty($config_array)) |
|
17 | 17 | { |
18 | 18 | $this->setConfig(); |
19 | 19 | } else { |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | private function setConfig() |
25 | 25 | { |
26 | 26 | if (function_exists('config') and function_exists('app')) {//Load Config For Laravel |
27 | - if(!empty(config('irfa.serial_number'))) |
|
27 | + if (!empty(config('irfa.serial_number'))) |
|
28 | 28 | { |
29 | 29 | $this->laravelConfig(); |
30 | - } else{ |
|
30 | + } else { |
|
31 | 31 | $this->generalConfig(); |
32 | 32 | } |
33 | - } else{//Load Config for Non-Laravel |
|
33 | + } else {//Load Config for Non-Laravel |
|
34 | 34 | $this->generalConfig(); |
35 | 35 | } |
36 | 36 | } |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | { |
57 | 57 | require dirname(__DIR__, 2)."/config/config.php"; |
58 | 58 | |
59 | - $this->length = isset($arr['length']) ? $arr['length']:$config['length']; |
|
60 | - $this->segment = isset($arr['segment']) ? $arr['segment']:$config['segment']; |
|
61 | - $this->seperator = isset($arr['seperator']) ? $arr['seperator']:$config['seperator']; |
|
62 | - $this->charset = isset($arr['charset']) ? $arr['charset']:$config['charset']; |
|
59 | + $this->length = isset($arr['length']) ? $arr['length'] : $config['length']; |
|
60 | + $this->segment = isset($arr['segment']) ? $arr['segment'] : $config['segment']; |
|
61 | + $this->seperator = isset($arr['seperator']) ? $arr['seperator'] : $config['seperator']; |
|
62 | + $this->charset = isset($arr['charset']) ? $arr['charset'] : $config['charset']; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | } |
@@ -11,10 +11,10 @@ |
||
11 | 11 | |
12 | 12 | protected function generateSN($json=false) |
13 | 13 | { |
14 | - if($json) |
|
15 | - { |
|
16 | - return json_encode(['sn'=>$this->generatingSN()]); |
|
17 | - } |
|
14 | + if($json) |
|
15 | + { |
|
16 | + return json_encode(['sn'=>$this->generatingSN()]); |
|
17 | + } |
|
18 | 18 | return $this->generatingSN(); |
19 | 19 | } |
20 | 20 |
@@ -9,9 +9,9 @@ |
||
9 | 9 | private $generated_serial; |
10 | 10 | private $serial; |
11 | 11 | |
12 | - protected function generateSN($json=false) |
|
12 | + protected function generateSN($json = false) |
|
13 | 13 | { |
14 | - if($json) |
|
14 | + if ($json) |
|
15 | 15 | { |
16 | 16 | return json_encode(['sn'=>$this->generatingSN()]); |
17 | 17 | } |
@@ -11,16 +11,16 @@ |
||
11 | 11 | { |
12 | 12 | private $sn; |
13 | 13 | |
14 | - function __construct($config_array=null) |
|
14 | + function __construct($config_array = null) |
|
15 | 15 | { |
16 | 16 | $this->runConfig($config_array); |
17 | 17 | } |
18 | 18 | |
19 | 19 | protected function generatingSN() |
20 | 20 | { |
21 | - for($i=1;$i<=$this->segment;$i++) |
|
21 | + for ($i = 1; $i<=$this->segment; $i++) |
|
22 | 22 | { |
23 | - $this->sn .= $this->sn()->formattedId($this->charset,$this->length).$this->seperator; |
|
23 | + $this->sn .= $this->sn()->formattedId($this->charset, $this->length).$this->seperator; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $sn = $this->sn; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | class SerialNumber extends SN |
12 | 12 | { |
13 | - private array $config=[]; |
|
13 | + private array $config = []; |
|
14 | 14 | |
15 | 15 | public function generate($json_return = false) |
16 | 16 | { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | - return [ |
|
3 | - /* |
|
2 | + return [ |
|
3 | + /* |
|
4 | 4 | |-------------------------------------------------------------------------- |
5 | 5 | | Serial Config |
6 | 6 | |-------------------------------------------------------------------------- |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | | seperator : striped segment for serial (set null if you do not wish to use seperator) |
11 | 11 | | |
12 | 12 | */ |
13 | - 'length' => 4, //default : 4 (result:ABCD) |
|
13 | + 'length' => 4, //default : 4 (result:ABCD) |
|
14 | 14 | |
15 | - 'segment' => 4, //default : 4 (result:ABCD-1234-A1B2-CDEF) |
|
15 | + 'segment' => 4, //default : 4 (result:ABCD-1234-A1B2-CDEF) |
|
16 | 16 | |
17 | 17 | 'seperator' => "-", //default : - (result : ABCD-1234-A1B2-CDEF) |
18 | 18 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | 'seperator' => "-", //default : - (result : ABCD-1234-A1B2-CDEF) |
18 | 18 | |
19 | - 'charset' => "0123456789ABCDEFGHIJKLMNPQRSTUWXYZ", //default : 0123456789ABCDEFGHIJKLMNPQRSTUWXYZ |
|
19 | + 'charset' => "0123456789ABCDEFGHIJKLMNPQRSTUWXYZ", //default : 0123456789ABCDEFGHIJKLMNPQRSTUWXYZ |
|
20 | 20 | |
21 | 21 | |
22 | 22 | ]; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | - $config = [ |
|
3 | - /* |
|
2 | + $config = [ |
|
3 | + /* |
|
4 | 4 | |-------------------------------------------------------------------------- |
5 | 5 | | Serial Config |
6 | 6 | |-------------------------------------------------------------------------- |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | | seperator : striped segment for serial (set null if you do not wish to use seperator) |
11 | 11 | | |
12 | 12 | */ |
13 | - 'length' => 4, //default : 4 (result:ABCD) |
|
13 | + 'length' => 4, //default : 4 (result:ABCD) |
|
14 | 14 | |
15 | - 'segment' => 4, //default : 4 (result:ABCD-1234-A1B2-CDEF) |
|
15 | + 'segment' => 4, //default : 4 (result:ABCD-1234-A1B2-CDEF) |
|
16 | 16 | |
17 | 17 | 'seperator' => "-", //default : - (result : ABCD-1234-A1B2-CDEF) |
18 | 18 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | - $config = [ |
|
2 | + $config = [ |
|
3 | 3 | /* |
4 | 4 | |-------------------------------------------------------------------------- |
5 | 5 | | Serial Config |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | 'seperator' => "-", //default : - (result : ABCD-1234-A1B2-CDEF) |
18 | 18 | |
19 | - 'charset' => "0123456789ABCDEFGHIJKLMNPQRSTUWXYZ",//default : 0123456789ABCDEFGHIJKLMNPQRSTUWXYZ |
|
19 | + 'charset' => "0123456789ABCDEFGHIJKLMNPQRSTUWXYZ", //default : 0123456789ABCDEFGHIJKLMNPQRSTUWXYZ |
|
20 | 20 | |
21 | 21 | |
22 | 22 |