chore(*.php): use pint for php formatting

This commit is contained in:
Cory Dransfeldt 2025-06-14 16:55:03 -07:00
parent 029caaaa9e
commit cf1ee4c97f
No known key found for this signature in database
40 changed files with 2261 additions and 1900 deletions

View file

@ -4,33 +4,37 @@ namespace App\Classes;
class RecentMediaHandler extends BaseHandler
{
protected int $cacheTTL = 300;
protected int $cacheTTL = 300;
public function getRecentMedia(): array
{
try {
$cacheKey = 'recent_media';
public function getRecentMedia(): array
{
try {
$cacheKey = 'recent_media';
if ($this->cache) {
$cached = $this->cache->get($cacheKey);
if ($this->cache) {
$cached = $this->cache->get($cacheKey);
if ($cached) return json_decode($cached, true);
}
if ($cached) {
return json_decode($cached, true);
}
}
$response = $this->makeRequest("GET", "optimized_recent_media?select=*");
$activity = $response[0]['recent_activity'] ?? [];
$data = [
'recentMusic' => $activity['recentMusic'] ?? [],
'recentWatchedRead' => $activity['recentWatchedRead'] ?? [],
];
$response = $this->makeRequest('GET', 'optimized_recent_media?select=*');
$activity = $response[0]['recent_activity'] ?? [];
$data = [
'recentMusic' => $activity['recentMusic'] ?? [],
'recentWatchedRead' => $activity['recentWatchedRead'] ?? [],
];
if ($this->cache) $this->cache->set($cacheKey, json_encode($data), $this->cacheTTL);
if ($this->cache) {
$this->cache->set($cacheKey, json_encode($data), $this->cacheTTL);
}
return $data;
} catch (\Exception $e) {
error_log("RecentMediaHandler error: " . $e->getMessage());
return $data;
} catch (\Exception $e) {
error_log('RecentMediaHandler error: '.$e->getMessage());
return ['recentMusic' => [], 'recentWatchedRead' => []];
return ['recentMusic' => [], 'recentWatchedRead' => []];
}
}
}
}