Type::isValid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace PHPSC\PagSeguro\Shipping;
3
4
/**
5
 * @author Luís Otávio Cobucci Oblonczyk <[email protected]>
6
 */
7
class Type
8
{
9
    /**
10
     * @var int
11
     */
12
    const TYPE_PAC = 1;
13
14
    /**
15
     * @var int
16
     */
17
    const TYPE_SEDEX = 2;
18
19
    /**
20
     * @var int
21
     */
22
    const TYPE_UNKNOWN = 3;
23
24
    /**
25
     * @return array
26
     */
27 15
    public static function getTypes()
28
    {
29 15
        return [static::TYPE_PAC, static::TYPE_SEDEX, static::TYPE_UNKNOWN];
30
    }
31
32
    /**
33
     * @param int $type
34
     * @return boolean
35
     */
36 14
    public static function isValid($type)
37
    {
38 14
        return in_array($type, static::getTypes());
39
    }
40
}
41