Code Duplication    Length = 14-14 lines in 2 locations

src/Generator.php 2 locations

@@ 169-182 (lines=14) @@
166
     * @param string $fieldType Field PHP type
167
     * @return string Generated PHP method code
168
     */
169
    protected function generateFieldConditionMethod($fieldName, $fieldId, $fieldType)
170
    {
171
        $code = "\n\t" . '/**';
172
        $code .= "\n\t" . ' * Add '.$fieldName.'(#' . $fieldId . ') field query condition.';
173
        $code .= "\n\t" . ' * @param '.Field::phpType($fieldType).' $value Field value';
174
        $code .= "\n\t" . ' * @return self Chaining';
175
        $code .= "\n\t" . ' * @see Generic::where()';
176
        $code .= "\n\t" . ' */';
177
        $code .= "\n\t" . 'public function ' . $fieldName . '($value)';
178
        $code .= "\n\t" . "{";
179
        $code .= "\n\t\t" . 'return $this->where("'.$fieldName.'", $value);';
180
181
        return $code . "\n\t" . "}"."\n";
182
    }
183
184
    /**
185
     * Generate Query::where() analog for specific field.
@@ 192-205 (lines=14) @@
189
     * @param string $fieldType Field PHP type
190
     * @return string Generated PHP method code
191
     */
192
    protected function generateLocalizedFieldConditionMethod($fieldName, $fieldId, $fieldType)
193
    {
194
        $code = "\n\t" . '/**';
195
        $code .= "\n\t" . ' * Add '.$fieldName.'(#' . $fieldId . ') field query condition.';
196
        $code .= "\n\t" . ' * @param '.Field::phpType($fieldType).' $value Field value';
197
        $code .= "\n\t" . ' * @return self Chaining';
198
        $code .= "\n\t" . ' * @see Generic::where()';
199
        $code .= "\n\t" . ' */';
200
        $code .= "\n\t" . 'public function ' . $fieldName . '($value)';
201
        $code .= "\n\t" . "{";
202
        $code .= "\n\t\t" . 'return $this->where("'.$fieldName.'", $value);';
203
204
        return $code . "\n\t" . "}"."\n";
205
    }
206
207
    /**
208
     * Create entity PHP class code.