@@ 71-84 (lines=14) @@ | ||
68 | * |
|
69 | * @return array |
|
70 | */ |
|
71 | public function all(array $params = ['site' => 'stackoverflow'], $serialize = true) |
|
72 | { |
|
73 | if ($this->authentication instanceof Authentication) { |
|
74 | if (true === empty($params)) { |
|
75 | $params = array_merge($params, self::QUERY_PARAMS); |
|
76 | } |
|
77 | $params = array_merge($params, $this->authentication->toArray()); |
|
78 | } |
|
79 | $response = HttpClient::instance()->get( |
|
80 | self::URL, $params |
|
81 | ); |
|
82 | ||
83 | return $serialize === true ? AnswerSerializer::serialize($response) : $response; |
|
84 | } |
|
85 | ||
86 | /** |
|
87 | * Get answers identified by a set of ids. |
@@ 63-76 (lines=14) @@ | ||
60 | * |
|
61 | * @return array |
|
62 | */ |
|
63 | public function all($params = [], $serialize = true) |
|
64 | { |
|
65 | if ($this->authentication instanceof Authentication) { |
|
66 | if (true === empty($params)) { |
|
67 | $params = array_merge($params, self::QUERY_PARAMS); |
|
68 | } |
|
69 | $params = array_merge($params, $this->authentication->toArray()); |
|
70 | } |
|
71 | $response = HttpClient::instance()->get( |
|
72 | self::URL, $params |
|
73 | ); |
|
74 | ||
75 | return $serialize === true ? UserSerializer::serialize($response) : $response; |
|
76 | } |
|
77 | ||
78 | /** |
|
79 | * Gets the users identified in ids in {ids}. |
|
@@ 138-151 (lines=14) @@ | ||
135 | * |
|
136 | * @return array |
|
137 | */ |
|
138 | public function moderators(array $params = [], $serialize = true) |
|
139 | { |
|
140 | if ($this->authentication instanceof Authentication) { |
|
141 | if (true === empty($params)) { |
|
142 | $params = array_merge($params, self::QUERY_PARAMS); |
|
143 | } |
|
144 | $params = array_merge($params, $this->authentication->toArray()); |
|
145 | } |
|
146 | $response = HttpClient::instance()->get( |
|
147 | self::URL . 'moderators', $params |
|
148 | ); |
|
149 | ||
150 | return $serialize === true ? UserSerializer::serialize($response) : $response; |
|
151 | } |
|
152 | ||
153 | /** |
|
154 | * Returns those users on a site who both have moderator powers, and were actually elected. |
|
@@ 163-176 (lines=14) @@ | ||
160 | * |
|
161 | * @return array |
|
162 | */ |
|
163 | public function electedModerators(array $params = [], $serialize = true) |
|
164 | { |
|
165 | if ($this->authentication instanceof Authentication) { |
|
166 | if (true === empty($params)) { |
|
167 | $params = array_merge($params, self::QUERY_PARAMS); |
|
168 | } |
|
169 | $params = array_merge($params, $this->authentication->toArray()); |
|
170 | } |
|
171 | $response = HttpClient::instance()->get( |
|
172 | self::URL . 'moderators/elected', $params |
|
173 | ); |
|
174 | ||
175 | return $serialize === true ? UserSerializer::serialize($response) : $response; |
|
176 | } |
|
177 | } |
|
178 |