Code Duplication    Length = 22-22 lines in 2 locations

src/Scaffolder/Compilers/Core/ControllerCompiler.php 1 location

@@ 186-207 (lines=22) @@
183
	 *
184
	 * @return $this
185
	 */
186
	public function getSearchConditions(){
187
188
		$fieldConditions = '';
189
190
		$searchConditions = File::get($this->stubsDirectory . '/SearchConditions/Conditions.php');
191
192
		foreach ($this->modelData->fields as $field)
193
		{
194
195
			$fieldConditions .= $this->replaceFieldStrings($field, $this->getConditionStubByField($field)) ;
196
197
		}
198
199
		// replace all field conditions
200
		$searchConditions = str_replace('{{field_conditions}}', $fieldConditions, $searchConditions);
201
202
		// replace table name
203
		$searchConditions = str_replace('{{table_name}}', $this->modelData->tableName, $searchConditions);
204
205
		return $searchConditions ;
206
207
	}
208
209
210
	/**

src/Scaffolder/Compilers/Core/ModelCompiler.php 1 location

@@ 500-521 (lines=22) @@
497
	 *
498
	 * @return $this
499
	 */
500
	public function getSearchConditions(){
501
502
		$fieldConditions = '';
503
504
		$searchConditions = File::get($this->stubsDirectory . '/SearchConditions/Conditions.php');
505
506
		foreach ($this->modelData->fields as $field)
507
		{
508
509
			$fieldConditions .= $this->replaceFieldStrings($field, $this->getConditionStubByField($field)) ;
510
511
		}
512
513
		// replace all field conditions
514
		$searchConditions = str_replace('{{field_conditions}}', $fieldConditions, $searchConditions);
515
516
		// replace table name
517
		$searchConditions = str_replace('{{table_name}}', $this->modelData->tableName, $searchConditions);
518
519
		return $searchConditions ;
520
521
	}
522
523
	/**
524
	 * get search conditions stub by db type