public function includeThemeUpdates(SiteState $siteState) { return $this->collection($this->filterUpdates($siteState->getSiteUpdates(), SiteUpdate::TYPE_THEME), $this->transformers->get(SiteUpdate::class)); }
/** * @param SiteState $state * @param SiteStateResult $result * * @return SiteUpdate[] */ private function getUpdates(SiteState $state, SiteStateResult $result) { if (!$result->updates) { return []; } $existingUpdates = $state->getSiteUpdates(); $updates = []; foreach ($result->updates as $slug => $updateData) { if (isset($existingUpdates[$slug])) { $update = $existingUpdates[$slug]; } else { $update = new SiteUpdate($state, $slug); } $update->setType($updateData->type)->setName($updateData->name)->setProject($updateData->project)->setPackage($updateData->package)->setExistingVersion($updateData->existingVersion)->setRecommendedVersion($updateData->recommendedVersion)->setRecommendedDownloadLink($updateData->recommendedDownloadLink)->setStatus($updateData->status)->setIncludes($updateData->includes)->setEnabled($updateData->enabled)->setBaseThemes($updateData->baseThemes)->setSubThemes($updateData->subThemes); $updates[$slug] = $update; } return $updates; }