Get table migration (old tables).

@param array $output
@param array $new
@param array $old

@return array
513419
protected function getTableMigrationDropTables(array $output, array $new, array $old): array
    {
        if (empty($old['tables'])) {
            return $output;
        }

        foreach ($old['tables'] as $tableName => $table) {
            if ($tableName === $this->options['default_migration_table']) {
                continue;
            }

            if (!isset($new['tables'][$tableName])) {
                $output[] = $this->getDropTable($tableName);
                continue;
            }
        }

        return $output;
    }
113434
public function rename($newName, $returnNew = true)
    {
        $this->db->setQuery(
            'RENAME TABLE ' . $this->db->quoteName($this->getName()) . ' TO ' . $this->db->quoteName($newName)
        );

        $this->db->execute();

        if ($returnNew) {
            return $this->db->getTable($newName);
        }

        return $this->reset();
    }
34626
protected function auditUpdatedAttributes(array &$old, array &$new)
    {
        foreach ($this->getDirty() as $attribute => $value) {
            if ($this->isAttributeAuditable($attribute)) {
                $old[$attribute] = array_get($this->original, $attribute);
                $new[$attribute] = array_get($this->attributes, $attribute);
            }
        }
    }
1188970
public static function merge($src, array $new): array
    {
        if (!$src || !\is_array($src)) {
            return $new;
        }

        if (!$new) {
            return $src;
        }

        foreach ($new as $key => $value) {
            if (\is_int($key)) {
                if (isset($src[$key])) {
                    $src[] = $value;
                } else {
                    $src[$key] = $value;
                }
            } elseif (\array_key_exists($key, $src) && \is_array($value)) {
                $src[$key] = self::merge($src[$key], $new[$key]);
            } else {
                $src[$key] = $value;
            }
        }

        return $src;
    }
310189
protected static function mergeGroup($new, $old)
    {
        $new['prefix'] = self::formatGroupPrefix($new, $old);

        $new['class'] = self::formatGroupClass($new, $old);

        return array_merge(Arr::except($old, array('prefix', 'class')), $new);
    }
575356
protected function mergeGroup(array $new, array $old)
    {
        $new['namespace'] = $this->formatNamespace($new, $old);

        $new['prefix'] = $this->formatPrefix($new, $old);

        foreach (['middleware', 'providers', 'scopes', 'before', 'after'] as $option) {
            $new[$option] = $this->formatArrayBasedOption($option, $new);
        }

        if (isset($new['domain'])) {
            unset($old['domain']);
        }

        if (isset($new['conditionalRequest'])) {
            unset($old['conditionalRequest']);
        }

        if (isset($new['uses'])) {
            $new['uses'] = $this->formatUses($new, $old);
        }

        $new['where'] = array_merge(array_get($old, 'where', []), array_get($new, 'where', []));

        return array_merge_recursive(array_except($old, ['namespace', 'prefix', 'where']), $new);
    }
495597
public function getTable($name, $new = false)
    {
        if (empty($this->tables[$name]) || $new) {
            $class = sprintf('Windwalker\\Database\\Driver\\%s\\%sTable', ucfirst($this->name), ucfirst($this->name));

            $this->tables[$name] = new $class($name, $this);
        }

        return $this->tables[$name];
    }
909714
public static function mergeStatic($new = null, array $old = [])
    {
        // Parses the string into an associative array
        parse_str(preg_replace('/\s*([\w-]+)\s*=\s*"([^"]+)"/', '$1=$2&', $new), $attrs);

        // Merge classes
        $attrs['class'] = self::formatGroupClass($attrs, $old);

        // Merging new and old array and parse it as a string
        return self::attributes(array_merge(Arr::except($old, array('class')), $attrs));
    }
949149
protected function getCreateTable($output, $table, $tableName, $forceSave = false)
    {
        $output[] = $this->getTableVariable($table, $tableName);

        $alternatePrimaryKeys = $this->getAlternatePrimaryKeys($table);
        if (empty($alternatePrimaryKeys) || $forceSave) {
            $output[] = sprintf("%s\$table->save();", $this->ind2);
        }

        return $output;
    }
603474
public function buildChanges($oldEntity, $newEntity)
    {
        $changes = [];
        $entityDefinition = $this->definitions->getDefinition($oldEntity);
        foreach ($entityDefinition->getObservedProperties() as $property) {
            if ($this->isDifferent($property, $oldEntity, $newEntity)) {
                $oldValue = $this->propertyAccessor->getValue($oldEntity, $property->getName());
                $newValue = $this->propertyAccessor->getValue($newEntity, $property->getName());

                $changes[] = $this->buildChange($property, $oldValue, $newValue);
            }
        }

        return new ChangeSet($changes);
    }
1258377
public function replace($old, $new)
    {
        $this->str = $this->str->replace((string)$old, (string)$new);

        return $this;
    }
320386
public static function merge(array $old, array $new)
    {
        foreach ($new as $key => $value) {
            if (isset($old[$key]) && is_array($old[$key]) && is_array($value)) {
                $old[$key] = self::merge($old[$key], $value);
            } else {
                $old[$key] = $value;
            }
        }

        return $old;
    }
650441
public function showMigratingInfo($output, $level = 0)
    {
        $output->info(
            str_repeat("_",$level) . 'Migrating ' . class_basename($this) . ' ('. $this->id
            . ') | Module ' . $this->module->name . ' ('. $this->module->id .
            ') | Submodule ' . $this->submodule->name . ' ('. $this->submodule->id .
            ') | Enrollment ' . ' ('. $this->enrollment->id .
            ') ...'
        );
    }
857186
public function lines(array $old, array $new)
    {
        $diff = parent::lines($old, $new);

        $len = count($new);
        for ($i = 0; $i < $len; $i++) {
            if (isset($diff[$i]) && !is_null($new[$i]) && $diff[$i]['col'] > 0) {
                $styling = $this->cursor->getCurrentFormatting(mb_substr($new[$i], 0, $diff[$i]['col']));
                $diff[$i]['col'] = mb_strlen($this->cursor->filter(mb_substr($new[$i], 0, $diff[$i]['col'])));
                if (mb_strlen($styling) > 0) {
                    $diff[$i]['str'] = $styling . $diff[$i]['str'];
                }
            }
        }

        return $diff;
    }
550270
public function replace(string $old, string $new)
    {
        if ($old === $new) {
            return;
        }
        $this->tokenize();
        $i = array_search($old, $this->tokens);
        if ($i !== false) {
            $j = array_search($new, $this->tokens);
            if ($j === false) {
                $this->tokens[$i] = $new;
            } else {
                array_splice($this->tokens, $i, 1);
            }
            $this->setAttributeValue();
        }
    }
901777
protected function equals($old, $new)
    {
        if (is_array($old)) {
            // compare arrays
            if (array_keys($old) != array_keys($new)) {
                return false;
            }

            foreach (array_keys($old) as $key) {
                if ( ! $this->equals($old[$key], $new[$key])) {
                    return false;
                }
            }

            return true;
        }

        if ( ! is_object($old) ) {
            // compare non-array scalars
            return ($old == $new);
        }

        if (get_class($old) != get_class($new)) {
            // compare object by class name
            return false;
        }

        // compare each sub-node
        foreach ($old->getSubNodeNames() as $property) {
            if ( ! $this->equals($old->$property, $new->$property)) {
                return false;
            }
        }

        return true;
    }
50196
public function getTable($name, $new = false)
    {
        $table = $this->db->getTable($name, $new);

        $table->setDatabase($this);

        return $table;
    }