chore(*.php): use pint for php formatting
This commit is contained in:
parent
bd1855a65e
commit
753f3433ce
40 changed files with 2261 additions and 1900 deletions
|
@ -4,23 +4,27 @@ namespace App\Classes;
|
|||
|
||||
class MusicDataHandler extends BaseHandler
|
||||
{
|
||||
protected int $cacheTTL = 300;
|
||||
protected int $cacheTTL = 300;
|
||||
|
||||
public function getThisWeekData(): array
|
||||
{
|
||||
$cacheKey = 'music_week_data';
|
||||
$cached = $this->cache ? $this->cache->get($cacheKey) : null;
|
||||
public function getThisWeekData(): array
|
||||
{
|
||||
$cacheKey = 'music_week_data';
|
||||
$cached = $this->cache ? $this->cache->get($cacheKey) : null;
|
||||
|
||||
if ($cached) return json_decode($cached, true);
|
||||
if ($cached) {
|
||||
return json_decode($cached, true);
|
||||
}
|
||||
|
||||
$response = $this->makeRequest('GET', 'optimized_week_music?select=*');
|
||||
$music = $response[0]['week_music'] ?? [];
|
||||
$music['total_tracks'] = $music['week_summary']['total_tracks'] ?? 0;
|
||||
$music['total_artists'] = $music['week_summary']['total_artists'] ?? 0;
|
||||
$music['total_albums'] = $music['week_summary']['total_albums'] ?? 0;
|
||||
$response = $this->makeRequest('GET', 'optimized_week_music?select=*');
|
||||
$music = $response[0]['week_music'] ?? [];
|
||||
$music['total_tracks'] = $music['week_summary']['total_tracks'] ?? 0;
|
||||
$music['total_artists'] = $music['week_summary']['total_artists'] ?? 0;
|
||||
$music['total_albums'] = $music['week_summary']['total_albums'] ?? 0;
|
||||
|
||||
if ($this->cache) $this->cache->set($cacheKey, json_encode($music), $this->cacheTTL);
|
||||
if ($this->cache) {
|
||||
$this->cache->set($cacheKey, json_encode($music), $this->cacheTTL);
|
||||
}
|
||||
|
||||
return $music;
|
||||
}
|
||||
return $music;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue