Code Duplication    Length = 17-17 lines in 3 locations

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

@@ 221-237 (lines=17) @@
218
    /**
219
     * Backups custom Location URL aliases the custom URL alias backup table.
220
     */
221
    protected function backupCustomLocationAliases()
222
    {
223
        $table = static::CUSTOM_ALIAS_BACKUP_TABLE;
224
225
        if (!$this->tableExists($table)) {
226
            $this->createCustomLocationUrlAliasBackupTable();
227
        }
228
229
        if (!$this->isTableEmpty($table)) {
230
            throw new RuntimeException(
231
                "Table '{$table}' contains data. " .
232
                "Ensure it's empty or non-existent (it will be automatically created)."
233
            );
234
        }
235
236
        $this->doBackupCustomLocationAliases();
237
    }
238
239
    /**
240
     * Internal method for backing up custom Location URL aliases.
@@ 547-563 (lines=17) @@
544
    /**
545
     * Generates URL aliases from the Location and Content data to the migration table.
546
     */
547
    protected function generateLocationAliases()
548
    {
549
        $tableName = static::MIGRATION_TABLE;
550
551
        if (!$this->tableExists($tableName)) {
552
            throw new RuntimeException(
553
                "Could not find main URL alias migration table '{$tableName}'. " .
554
                'Ensure that table exists (you will have to create it manually).'
555
            );
556
        }
557
558
        if (!$this->isTableEmpty($tableName)) {
559
            throw new RuntimeException("Table '{$tableName}' contains data.");
560
        }
561
562
        $this->doGenerateLocationAliases();
563
    }
564
565
    /**
566
     * Internal method for generating URL aliases.
@@ 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.