Source of file ModuleHealthLoader.php
Size: 1,164 Bytes - Last Modified: 2021-12-24T06:48:16+00:00
/var/www/docs.ssmods.com/process/src/src/Util/ModuleHealthLoader.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | <?php namespace BringYourOwnIdeas\Maintenance\Util; /** * Handles fetching module health information from addons.silverstripe.org */ class ModuleHealthLoader extends ApiLoader { /** * @var string[] */ protected $moduleNames = []; /** * Return the list of supported addons as provided by addons.silverstripe.org * * @return array */ public function getModuleHealthInfo() { $addons = $this->getModuleNames(); $endpoint = 'addons.silverstripe.org/api/ratings?addons=' . implode(',', $addons); return $this->doRequest($endpoint, function ($responseBody) { return isset($responseBody) ? $responseBody['ratings'] : []; }); } /** * @return string[] */ public function getModuleNames() { return $this->moduleNames; } /** * @param string[] $moduleNames * @return $this */ public function setModuleNames(array $moduleNames) { $this->moduleNames = $moduleNames; return $this; } protected function getCacheKey() { return sha1(json_encode($this->getModuleNames())); } } |