Changed defaultSubscriptionData to static
This commit is contained in:
parent
3de2c6e2fb
commit
4886afd8d6
|
@ -58,7 +58,7 @@ class PersonalSettingsController extends Controller {
|
||||||
$subStats = array();
|
$subStats = array();
|
||||||
foreach ($episodeActions as $ep) {
|
foreach ($episodeActions as $ep) {
|
||||||
$url = $ep->getPodcast();
|
$url = $ep->getPodcast();
|
||||||
$stats = $subStats[$url] ?? $this->defaultSubscriptionData();
|
$stats = $subStats[$url] ?? self::defaultSubscriptionData();
|
||||||
$actionCounts = $stats['actionCounts'];
|
$actionCounts = $stats['actionCounts'];
|
||||||
$actionLower = strtolower($ep->getAction());
|
$actionLower = strtolower($ep->getAction());
|
||||||
if (array_key_exists($actionLower, $actionCounts)) {
|
if (array_key_exists($actionLower, $actionCounts)) {
|
||||||
|
@ -76,7 +76,7 @@ class PersonalSettingsController extends Controller {
|
||||||
|
|
||||||
$subscriptions = array_map(function (SubscriptionChangeEntity $sub) use ($subStats) {
|
$subscriptions = array_map(function (SubscriptionChangeEntity $sub) use ($subStats) {
|
||||||
$url = $sub->getUrl();
|
$url = $sub->getUrl();
|
||||||
$stats = $subStats[$url] ?? $this->defaultSubscriptionData();
|
$stats = $subStats[$url] ?? self::defaultSubscriptionData();
|
||||||
$sub = [
|
$sub = [
|
||||||
'url' => $url ?? '',
|
'url' => $url ?? '',
|
||||||
'listenedSeconds' => $stats['listenedSeconds'],
|
'listenedSeconds' => $stats['listenedSeconds'],
|
||||||
|
@ -100,7 +100,7 @@ class PersonalSettingsController extends Controller {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function defaultSubscriptionData(): array {
|
private static function defaultSubscriptionData(): array {
|
||||||
return [
|
return [
|
||||||
'listenedSeconds' => 0,
|
'listenedSeconds' => 0,
|
||||||
'actionCounts' => [
|
'actionCounts' => [
|
||||||
|
|
Loading…
Reference in New Issue