Code Duplication    Length = 16-18 lines in 2 locations

src/Database/DatabaseQuery.php 2 locations

@@ 233-248 (lines=16) @@
230
     *
231
     * @return string
232
     */
233
    protected static function buildValues($getClassVars)
234
    {
235
        $counter = 0;
236
        $insertQuery = "";
237
        $columnNames = self::getColumns($getClassVars);
238
        $arraySize = count($columnNames);
239
240
        foreach ($columnNames as $key => $value)
241
        {
242
            $counter++;
243
            $insertQuery .= "'".self::sanitize($value) ."'";
244
            if($arraySize > $counter)
245
                $insertQuery .= ", ";
246
        }
247
        return $insertQuery;
248
    }
249
250
    /**
251
     * buildClause  Build the clause value
@@ 257-274 (lines=18) @@
254
     *
255
     * @return string
256
     */
257
    protected static function buildClause($tableName, $data)
258
    {
259
        $counter = 0;
260
        $updateQuery = "";
261
        $arraySize = count($data);
262
263
        foreach ($data as $key => $value)
264
        {
265
            $counter++;
266
            $columnName = self::checkColumn($tableName, self::sanitize($key));
267
            $updateQuery .= $columnName ." = '".self::sanitize($value)."'";
268
            if ($arraySize > $counter)
269
            {
270
                $updateQuery .= ", ";
271
            }
272
        }
273
        return $updateQuery;
274
    }
275
276
    /**
277
     * selectAllQuery