| Total Complexity | 17 |
| Total Lines | 110 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class UrlVersionIdentifier |
||
| 8 | {
|
||
| 9 | /** |
||
| 10 | * list supported version numbers |
||
| 11 | * |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | private static $supportedVersions = ['V1']; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * get client version |
||
| 18 | * |
||
| 19 | * @return null|string |
||
| 20 | */ |
||
| 21 | public static function clientVersion() |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * check path url version |
||
| 32 | * |
||
| 33 | * @return bool |
||
| 34 | */ |
||
| 35 | public static function checkPathUrlVersion() |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * console version |
||
| 42 | * |
||
| 43 | * @return null |
||
| 44 | */ |
||
| 45 | private static function consoleVersion() |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * get application console version |
||
| 52 | * |
||
| 53 | * @return mixed |
||
| 54 | */ |
||
| 55 | public static function getConsoleVersion() |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @param array $versions |
||
| 66 | * @return array |
||
| 67 | */ |
||
| 68 | private static function getSupportedVersions($versions=array()) |
||
| 69 | {
|
||
| 70 | if(count($versions)){
|
||
| 71 | return $versions; |
||
| 72 | } |
||
| 73 | return self::$supportedVersions; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * get supported versions |
||
| 78 | * |
||
| 79 | * @param array $versions |
||
| 80 | * @return mixed |
||
| 81 | */ |
||
| 82 | public static function supportedVersions($versions=array()) |
||
| 83 | {
|
||
| 84 | return self::versionNamespace()::getSupportedVersions($versions); |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * get version |
||
| 89 | * |
||
| 90 | * @return mixed|string|null |
||
| 91 | */ |
||
| 92 | public static function version() |
||
| 93 | {
|
||
| 94 | if(self::clientVersion()!==null){
|
||
| 95 | return self::clientVersion(); |
||
| 96 | } |
||
| 97 | |||
| 98 | if(app()->console() && self::getConsoleVersion()!==null){
|
||
| 99 | return self::getConsoleVersion(); |
||
| 100 | } |
||
| 101 | |||
| 102 | return 'V1'; |
||
| 103 | } |
||
| 104 | |||
| 105 | /** |
||
| 106 | * get version namespace |
||
| 107 | * |
||
| 108 | * @return UrlVersionIdentifier|string |
||
| 109 | */ |
||
| 110 | public static function versionNamespace() |
||
| 117 | |||
| 118 | } |
||
| 119 | } |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.