Code Duplication    Length = 23-24 lines in 2 locations

src/Ifsnop/Mysqldump/Mysqldump.php 2 locations

@@ 675-698 (lines=24) @@
672
     * @param string $viewName  Name of view to export
673
     * @return null
674
     */
675
    private function getViewStructureTable($viewName)
676
    {
677
        if (!$this->dumpSettings['skip-comments']) {
678
            $ret = "--" . PHP_EOL .
679
                "-- Stand-In structure for view `${viewName}`" . PHP_EOL .
680
                "--" . PHP_EOL . PHP_EOL;
681
            $this->compressManager->write($ret);
682
        }
683
        $stmt = $this->typeAdapter->show_create_view($viewName);
684
685
        // create views as tables, to resolve dependencies
686
        foreach ($this->dbHandler->query($stmt) as $r) {
687
            if ($this->dumpSettings['add-drop-table']) {
688
                $this->compressManager->write(
689
                    $this->typeAdapter->drop_view($viewName)
690
                );
691
            }
692
693
            $this->compressManager->write(
694
                $this->createStandInTable($viewName)
695
            );
696
            break;
697
        }
698
    }
699
700
    /**
701
     * Write a create table statement for the table Stand-In, show create
@@ 727-749 (lines=23) @@
724
     * @param string $viewName  Name of view to export
725
     * @return null
726
     */
727
    private function getViewStructureView($viewName)
728
    {
729
        if (!$this->dumpSettings['skip-comments']) {
730
            $ret = "--" . PHP_EOL .
731
                "-- View structure for view `${viewName}`" . PHP_EOL .
732
                "--" . PHP_EOL . PHP_EOL;
733
            $this->compressManager->write($ret);
734
        }
735
        $stmt = $this->typeAdapter->show_create_view($viewName);
736
737
        // create views, to resolve dependencies
738
        // replacing tables with views
739
        foreach ($this->dbHandler->query($stmt) as $r) {
740
            // because we must replace table with view, we should delete it
741
            $this->compressManager->write(
742
                $this->typeAdapter->drop_view($viewName)
743
            );
744
            $this->compressManager->write(
745
                $this->typeAdapter->create_view($r)
746
            );
747
            break;
748
        }
749
    }
750
751
    /**
752
     * Trigger structure extractor