Code Duplication    Length = 15-17 lines in 3 locations

src/Axolotl/Model.php 3 locations

@@ 316-332 (lines=17) @@
313
	 *
314
	 * @return array
315
	 */
316
	public function get_table_keys() {
317
		if ( isset( self::$memo[ get_called_class() ][ __METHOD__ ] ) ) {
318
			return self::$memo[ get_called_class() ][ __METHOD__ ];
319
		}
320
321
		$keys = array();
322
323
		foreach ( $this->get_attribute_keys() as $key ) {
324
			if ( ! $this->has_map_method( $key ) &&
325
			     ! $this->has_compute_method( $key )
326
			) {
327
				$keys[] = $key;
328
			}
329
		}
330
331
		return self::$memo[ get_called_class() ][ __METHOD__ ] = $keys;
332
	}
333
334
	/**
335
	 * Retrieves the attribute keys that are mapped to a post.
@@ 339-353 (lines=15) @@
336
	 *
337
	 * @return array
338
	 */
339
	public function get_wp_object_keys() {
340
		if ( isset( self::$memo[ get_called_class() ][ __METHOD__ ] ) ) {
341
			return self::$memo[ get_called_class() ][ __METHOD__ ];
342
		}
343
344
		$keys = array();
345
346
		foreach ( $this->get_attribute_keys() as $key ) {
347
			if ( $this->has_map_method( $key ) ) {
348
				$keys[] = $key;
349
			}
350
		}
351
352
		return self::$memo[ get_called_class() ][ __METHOD__ ] = $keys;
353
	}
354
355
	/**
356
	 * Returns the model's keys that are computed at call time.
@@ 360-374 (lines=15) @@
357
	 *
358
	 * @return array
359
	 */
360
	public function get_computed_keys() {
361
		if ( isset( self::$memo[ get_called_class() ][ __METHOD__ ] ) ) {
362
			return self::$memo[ get_called_class() ][ __METHOD__ ];
363
		}
364
365
		$keys = array();
366
367
		foreach ( $this->get_attribute_keys() as $key ) {
368
			if ( $this->has_compute_method( $key ) ) {
369
				$keys[] = $key;
370
			}
371
		}
372
373
		return self::$memo[ get_called_class() ][ __METHOD__ ] = $keys;
374
	}
375
376
	/**
377
	 * Serializes the model's public data into an array.