Code Duplication    Length = 22-22 lines in 2 locations

migrations/Migration.php 2 locations

@@ 41-62 (lines=22) @@
38
    /**
39
     * @inheritdoc
40
     */
41
    public function up()
42
    {
43
        $transaction = $this->authManager->db->beginTransaction();
44
        try {
45
            if ($this->safeUp() === false) {
46
                $transaction->rollBack();
47
48
                return false;
49
            }
50
            $transaction->commit();
51
            $this->authManager->invalidateCache();
52
53
            return true;
54
        } catch (\Exception $e) {
55
            echo "Rolling transaction back\n";
56
            echo 'Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ':' . $e->getLine() . ")\n";
57
            echo $e->getTraceAsString() . "\n";
58
            $transaction->rollBack();
59
60
            return false;
61
        }
62
    }
63
64
    /**
65
     * @inheritdoc
@@ 67-88 (lines=22) @@
64
    /**
65
     * @inheritdoc
66
     */
67
    public function down()
68
    {
69
        $transaction = $this->authManager->db->beginTransaction();
70
        try {
71
            if ($this->safeDown() === false) {
72
                $transaction->rollBack();
73
74
                return false;
75
            }
76
            $transaction->commit();
77
            $this->authManager->invalidateCache();
78
79
            return true;
80
        } catch (\Exception $e) {
81
            echo "Rolling transaction back\n";
82
            echo 'Exception: ' . $e->getMessage() . ' (' . $e->getFile() . ':' . $e->getLine() . ")\n";
83
            echo $e->getTraceAsString() . "\n";
84
            $transaction->rollBack();
85
86
            return false;
87
        }
88
    }
89
90
    /**
91
     * This method contains the logic to be executed when applying this migration.