Code Duplication    Length = 21-21 lines in 2 locations

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

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