Completed
Branch develop (45165d)
by Alexey
04:09
created

Category::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Nelexa\GPlay\Model;
5
6
class Category
7
{
8
    /**
9
     * @var string
10
     */
11
    private $id;
12
    /**
13
     * @var string
14
     */
15
    private $name;
16
17
    /**
18
     * Category constructor.
19
     *
20
     * @param string $id
21
     * @param string $name
22
     */
23
    public function __construct(string $id, string $name)
24
    {
25
        $this->id = $id;
26
        $this->name = $name;
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getId(): string
33
    {
34
        return $this->id;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getName(): string
41
    {
42
        return $this->name;
43
    }
44
45
    /**
46
     * @return bool
47
     */
48
    public function isGamesCategory(): bool
49
    {
50
        return strpos($this->id, 'GAME') === 0;
51
    }
52
53
    /**
54
     * @return bool
55
     */
56
    public function isFamilyCategory(): bool
57
    {
58
        return strpos($this->id, 'FAMILY') === 0;
59
    }
60
61
    /**
62
     * @return bool
63
     */
64
    public function isApplicationCategory(): bool
65
    {
66
        return !$this->isGamesCategory() && !$this->isFamilyCategory();
67
    }
68
}
69