Code Duplication    Length = 15-17 lines in 3 locations

src/Axolotl/Model.php 3 locations

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