public function load($versionNumber)
{
$versionNumber = trim($versionNumber);
if (!strlen($versionNumber)) {
throw new ApplicationException('Cannot load the the version model - the version number should not be empty.');
}
$pluginVersions = $this->getPluginVersionInformation();
if (!array_key_exists($versionNumber, $pluginVersions)) {
throw new ApplicationException('The requested version does not exist in the version information file.');
}
$this->version = $versionNumber;
$this->originalVersion = $this->version;
$this->exists = true;
$versionInformation = $pluginVersions[$versionNumber];
if (!is_array($versionInformation)) {
$this->description = $versionInformation;
} else {
$cnt = count($versionInformation);
if ($cnt > 2) {
throw new ApplicationException('The requested version cannot be edited with Builder as it refers to multiple PHP scripts.');
}
if ($cnt > 0) {
$this->description = $versionInformation[0];
}
if ($cnt > 1) {
$this->scriptFileName = pathinfo(trim($versionInformation[1]), PATHINFO_FILENAME);
$this->code = $this->loadScriptFile();
}
}
$this->originalScriptFileName = $this->scriptFileName;
}