Given the list of changes in available updates, pick those to send to site admins

@param array $changes as returned by {@link self::compare_responses()}
@return array of \core\update\info objects to send to site admins
421734
protected function cron_notifications(array $changes) {
        global $CFG;

        if (empty($changes)) {
            return array();
        }

        $notifications = array();
        $pluginman = \core_plugin_manager::instance();
        $plugins = $pluginman->get_plugins();

        foreach ($changes as $component => $componentchanges) {
            if (empty($componentchanges)) {
                continue;
            }
            $componentupdates = $this->get_update_info($component,
                array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
            if (empty($componentupdates)) {
                continue;
            }
            // Notify only about those $componentchanges that are present in $componentupdates
            // to respect the preferences.
            foreach ($componentchanges as $componentchange) {
                foreach ($componentupdates as $componentupdate) {
                    if ($componentupdate->version == $componentchange['version']) {
                        if ($component == 'core') {
                            // In case of 'core', we already know that the $componentupdate
                            // is a real update with higher version ({@see self::get_update_info()}).
                            // We just perform additional check for the release property as there
                            // can be two Moodle releases having the same version (e.g. 2.4.0 and 2.5dev shortly
                            // after the release). We can do that because we have the release info
                            // always available for the core.
                            if ((string)$componentupdate->release === (string)$componentchange['release']) {
                                $notifications[] = $componentupdate;
                            }
                        } else {
                            // Use the core_plugin_manager to check if the detected $componentchange
                            // is a real update with higher version. That is, the $componentchange
                            // is present in the array of {@link \core\update\info} objects
                            // returned by the plugin's available_updates() method.
                            list($plugintype, $pluginname) = core_component::normalize_component($component);
                            if (!empty($plugins[$plugintype][$pluginname])) {
                                $availableupdates = $plugins[$plugintype][$pluginname]->available_updates();
                                if (!empty($availableupdates)) {
                                    foreach ($availableupdates as $availableupdate) {
                                        if ($availableupdate->version == $componentchange['version']) {
                                            $notifications[] = $componentupdate;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        return $notifications;
    }
538999
final public function update(array $keys = null)
    {
        $pre = $this->preUpdate($keys);
        if ($pre === false) {
            $this->logger->error(sprintf(
                'Can not update object "%s:%s"; cancelled by %s::preUpdate()',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        $ret = $this->source()->updateItem($this, $keys);
        if ($ret === false) {
            $this->logger->error(sprintf(
                'Can not update object "%s:%s"; repository failed for %s',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        $post = $this->postUpdate($keys);
        if ($post === false) {
            $this->logger->warning(sprintf(
                'Updated object "%s:%s" but %s::postUpdate() failed',
                $this->objType(),
                $this->id(),
                get_called_class()
            ));
            return false;
        }

        return true;
    }
526986
protected function getChoices(array $statuses)
    {
        $transitions = array();

        foreach ($statuses as $statusFrom) {
            foreach ($statuses as $statusTo) {
                $transitionName = $this->transitionTransformer->generateTransitionName($statusFrom, $statusTo);
                $transitions[$transitionName] = $transitionName;
            }
        }

        return $transitions;
    }
1210965
public function prepareUpdateChangeSet($object, ChangeSet $changeSet) : array
    {
        if (! $object instanceof PersistableInterface) {
            throw new InvalidArgumentException(sprintf('%s must implement PersistableInterface.', get_class($object)));
        }

        return $object->prepareUpdateChangeSet($changeSet);
    }
985221
private static function getUpdateFields(array $oldFields, array $changeFields)
    {
        foreach ($oldFields as $fieldName => $fieldValue) {
            if (!isset($changeFields[$fieldName])) {
                continue;
            }

            $changeValue = $changeFields[$fieldName];
            if ($changeValue == $fieldValue) {
                unset($changeFields[$fieldName]);
                continue;
            }
        }

        return $changeFields;
    }
851143
protected function update(array $notices)
    {
        if ($this->get() === $notices) {
            return; // Nothing to do.
        }
        $this->s::sysOption('notices', $notices, false);
    }
578082
protected function update($options = [])
    {
        $params = $this->prepareFields($options);
        $diff = $this->findDiff($params);
        $uri = static::getUri() . $this->{$this->primaryKey};

        $updateResult = static::put($this->client, $uri, [
            'json' => $diff,
        ]);

        if (!isset($updateResult['errors'])) {
            $this->cacheFields($params);
            foreach($updateResult as $name => $property) {
                $this->__set($name, $property);
            }
        }

        return $updateResult;
    }
381790
public function getChangesForRemovedEntities()
    {
        $removed = [];
        foreach ($this->changes as $change) {
            if ($change instanceof RemovedEntity) {
                $removed[] = $change;
            }
        }

        return $removed;
    }
670095
public function buildReplacements(array $replacements)
    {
        $datas = array();
        foreach ($replacements as $key => $value) {
            $key = $this->getOption('separator_start').$key.$this->getOption('separator_end');
            $datas[$key] = $value;
        }

        return $datas;
    }
230490
public function compare(string $from, string $to): array
    {
        $compare = (new Compare($this->repo->getRoot()))->revisions($from, $to)
                                                        ->ignoreWhitespacesAtEndOfLine();

        $result = $this->runner->run($compare, new Compare\FullDiffList());

        return $result->getFormattedOutput();
    }
660820
public function calculateChangeSet()
    {
        if (false === $this->isDirty()) {
            return [];
        }
        return [
            'old' => empty($this->original) ? null : $this->original,
            'new' => empty($this->models) ? null : $this->models,
        ];
    }
213667
private function getChanges($latest_release = false, $pulls)
	{
		$changes = array();

		foreach ($pulls as $pull)
		{
			if (!$latest_release || strtotime($pull->merged_at) > strtotime($latest_release->published_at))
			{
				if ($this->getJConfig()->github->changelog_source == "pr")
				{
					$changes[] = $pull->title;
				}

				$message   = explode(PHP_EOL, $pull->commit->message);
				$changes[] = $message[0];
			}
		}

		return $changes;
	}
373938
protected function getListItems()
    {
        $changesets = ChangeSet::get();
        // Filter out published items if disabled
        if (!$this->config()->get('show_published')) {
            $changesets = $changesets->filter('State', ChangeSet::STATE_OPEN);
        }
        // Filter out automatically created changesets
        if (!$this->config()->get('show_inferred')) {
            $changesets = $changesets->filter('IsInferred', 0);
        }
        return $changesets
            ->filterByCallback(function ($item) {
                /** @var ChangeSet $item */
                return ($item->canView());
            });
    }
176344
public function replacements($replacements = null)
    {
        if (!is_null($replacements)) {
            $this->replacements = $replacements;
        }

        return $this->replacements;
    }
1126749
protected function getBindingsMergedWithValues(array $values)
    {
        $bindings = [];

        foreach ($values as $key => $value)
        {
            $bindings[$key .'_update'] = $value;
        }

        return array_merge($this->getBindings(), $bindings);
    }
834134
public function changes()
    {
        $changes = [];
        foreach ($this->changedAttributes as $attrName => $originalValue) {
            $changes[$attrName] = [$originalValue, $this->attributes->get($attrName)];
        }
        return $changes;
    }
1370091
protected function hasChanges($changes, $attributes = null)
    {
        // If no specific attributes were provided, we will just see if the dirty array
        // already contains any attributes. If it does we will just return that this
        // count is greater than zero. Else, we need to check specific attributes.
        if (empty($attributes)) {
            return count($changes) > 0;
        }

        // Here we will spin through every attribute and see if this is in the array of
        // dirty attributes. If it is, we will return true and if we make it through
        // all of the attributes for the entire array we will return false at end.
        foreach (Arr::wrap($attributes) as $attribute) {
            if (array_key_exists($attribute, $changes)) {
                return true;
            }
        }

        return false;
    }