Code Duplication    Length = 10-12 lines in 5 locations

htdocs/xoops_lib/Xmf/Database/Tables.php 5 locations

@@ 391-402 (lines=12) @@
388
     *
389
     * @return bool true if no errors, false if errors encountered
390
     */
391
    public function dropColumn($table, $column)
392
    {
393
        // Find table def.
394
        if (isset($this->tables[$table])) {
395
            $tableDef = $this->tables[$table];
396
            $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP COLUMN `{$column}`";
397
        } else {
398
            return $this->tableNotEstablished();
399
        }
400
401
        return true;
402
    }
403
404
    /**
405
     * Add drop index operation to the work queue
@@ 412-422 (lines=11) @@
409
     *
410
     * @return bool true if no errors, false if errors encountered
411
     */
412
    public function dropIndex($name, $table)
413
    {
414
        if (isset($this->tables[$table])) {
415
            $tableDef = $this->tables[$table];
416
            $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP INDEX `{$name}`";
417
        } else {
418
            return $this->tableNotEstablished();
419
        }
420
421
        return true;
422
    }
423
424
    /**
425
     * Add drop for all (non-PRIMARY) keys for a table to the work
@@ 467-477 (lines=11) @@
464
     *
465
     * @return bool true if no errors, false if errors encountered
466
     */
467
    public function dropPrimaryKey($table)
468
    {
469
        if (isset($this->tables[$table])) {
470
            $tableDef = $this->tables[$table];
471
            $this->queue[] = "ALTER TABLE `{$tableDef['name']}` DROP PRIMARY KEY ";
472
        } else {
473
            return $this->tableNotEstablished();
474
        }
475
476
        return true;
477
    }
478
479
    /**
480
     * Add drop of table to the work queue
@@ 486-495 (lines=10) @@
483
     *
484
     * @return bool true if no errors, false if errors encountered
485
     */
486
    public function dropTable($table)
487
    {
488
        if (isset($this->tables[$table])) {
489
            $tableDef = $this->tables[$table];
490
            $this->queue[] = "DROP TABLE `{$tableDef['name']}` ";
491
            unset($this->tables[$table]);
492
        }
493
        // no table is not an error since we are dropping it anyway
494
        return true;
495
    }
496
497
498
    /**
@@ 693-703 (lines=11) @@
690
     *
691
     * @return bool true if no errors, false if errors encountered
692
     */
693
    public function truncate($table)
694
    {
695
        if (isset($this->tables[$table])) {
696
            $tableDef = $this->tables[$table];
697
            $this->queue[] = "TRUNCATE TABLE `{$tableDef['name']}`";
698
        } else {
699
            return $this->tableNotEstablished();
700
        }
701
702
        return true;
703
    }
704
705
706