Code Duplication    Length = 15-17 lines in 3 locations

src/Axolotl/Model.php 3 locations

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