Adapt class structure

- Introduce constants
- Add constructor parameters
- Add typehints
- Renamed fields more meaningful
- Renamed method names to match identifier
- Adjust PHP doc
- Add GetClass call at used places
This commit is contained in:
Philipp Holzer 2019-10-26 04:03:27 +02:00
parent 1f368d469f
commit a72e65a760
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
4 changed files with 368 additions and 312 deletions

View file

@ -84,7 +84,8 @@ function notifications_content(App $a)
$json = (($a->argc > 1 && $a->argv[$a->argc - 1] === 'json') ? true : false);
$nm = new Notify();
/** @var Notify $nm */
$nm = \Friendica\BaseObject::getClass(Notify::class);
$o = '';
// Get the nav tabs for the notification pages
@ -111,27 +112,27 @@ function notifications_content(App $a)
$all = (($a->argc > 2) && ($a->argv[2] == 'all'));
$notifs = $nm->introNotifs($all, $startrec, $perpage, $id);
$notifs = $nm->getIntroNotifies($all, $startrec, $perpage, $id);
// Get the network notifications
} elseif (($a->argc > 1) && ($a->argv[1] == 'network')) {
$notif_header = L10n::t('Network Notifications');
$notifs = $nm->networkNotifs($show, $startrec, $perpage);
$notifs = $nm->getNetworkNotifies($show, $startrec, $perpage);
// Get the system notifications
} elseif (($a->argc > 1) && ($a->argv[1] == 'system')) {
$notif_header = L10n::t('System Notifications');
$notifs = $nm->systemNotifs($show, $startrec, $perpage);
$notifs = $nm->getSystemNotifies($show, $startrec, $perpage);
// Get the personal notifications
} elseif (($a->argc > 1) && ($a->argv[1] == 'personal')) {
$notif_header = L10n::t('Personal Notifications');
$notifs = $nm->personalNotifs($show, $startrec, $perpage);
$notifs = $nm->getPersonalNotifies($show, $startrec, $perpage);
// Get the home notifications
} elseif (($a->argc > 1) && ($a->argv[1] == 'home')) {
$notif_header = L10n::t('Home Notifications');
$notifs = $nm->homeNotifs($show, $startrec, $perpage);
$notifs = $nm->getHomeNotifies($show, $startrec, $perpage);
// fallback - redirect to main page
} else {
$a->internalRedirect('notifications');