Process existing lemmas.

@param string $family
@param array  $old_lemmas
@param array  $new_lemmas

@return bool
493023
protected function processExistingLemmas($family, array $old_lemmas = [], array $new_lemmas = [])
    {
        // Get existing lemmas
        $lemmas = array_intersect_key($old_lemmas, $new_lemmas);

        if (count($lemmas) > 0) {
            // Sort lemmas by key
            ksort($lemmas);

            if ($this->option('verbose')) {
                $this->line("            " . count($lemmas) . " already translated strings");
            }

            foreach ($lemmas as $key => $value) {
                Arr::set(
                    $this->final_lemmas, $key, $value
                );
            }

            return true;
        }

        return false;
    }
884926
protected function onAttrChanged(string $key, $oldValue, $newValue)
	{
		$this->getGraph()->nodeAttrChanged($this, $key, $oldValue, $newValue);
	}
628993
public function merge( $old, $new ) {
		if ( empty( $old ) ) {
			if ( empty( $new ) ) {
				return null;
			}
			return $this->condition( $new );
		} else if ( empty( $new ) ) {
			return $this->condition( $old );
		}

		return $this->mergeConditions( $this->condition( $old ), $this->condition( $new ) );
	}
732908
private function addFamilyAndDescendantsToCart(Family $family): void
    {
        $this->addRecordToCart($family);

        foreach ($family->spouses() as $spouse) {
            $this->addRecordToCart($spouse);
        }
        foreach ($family->children() as $child) {
            $this->addRecordToCart($child);
            foreach ($child->spouseFamilies() as $child_family) {
                $this->addFamilyAndDescendantsToCart($child_family);
            }
        }
    }
93268
public static function mergeGroup($new, $old)
    {
        $new['namespace'] = static::formatUsesPrefix($new, $old);

        $new['prefix'] = static::formatGroupPrefix($new, $old);

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

        $new['where'] = array_merge(
            isset($old['where']) ? $old['where'] : array(),
            isset($new['where']) ? $new['where'] : array()
        );

        if (isset($old['as'])) {
            $new['as'] = $old['as'] .(isset($new['as']) ? $new['as'] : '');
        }

        return array_merge_recursive(
            Arr::except($old, array('namespace', 'prefix', 'where', 'as')), $new
        );
    }
1225356
public function getMoveEventChangeSet(Section $oldParent, $oldLeft, Section $newParent)
    {
        /* Create change set for move log event
         * If section's parent has changed, return old and new parent
         * Otherwise return old and new left to mark move up or down in the same parent
         */
        $newLeft = $this->getLeft();
        $changeSet = [
            'parentId' => [$oldParent->getId(), $newParent->getId()],
            'parentName' => [$oldParent->getActiveContribution()->getTitle(), $newParent->getActiveContribution()->getTitle()],
            'isParentRoot' => [$oldParent->isRoot(), $newParent->isRoot()],
            'left' => [$oldLeft, $newLeft],
        ];

        return $changeSet;
    }
1107996
public function rename($oldPath, $newPath)
    {
        $old = $this->at($oldPath);
        $new = $this->at($newPath);

        if (null === $old || (null !== $new && 'dir' === $new->type))
            return false;

        if ('file' === $old->type) {
            $this->at($newPath, $old);
        } else {
            if (! $this->mkdir($newPath, $old->perms)) {
                return false;
            }
            $oldPath = $this->realpath($oldPath) . '/';
            $newPath = $this->realpath($newPath) . '/';
            $length = strlen($oldPath);
            foreach (array_keys($this->files) as $childPath) {
                if (substr($childPath, 0, $length) === $oldPath) {
                    $newChildPath = $newPath . substr($childPath, $length);
                    $this->at($newChildPath, $this->at($childPath));
                    $this->at($childPath, null);
                }
            }
        }
        $this->at($oldPath, null);
        return true;
    }
1042424
protected function getForeignKeysMigrations($new = [], $old = [])
    {
        if (empty($new['tables'])) {
            return [];
        }
        $output = [];
        foreach ($new['tables'] as $tableId => $newTable) {
            if ($newTable['table']['table_name'] === $this->options['default_migration_table']) {
                continue;
            }
            $oldTable = $old['tables'][$tableId];

            if (!empty($oldTable['foreign_keys'])) {
                foreach ($oldTable['foreign_keys'] as $fkName => $fkData) {
                    if (!isset($newTable['foreign_keys'][$fkName])) {
                        $output[] = $this->getForeignKeyRemove($tableId, $fkName);
                    }
                }
            }
            if (!empty($newTable['foreign_keys'])) {
                foreach ($newTable['foreign_keys'] as $fkName => $fkData) {
                    if (!isset($oldTable['foreign_keys'][$fkName])) {
                        $output[] = $this->getForeignKeyCreate($tableId, $fkName);
                    }
                }
            }
        }

        return $output;
    }
1326245
protected function auditCreatedAttributes(array &$old, array &$new)
    {
        foreach ($this->attributes as $attribute => $value) {
            if ($this->isAttributeAuditable($attribute)) {
                $new[$attribute] = $value;
            }
        }

        if ($this->shouldDynamicTableExist()) {
            foreach ($this->properties->getAttributes() as $attribute => $value) {
                if (! in_array($attribute, $this->auditableExclusions)) {
                    $new[$this->type->identifier][$attribute] = $value;
                }
            }
        }
    }
529573
public function mergeQueryAttribute( $old, $new ) {
		if ( $new === null ) {
			return $old;
		}

		if ( $old === null ) {
			return $new;
		}

		return function ( $query_vars ) use ( $old, $new ) {
			return call_user_func( $new, call_user_func( $old, $query_vars ) );
		};
	}
854059
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);
            }
        }

        if ($this->shouldDynamicTableExist()) {
            foreach ($this->properties->getDirty() as $attribute => $value) {
                if (! in_array($attribute, $this->auditableExclusions)) {
                    $old[$this->type->identifier][$attribute] = array_get($this->properties->getOriginal(), $attribute);
                    $new[$this->type->identifier][$attribute] = array_get($this->properties->getAttributes(), $attribute);
                }
            }
        }
    }
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));
    }
799974
protected function auditDeletedAttributes(array &$old, array &$new)
    {
        foreach ($this->attributes as $attribute => $value) {
            if ($this->isAttributeAuditable($attribute)) {
                $old[$attribute] = $value;
            }
        }
    }
39755
private function getCreatedChecks(Table $oldTable, Table $newTable)
    {
        $createdChecks = array();

        foreach ($newTable->getChecks() as $check) {
            if (!$oldTable->hasCheck($check->getName())
                || $this->compareChecks($oldTable->getCheck($check->getName()), $check)) {
                $createdChecks[] = $check;
            }
        }

        return $createdChecks;
    }
1060359
public function reparent($oldParentId, $newParentId)
    {
        try {
            $this->innerGateway->reparent($oldParentId, $newParentId);
        } catch (DBALException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new \RuntimeException('Database error', 0, $e);
        }
    }
922835
public function checkModelSchemas($oldVersion = null)
    {
        Model::clearAllRepositories();

        /**
         * @var Model $class
         */
        /**
         * @var Model $object
         */
        foreach ($this->models as $class) {
            $object = new $class();

            $repository = $object->getRepository();
            $schema = $repository->getRepositorySchema();
            $schema->checkSchema($repository);

            $class::checkRecords($oldVersion, $this->version);
        }
    }
873500
public function compareViews(View $oldView, View $newView)
    {
        return ($oldView->getName() !== $newView->getName()) || ($oldView->getSQL() !== $newView->getSQL());
    }