Changed defaultSubscriptionData to static

This commit is contained in:
Kalle Fagerberg 2022-07-17 20:38:55 +02:00 committed by thrillfall
parent 3de2c6e2fb
commit 4886afd8d6

View File

@ -58,7 +58,7 @@ class PersonalSettingsController extends Controller {
$subStats = array();
foreach ($episodeActions as $ep) {
$url = $ep->getPodcast();
$stats = $subStats[$url] ?? $this->defaultSubscriptionData();
$stats = $subStats[$url] ?? self::defaultSubscriptionData();
$actionCounts = $stats['actionCounts'];
$actionLower = strtolower($ep->getAction());
if (array_key_exists($actionLower, $actionCounts)) {
@ -76,7 +76,7 @@ class PersonalSettingsController extends Controller {
$subscriptions = array_map(function (SubscriptionChangeEntity $sub) use ($subStats) {
$url = $sub->getUrl();
$stats = $subStats[$url] ?? $this->defaultSubscriptionData();
$stats = $subStats[$url] ?? self::defaultSubscriptionData();
$sub = [
'url' => $url ?? '',
'listenedSeconds' => $stats['listenedSeconds'],
@ -100,7 +100,7 @@ class PersonalSettingsController extends Controller {
]);
}
private function defaultSubscriptionData(): array {
private static function defaultSubscriptionData(): array {
return [
'listenedSeconds' => 0,
'actionCounts' => [