Code Duplication    Length = 12-14 lines in 2 locations

src/ZohoDatabasePusher.php 2 locations

@@ 186-199 (lines=14) @@
183
     * @param ZohoBeanInterface $zohoBean
184
     * @param array             $row
185
     */
186
    private function insertDataZohoBean(AbstractZohoDao $dao, ZohoBeanInterface $zohoBean, array $row)
187
    {
188
        foreach ($row as $columnName => $columnValue) {
189
            $fieldMethod = $dao->getFieldFromFieldName($columnName);
190
            if(!in_array($columnName, EntitiesGeneratorService::$defaultDateFields) && $fieldMethod
191
                && (!in_array($columnName, ['id', 'uid'])) && !is_null($columnValue)
192
            ) {
193
                $type = $fieldMethod->getType();
194
                $value = $this->formatValueToBeans($type, $columnValue);
195
                $setterMethod = $fieldMethod->getSetter();
196
                $zohoBean->{$setterMethod}($value);
197
            }
198
        }
199
    }
200
201
    /**
202
     * Insert data to bean in order to update zoho records.
@@ 209-220 (lines=12) @@
206
     * @param type              $columnName
207
     * @param type              $valueDb
208
     */
209
    private function updateDataZohoBean(AbstractZohoDao $dao, ZohoBeanInterface $zohoBean, $columnName, $valueDb)
210
    {
211
        $fieldMethod = $dao->getFieldFromFieldName($columnName);
212
        if (!in_array($columnName, EntitiesGeneratorService::$defaultDateFields) && $fieldMethod
213
            && !in_array($columnName, ['id', 'uid'])
214
        ) {
215
            $type = $fieldMethod->getType();
216
            $value = is_null($valueDb) ? $valueDb : $this->formatValueToBeans($type, $valueDb);
217
            $setterMethod = $fieldMethod->getSetter();
218
            $zohoBean->{$setterMethod}($value);
219
        }
220
    }
221
222
    /**
223
     * Change the value to the good format.