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