Code Duplication    Length = 23-24 lines in 2 locations

src/Ifsnop/Mysqldump/Mysqldump.php 2 locations

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