Code Duplication    Length = 15-17 lines in 3 locations

src/Axolotl/Model.php 3 locations

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