diff --git a/src/Response.php b/src/Response.php index 2926039..04945fe 100644 --- a/src/Response.php +++ b/src/Response.php @@ -108,6 +108,24 @@ protected function getCurrentTimeStamp() : string { return (new \DateTime())->format('D, j F y H:m:s O'); } + /** + * Convenience functions to get specific file provider or standard client update information + */ + private function getSparkleUpdateUrl(array $updateVersion) : string { + $updateUrlKey = $this->isFileProvider ? 'fileProviderSparkleDownloadUrl' : 'sparkleDownloadUrl'; + return $updateVersion[$updateUrlKey]; + } + + private function getSparkleUpdateSignature(array $updateVersion) : string { + $updateSignatureKey = $this->isFileProvider ? 'fileProviderSignature' : 'signature'; + return $updateVersion[$updateSignatureKey]; + } + + private function getSparkleUpdateLength(array $updateVersion) : string { + $updateLengthKey = $this->isFileProvider ? 'fileProviderLength' : 'length'; + return $updateVersion[$updateLengthKey]; + } + /** * Builds the response for Sparkle (used by the Mac updater) * @@ -115,20 +133,24 @@ protected function getCurrentTimeStamp() : string { * @return string */ private function buildSparkleResponse(array $updateVersion) : string { + $sparkleUrl = $this->getSparkleUpdateUrl($updateVersion); + $sparkleSignature = $this->getSparkleUpdateSignature($updateVersion); + $sparkleLength = $this->getSparkleUpdateLength($updateVersion); + $item = !empty($updateVersion) ? ' - '.$updateVersion['versionstring'].' - '.$this->getCurrentTimeStamp().' - - 11.0 - ' : ''; - $xml = ' - - - Download Channel - Most recent changes with links to updates. - en'.$item.' + '.$updateVersion['versionstring'].' + '.$this->getCurrentTimeStamp().' + + 11.0 + ' : ''; + + return ' + + + Download Channel + Most recent changes with links to updates. + en'.$item.' '; - return $xml; } /**