Code Duplication    Length = 10-10 lines in 3 locations

Model/Behavior/StateMachineBehavior.php 3 locations

@@ 478-487 (lines=10) @@
475
 * @param int $id The id of the item to check
476
 * @return string The previous state of the machine
477
 */
478
	public function getPreviousState(Model $model, $id = null) {
479
		if ($id === null) {
480
			$id = $model->getID();
481
		}
482
		if ($id === false) {
483
			return false;
484
		}
485
		$model->id = $id;
486
		return $model->field('previous_state');
487
	}
488
489
/**
490
 * Returns the last transition ran
@@ 496-505 (lines=10) @@
493
 * @param int $id The id of the item to check
494
 * @return string The transition last ran of the machine
495
 */
496
	public function getLastTransition(Model $model, $id = null) {
497
		if ($id === null) {
498
			$id = $model->getID();
499
		}
500
		if ($id === false) {
501
			return false;
502
		}
503
		$model->id = $id;
504
		return $model->field('last_transition');
505
	}
506
507
/**
508
 * Returns the role that ran the last transition
@@ 514-523 (lines=10) @@
511
 * @param int $id The id of the item to check
512
 * @return string The role that last ran a transition of the machine
513
 */
514
	public function getLastRole(Model $model, $id = null) {
515
		if ($id === null) {
516
			$id = $model->getID();
517
		}
518
		if ($id === false) {
519
			return false;
520
		}
521
		$model->id = $id;
522
		return $model->field('last_role');
523
	}
524
525
/**
526
 * Simple method to return contents for a GV file, that