Code Duplication    Length = 24-24 lines in 2 locations

src/Scaffolder/Compilers/AngularJs/ListTemplateCompiler.php 1 location

@@ 173-196 (lines=24) @@
170
	 * @return $this
171
	 */
172
	private $inputStub = [];
173
	private function getInputStubByField($field){
174
		
175
		if($field->index == 'primary'){
176
			$uiType = 'primary' ;
177
		}
178
		elseif(isset($field->foreignKey) && $field->foreignKey){
179
			if(isset($field->foreignKey->eager) && $field->foreignKey->eager)
180
				$uiType = 'foreign_eager' ;
181
			else 
182
				$uiType = $field->type->ui ;
183
		}
184
		else {
185
			$uiType = $field->type->ui ;
186
		}
187
188
		if(array_key_exists($uiType, $this->inputStub)){
189
			return $this->inputStub[$uiType];
190
		}
191
		else {
192
			$this->inputStub[$uiType] = File::get($this->stubsDirectory . 'List/'. CamelCase::convertToCamelCase($uiType). '.html');
193
194
			return $this->inputStub[$uiType];
195
		}
196
	}
197
	
198
	/**
199
	 * Get output filename

src/Scaffolder/Compilers/AngularJs/RegisterTemplateCompiler.php 1 location

@@ 176-199 (lines=24) @@
173
	 * @return $this
174
	 */
175
	private $inputStub = [];
176
	private function getInputStubByField($field){
177
		
178
		if($field->index == 'primary'){
179
			$uiType = 'primary' ;
180
		}
181
		elseif(isset($field->foreignKey) && $field->foreignKey){
182
			if(isset($field->foreignKey->eager) && $field->foreignKey->eager)
183
				$uiType = 'foreign_eager' ;
184
			else 
185
				$uiType = $field->type->ui ;
186
		}
187
		else {
188
			$uiType = $field->type->ui ;
189
		}
190
191
		if(array_key_exists($uiType, $this->inputStub)){
192
			return $this->inputStub[$uiType];
193
		}
194
		else {
195
			$this->inputStub[$uiType] = File::get($this->stubsDirectory . 'Register/'. CamelCase::convertToCamelCase($uiType). '.html');
196
197
			return $this->inputStub[$uiType];
198
		}
199
	}
200
201
	/**
202
	 * Get output filename