Skip to content

Commit

Permalink
Dev: Some method name changes
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Oct 5, 2018
1 parent 04636b9 commit 561b1ef
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 23 deletions.
21 changes: 6 additions & 15 deletions application/libraries/ExtensionInstaller/ExtensionUpdater.php
Expand Up @@ -162,15 +162,6 @@ public function getVersionMessage(array $versions)
return '<p>' . $message . '</p>';
}

/**
* Get description of how to update to latest version, based on available
* information in <updater> XML.
* @return string
*/
public function getUpdateMethodsDescription(array $versions)
{
}

/**
* @return array
*/
Expand All @@ -189,18 +180,18 @@ public function getLatestVersion(array $versions)
return $highestVersion;
}

/**
* Uses the version fetchers to fetch info about available updates for this extension.
* @return array
*/
abstract public function fetchVersions();

/**
* Create an updater object for every extension of corresponding type.
* @return array [ExtensionUpdater[] $updaters, string[] $errorMessages]
*/
abstract public static function createUpdaters();

/**
* Uses the version fetchers to fetch info about available updates for this extension.
* @return array
*/
abstract public function fetchVersions();

/**
* Fetch extension name from extension model.
* Extension type specific implementation.
Expand Down
Expand Up @@ -31,7 +31,7 @@ class ExtensionUpdaterServiceLocator
*/
public function init()
{
$this->addUpdater(
$this->addUpdaterType(
'plugin',
function () {
return PluginUpdater::createUpdaters();
Expand All @@ -44,7 +44,7 @@ function () {
* @param callable $creator Callable that returns an ExtensionUpdater array.
* @return void
*/
public function addUpdater(string $name, callable $creator)
public function addUpdaterType(string $name, callable $creator)
{
if (isset($this->updaters[$name])) {
throw new \Exception("Extension installer with name $name already exists");
Expand Down
1 change: 1 addition & 0 deletions application/libraries/ExtensionInstaller/PluginUpdater.php
Expand Up @@ -45,6 +45,7 @@ public static function createUpdaters() : array
/**
* Fetch all new available version from each version fetcher.
* @return array $versions
* @todo Move to parent class?
*/
public function fetchVersions()
{
Expand Down
Expand Up @@ -36,7 +36,7 @@ class VersionFetcherServiceLocator
public function init()
{
// Add RESTVersionFetcher, available by default.
$this->addVersionFetcher(
$this->addVersionFetcherType(
'rest',
function (\SimpleXMLElement $updaterXml) {
$vf = new RESTVersionFetcher($updaterXml);
Expand All @@ -45,7 +45,7 @@ function (\SimpleXMLElement $updaterXml) {
);

// TODO: Not implemented.
$this->addVersionFetcher(
$this->addVersionFetcherType(
'git',
function (\SimpleXMLElement $updaterXml) {
return new GitVersionFetcher($updaterXml);
Expand All @@ -54,6 +54,7 @@ function (\SimpleXMLElement $updaterXml) {
}

/**
* Creates a version fetcher based on xml $updaterXml.
* @param SimpleXMLElement $updaterXml <updater> tag from config.xml.
* @return VersionFetcher
* @throws Exception if version fetcher is not found.
Expand All @@ -65,8 +66,8 @@ public function createVersionFetcher(\SimpleXMLElement $updaterXml)
$type = (string) $updaterXml->type;

if (isset($this->versionFetcherCreators[$type])) {
$fileFetcher = $this->versionFetcherCreators[$type]($updaterXml);
return $fileFetcher;
$versionFetcher = $this->versionFetcherCreators[$type]($updaterXml);
return $versionFetcher;
} else {
throw new \Exception('Did not find version fetcher of type ' . json_encode($type));
}
Expand All @@ -78,7 +79,7 @@ public function createVersionFetcher(\SimpleXMLElement $updaterXml)
* @return void
* @throws Exception if version fetcher with name $name already exists.
*/
public function addVersionFetcher(string $name, callable $vfCreator)
public function addVersionFetcherType(string $name, callable $vfCreator)
{
if (isset($this->versionFetcherCreators[$name])) {
// NB: Internal error, don't need to translate.
Expand Down
2 changes: 1 addition & 1 deletion application/models/ExtensionConfig.php
Expand Up @@ -132,7 +132,7 @@ public static function loadConfigFromFile($file)
}

/**
* Parse <updater> tag in config.xml and return objects and potential error messages.
* Create a version fetcher for every <updater> tag in config.xml.
* @return array VersionFetcher[]
*/
public function createVersionFetchers()
Expand Down

0 comments on commit 561b1ef

Please sign in to comment.