cache = $cache; $this->url = $url ?: static::URL; } /** * Returns the latest credits. * * @return array|null */ public function latest() { $result = $this->cache->remember('credits', 2880, function () { try { return json_decode((new Client())->get($this->url, [ 'headers' => ['Accept' => 'application/json', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/'.constant('CACHET_VERSION') : 'cachet'], ])->getBody(), true); } catch (Exception $e) { return self::FAILED; } }); return $result === self::FAILED ? null : $result; } }