SerialGenerator::generateSerial()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 9
c 1
b 0
f 0
nc 4
nop 0
dl 0
loc 19
rs 9.9666
1
<?php
2
/* 
3
	Author: Irfa Ardiansyah <[email protected]>
4
*/
5
namespace Irfa\AppLicenseServer\Core;
6
7
use Illuminate\Support\Str;
8
9
class SerialGenerator extends SerialType
10
{
11
	protected function generateSerial()
12
    {
13
    	if(config('irfa.app_license_server.char_type') == "alphanumeric") {
14
15
			return $this->alphanumeric();
16
17
    	} elseif(config('irfa.app_license_server.char_type') == "numeric") {
18
19
			return $this->numeric();
20
21
    	} 
22
    	elseif(config('irfa.app_license_server.char_type') == "alphabet") {
23
24
    		return $this->alphabet();
25
26
		} else {
27
			throw new \Exception('\''.config('irfa.app_license_server.char_type').'\' is not supported, supported char type : alphanumeric, numeric, or alphabet');
28
29
			return false;
0 ignored issues
show
Unused Code introduced by
return false is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
30
		}
31
      
32
    }
33
34
}