Code Duplication    Length = 9-9 lines in 2 locations

src/Tequilarapido/Cli/Commands/DatabaseOccurrences.php 1 location

@@ 110-118 (lines=9) @@
107
        return $occurrences;
108
    }
109
110
    protected function searchQuery($tableName, $tableInfos, $field_name, $replacement)
111
    {
112
        // table with primary key ?
113
        if (empty($tableInfos['pk'])) {
114
            return sprintf('SELECT `%s` FROM %s WHERE `%s` LIKE "%%%s%%"', $field_name, $tableName, $field_name, $replacement->from);
115
        } else {
116
            return sprintf('SELECT `%s`, ' . $tableInfos['pk'] . ' AS _id FROM %s WHERE `%s` LIKE "%%%s%%"', $field_name, $tableName, $field_name, $replacement->from);
117
        }
118
    }
119
120
    protected function displayOccurrences()
121
    {

src/Tequilarapido/Cli/Commands/DatabaseReplace.php 1 location

@@ 198-206 (lines=9) @@
195
        return $queriesCount;
196
    }
197
198
    protected function searchQuery($tableName, $tableInfos, $field_name, $replacement)
199
    {
200
        // table with primary key ?
201
        if (empty($tableInfos['pk'])) {
202
            return sprintf('SELECT `%s` FROM %s WHERE `%s` LIKE "%%%s%%"', $field_name, $tableName, $field_name, $replacement->from);
203
        } else {
204
            return sprintf('SELECT `%s`, ' . $tableInfos['pk'] . ' AS _id FROM %s WHERE `%s` LIKE "%%%s%%"', $field_name, $tableName, $field_name, $replacement->from);
205
        }
206
    }
207
208
    private function beginTransaction()
209
    {