Character::isGenderless()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Zmaglica\RickAndMortyApiWrapper\Api;
4
5
use GuzzleHttp\Client;
6
use Zmaglica\RickAndMortyApiWrapper\Model\Character as CharacterModel;
7
8
class Character extends AbstractApi
9
{
10
    public function __construct(Client $client)
11
    {
12
        $this->client = $client;
13
        $this->uri = 'character';
14
        $this->arguments = [];
15
        $this->supportedFilters = [
16
            'name',
17
            'status',
18
            'species',
19
            'type',
20
            'gender',
21
        ];
22
        $this->model = CharacterModel::class;
23
    }
24
25
    /**
26
     * Get origin of characters
27
     *
28
     * @param mixed $id
29
     * @return mixed
30
     */
31
    public function getOrigin($id = null)
32
    {
33
        return $this->get($id)->getOrigins();
34
    }
35
36
    /**
37
     * Get location of characters
38
     *
39
     * @param mixed $id
40
     * @return mixed
41
     */
42
    public function getLocation($id = null)
43
    {
44
        return $this->get($id)->getLocations();
45
    }
46
47
    /**
48
     * Query to filter dead characters
49
     *
50
     * @return $this
51
     */
52
    public function isDead()
53
    {
54
        $this->where(['status' => 'dead']);
55
56
        return $this;
57
    }
58
59
    /**
60
     * Query to filter alive characters
61
     *
62
     * @return $this
63
     */
64
    public function isAlive()
65
    {
66
        $this->where(['status' => 'alive']);
67
68
        return $this;
69
    }
70
71
    /**
72
     * Query to filter characters with unknown status
73
     *
74
     * @return $this
75
     */
76
    public function isStatusUnknown()
77
    {
78
        $this->where(['status' => 'unknown']);
79
80
        return $this;
81
    }
82
83
    /**
84
     * Query to filter female characters
85
     *
86
     * @return $this
87
     */
88
    public function isFemale()
89
    {
90
        $this->where(['gender' => 'female']);
91
92
        return $this;
93
    }
94
95
    /**
96
     * Query to filter male characters
97
     *
98
     * @return $this
99
     */
100
    public function isMale()
101
    {
102
        $this->where(['gender' => 'male']);
103
104
        return $this;
105
    }
106
107
    /**
108
     * Query to filter genderless characters
109
     *
110
     * @return $this
111
     */
112
    public function isGenderless()
113
    {
114
        $this->where(['gender' => 'genderless']);
115
116
        return $this;
117
    }
118
119
    /**
120
     * Query to filter characters with unknown gender
121
     *
122
     * @return $this
123
     */
124
    public function isGenderUnknown()
125
    {
126
        $this->where(['gender' => 'unknown']);
127
128
        return $this;
129
    }
130
}
131