Code Duplication    Length = 17-17 lines in 3 locations

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

@@ 623-639 (lines=17) @@
620
    /**
621
     * Backups global URL aliases the custom URL alias backup table.
622
     */
623
    protected function backupGlobalAliases()
624
    {
625
        $table = static::GLOBAL_ALIAS_BACKUP_TABLE;
626
627
        if (!$this->tableExists($table)) {
628
            $this->createGlobalUrlAliasBackupTable();
629
        }
630
631
        if (!$this->isTableEmpty($table)) {
632
            throw new RuntimeException(
633
                "Table '{$table}' contains data. " .
634
                "Ensure it's empty or non-existent (it will be automatically created)."
635
            );
636
        }
637
638
        $this->doBackupGlobalAliases();
639
    }
640
641
    /**
642
     * Internal method for backing up global URL aliases.
@@ 219-235 (lines=17) @@
216
    /**
217
     * Backups custom Location URL aliases the custom URL alias backup table.
218
     */
219
    protected function backupCustomLocationAliases()
220
    {
221
        $table = static::CUSTOM_ALIAS_BACKUP_TABLE;
222
223
        if (!$this->tableExists($table)) {
224
            $this->createCustomLocationUrlAliasBackupTable();
225
        }
226
227
        if (!$this->isTableEmpty($table)) {
228
            throw new RuntimeException(
229
                "Table '{$table}' contains data. " .
230
                "Ensure it's empty or non-existent (it will be automatically created)."
231
            );
232
        }
233
234
        $this->doBackupCustomLocationAliases();
235
    }
236
237
    /**
238
     * Internal method for backing up custom Location URL aliases.
@@ 546-562 (lines=17) @@
543
    /**
544
     * Generates URL aliases from the Location and Content data to the migration table.
545
     */
546
    protected function generateLocationAliases()
547
    {
548
        $tableName = static::MIGRATION_TABLE;
549
550
        if (!$this->tableExists($tableName)) {
551
            throw new RuntimeException(
552
                "Could not find main URL alias migration table '{$tableName}'. " .
553
                'Ensure that table exists (you will have to create it manually).'
554
            );
555
        }
556
557
        if (!$this->isTableEmpty($tableName)) {
558
            throw new RuntimeException("Table '{$tableName}' contains data.");
559
        }
560
561
        $this->doGenerateLocationAliases();
562
    }
563
564
    /**
565
     * Internal method for generating URL aliases.