Code Duplication    Length = 7-11 lines in 2 locations

includes/api/ApiQueryBase.php 2 locations

@@ 195-201 (lines=7) @@
192
	 * Add a set of fields to select to the internal array
193
	 * @param array|string $value Field name or array of field names
194
	 */
195
	protected function addFields( $value ) {
196
		if ( is_array( $value ) ) {
197
			$this->fields = array_merge( $this->fields, $value );
198
		} else {
199
			$this->fields[] = $value;
200
		}
201
	}
202
203
	/**
204
	 * Same as addFields(), but add the fields only if a condition is met
@@ 230-240 (lines=11) @@
227
	 * to "foo=bar AND baz='3' AND bla='foo'"
228
	 * @param string|array $value
229
	 */
230
	protected function addWhere( $value ) {
231
		if ( is_array( $value ) ) {
232
			// Sanity check: don't insert empty arrays,
233
			// Database::makeList() chokes on them
234
			if ( count( $value ) ) {
235
				$this->where = array_merge( $this->where, $value );
236
			}
237
		} else {
238
			$this->where[] = $value;
239
		}
240
	}
241
242
	/**
243
	 * Same as addWhere(), but add the WHERE clauses only if a condition is met