Code Duplication    Length = 22-22 lines in 2 locations

src/Scaffolder/Commands/GeneratorCommand.php 1 location

@@ 660-681 (lines=22) @@
657
	
658
	}
659
660
	protected function getPrimaryKeyField($modelData){
661
		$primaryKey = new stdClass;
662
		$primaryKey->name = "id" ;
663
		$primaryKey->index = "primary" ;
664
		$primaryKey->declared =  false ;
665
		$primaryKey->type = new stdClass ;
666
		$primaryKey->type->ui = 'label' ;
667
		$primaryKey->type->db = 'integer' ;
668
		$primaryKey->foreignKey = [];
669
		$primaryKey->validations = "required" ;
670
671
		foreach ($modelData->fields as $field)
672
		{
673
			if ($field->index == 'primary')
674
			{
675
				$primaryKey = $field ;
676
				break;
677
			}
678
		}
679
680
		return $primaryKey ;
681
	}
682
683
}

src/Scaffolder/Compilers/AbstractCompiler.php 1 location

@@ 124-145 (lines=22) @@
121
		return $this;
122
	}
123
124
	protected function getPrimaryKeyField(){
125
		$primaryKey = new stdClass;
126
		$primaryKey->name = "id" ;
127
		$primaryKey->index = "primary" ;
128
		$primaryKey->declared =  false ;
129
		$primaryKey->type = new stdClass ;
130
		$primaryKey->type->ui = 'label' ;
131
		$primaryKey->type->db = 'integer' ;
132
		$primaryKey->foreignKey = [];
133
		$primaryKey->validations = "required" ;
134
135
		foreach ($this->modelData->fields as $field)
136
		{
137
			if ($field->index == 'primary')
138
			{
139
				$primaryKey = $field ;
140
				break;
141
			}
142
		}
143
144
		return $primaryKey ;
145
	}
146
147
	/**
148
	 * Replace the class name.