Code Duplication    Length = 21-21 lines in 2 locations

eZ/Bundle/EzPublishMigrationBundle/Command/LegacyStorage/RegenerateUrlAliasesCommand.php 2 locations

@@ 300-320 (lines=21) @@
297
    /**
298
     * Restores custom Location URL aliases from the backup table.
299
     */
300
    protected function restoreCustomLocationAliases()
301
    {
302
        $mainTable = static::MIGRATION_TABLE;
303
        $backupTable = static::CUSTOM_ALIAS_BACKUP_TABLE;
304
305
        if (!$this->tableExists($mainTable)) {
306
            throw new RuntimeException(
307
                "Could not find main URL alias migration table '{$mainTable}'. " .
308
                'Ensure that table exists (you will have to create it manually).'
309
            );
310
        }
311
312
        if (!$this->tableExists($backupTable)) {
313
            throw new RuntimeException(
314
                "Could not find custom Location URL alias backup table '{$backupTable}'. " .
315
                "Ensure that table is created by 'backup-custom' action."
316
            );
317
        }
318
319
        $this->doRestoreCustomLocationAliases();
320
    }
321
322
    /**
323
     * Restores custom Location URL aliases from the backup table.
@@ 744-764 (lines=21) @@
741
    /**
742
     * Restores global URL aliases from the backup table.
743
     */
744
    protected function restoreGlobalAliases()
745
    {
746
        $table = static::MIGRATION_TABLE;
747
        $backupTable = static::GLOBAL_ALIAS_BACKUP_TABLE;
748
749
        if (!$this->tableExists($table)) {
750
            throw new RuntimeException(
751
                "Could not find main URL alias migration table '{$table}'. " .
752
                'Ensure that table exists (you will have to create it manually).'
753
            );
754
        }
755
756
        if (!$this->tableExists($backupTable)) {
757
            throw new RuntimeException(
758
                "Could not find global URL alias backup table '$backupTable'. " .
759
                "Ensure that table is created by 'backup-global' action."
760
            );
761
        }
762
763
        $this->doRestoreGlobalAliases();
764
    }
765
766
    /**
767
     * Restores global URL aliases from the backup table.