Completed
Push — v2 ( 0c2cc9...f96eb8 )
by Beñat
05:19
created

Tag::setCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 2
Metric Value
c 3
b 0
f 2
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Stack Exchange Api Client library.
5
 *
6
 * Copyright (c) 2014-2015 Beñat Espiña <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace BenatEspina\StackExchangeApiClient\Model;
13
14
/**
15
 * The tag model class.
16
 *
17
 * @author Beñat Espiña <[email protected]>
18
 */
19
class Tag
20
{
21
    private $count;
22
    private $hasSynonyms;
23
    private $isModeratorOnly;
24
    private $isRequired;
25
    private $lastActivityDate;
26
    private $name;
27
    private $synonyms;
28
    private $userId;
29
30
    public static function fromJson(array $data)
31
    {
32
        return new self(
33
            array_key_exists('count', $data) ? $data['count'] : null,
34
            array_key_exists('has_synonyms', $data) ? $data['has_synonyms'] : null,
35
            array_key_exists('is_moderator_only', $data) ? $data['is_moderator_only'] : null,
36
            array_key_exists('is_required', $data) ? $data['is_required'] : null,
37
            array_key_exists('last_activity_date', $data) ? new \DateTime('@' . $data['last_activity_date']) : null,
38
            array_key_exists('name', $data) ? $data['name'] : null,
39
            array_key_exists('synonyms', $data) ? $data['synonyms'] : null,
40
            array_key_exists('user_id', $data) ? $data['user_id'] : null
41
        );
42
    }
43
44
    public static function fromProperties(
45
        $count,
46
        $hasSynonyms,
47
        $isModeratorOnly,
48
        $isRequired,
49
        $name,
50
        $synonyms,
51
        \DateTime $lastActivityDate = null,
52
        $userId = null
53
    ) {
54
        return new self(
55
            $count,
56
            $hasSynonyms,
57
            $isModeratorOnly,
58
            $isRequired,
59
            $lastActivityDate,
60
            $name,
61
            $synonyms,
62
            $userId
63
        );
64
    }
65
66
    private function __construct(
67
        $count = null,
68
        $hasSynonyms = null,
69
        $isModeratorOnly = null,
70
        $isRequired = null,
71
        \DateTime $lastActivityDate = null,
72
        $name = null,
73
        $synonyms = null,
74
        $userId = null
75
    ) {
76
        $this->count = $count;
77
        $this->hasSynonyms = $hasSynonyms;
78
        $this->isModeratorOnly = $isModeratorOnly;
79
        $this->isRequired = $isRequired;
80
        $this->lastActivityDate = $lastActivityDate;
81
        $this->name = $name;
82
        $this->synonyms = $synonyms;
83
        $this->userId = $userId;
84
    }
85
86
    public function getCount()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
87
    {
88
        return $this->count;
89
    }
90
91
    public function setCount($count)
92
    {
93
        $this->count = $count;
94
95
        return $this;
96
    }
97
98
    public function getHasSynonyms()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
99
    {
100
        return $this->hasSynonyms;
101
    }
102
103
    public function setHasSynonyms($hasSynonyms)
104
    {
105
        $this->hasSynonyms = $hasSynonyms;
106
107
        return $this;
108
    }
109
110
    public function getIsModeratorOnly()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
111
    {
112
        return $this->isModeratorOnly;
113
    }
114
115
    public function setIsModeratorOnly($isModeratorOnly)
116
    {
117
        $this->isModeratorOnly = $isModeratorOnly;
118
119
        return $this;
120
    }
121
122
    public function getIsRequired()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
123
    {
124
        return $this->isRequired;
125
    }
126
127
    public function setIsRequired($isRequired)
128
    {
129
        $this->isRequired = $isRequired;
130
131
        return $this;
132
    }
133
134
    public function getLastActivityDate()
135
    {
136
        return $this->lastActivityDate;
137
    }
138
139
    public function setLastActivityDate(\DateTime $lastActivityDate)
140
    {
141
        $this->lastActivityDate = $lastActivityDate;
142
143
        return $this;
144
    }
145
146
    public function getName()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
147
    {
148
        return $this->name;
149
    }
150
151
    public function setName($name)
152
    {
153
        $this->name = $name;
154
155
        return $this;
156
    }
157
158
    public function getSynonyms()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
159
    {
160
        return $this->synonyms;
161
    }
162
163
    public function setSynonyms($synonyms)
164
    {
165
        $this->synonyms = $synonyms;
166
167
        return $this;
168
    }
169
170
    public function getUserId()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
171
    {
172
        return $this->userId;
173
    }
174
175
    public function setUserId($userId)
176
    {
177
        $this->userId = $userId;
178
179
        return $this;
180
    }
181
}
182