Code Duplication    Length = 23-24 lines in 2 locations

src/Ifsnop/Mysqldump/Mysqldump.php 2 locations

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