Code Duplication    Length = 15-17 lines in 3 locations

src/Axolotl/Model.php 3 locations

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