Passed
Push — master ( 2d14f5...417126 )
by Константин
07:22
created

Gender::isDefined()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Premier\Enum;
4
5
/**
6
 * @author Konstantin Grachev <[email protected]>
7
 *
8
 * @see https://en.wikipedia.org/wiki/ISO/IEC_5218
9
 *
10
 * @method static Gender unknown()
11
 * @method static Gender male()
12
 * @method static Gender female()
13
 * @method static Gender unapplicable()
14
 * @method bool   isUnknown()
15
 * @method bool   isMale()
16
 * @method bool   isFemale()
17
 * @method bool   isUnapplicable()
18
 */
19
class Gender extends Enum
20
{
21
    private const UNKNOWN = 0;
22
    private const MALE = 1;
23
    private const FEMALE = 2;
24
    private const UNAPPLICABLE = 9;
25
26
    /**
27
     * @return bool
28
     */
29
    public function isDefined(): bool
30
    {
31
        return in_array($this->getId(), [self::MALE, self::FEMALE], true);
32
    }
33
}
34