Type   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 4 1
A getName() 0 5 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Crossjoin\Browscap;
5
6
/**
7
 * Class Type
8
 *
9
 * @package Crossjoin\Browscap
10
 * @author Christoph Ziegenberg <[email protected]>
11
 * @link https://github.com/crossjoin/browscap
12
 */
13
final class Type
14
{
15
    const UNKNOWN = 0;
16
    const STANDARD = 1;
17
    const FULL = 2;
18
    const LITE = 3;
19
20
    /**
21
     * @param int $type
22
     *
23
     * @return bool
24
     */
25
    public static function isValid(int $type) : bool
26
    {
27
        return in_array($type, [self::UNKNOWN, self::STANDARD, self::FULL, self::LITE], true);
28
    }
29
30
    /**
31
     * @param int $type
32
     *
33
     * @return string
34
     */
35
    public static function getName(int $type) : string
36
    {
37
        $names = [self::UNKNOWN => 'unknown', self::STANDARD => 'standard', self::FULL => 'full', self::LITE => 'lite'];
38
        return $names[$type] ?? 'invalid';
39
    }
40
}
41