Code Duplication    Length = 18-18 lines in 3 locations

source/Spiral/Database/Schemas/StateComparator.php 3 locations

@@ 119-136 (lines=18) @@
116
     *
117
     * @return array
118
     */
119
    public function alteredColumns(): array
120
    {
121
        $difference = [];
122
123
        $initialColumns = $this->initial->getColumns();
124
        foreach ($this->current->getColumns() as $name => $column) {
125
            if (!$this->initial->knowsColumn($name)) {
126
                //Added into schema
127
                continue;
128
            }
129
130
            if (!$column->compare($initialColumns[$name])) {
131
                $difference[] = [$column, $initialColumns[$name]];
132
            }
133
        }
134
135
        return $difference;
136
    }
137
138
    /**
139
     * @return AbstractIndex[]
@@ 173-190 (lines=18) @@
170
     *
171
     * @return array
172
     */
173
    public function alteredIndexes(): array
174
    {
175
        $difference = [];
176
177
        $initialIndexes = $this->initial->getIndexes();
178
        foreach ($this->current->getIndexes() as $name => $index) {
179
            if (!$this->initial->knowsIndex($name)) {
180
                //Added into schema
181
                continue;
182
            }
183
184
            if (!$index->compare($initialIndexes[$name])) {
185
                $difference[] = [$index, $initialIndexes[$name]];
186
            }
187
        }
188
189
        return $difference;
190
    }
191
192
    /**
193
     * @return AbstractReference[]
@@ 227-244 (lines=18) @@
224
     *
225
     * @return array
226
     */
227
    public function alteredForeigns(): array
228
    {
229
        $difference = [];
230
231
        $initialForeigns = $this->initial->getForeigns();
232
        foreach ($this->current->getForeigns() as $name => $foreign) {
233
            if (!$this->initial->knowsForeign($name)) {
234
                //Added into schema
235
                continue;
236
            }
237
238
            if (!$foreign->compare($initialForeigns[$name])) {
239
                $difference[] = [$foreign, $initialForeigns[$name]];
240
            }
241
        }
242
243
        return $difference;
244
    }
245
246
    /**
247
     * @return array