1
0
Fork 0

Rename classes

- Repository/Model Notification => Notify
- Factory/Object Notification => Notification
This commit is contained in:
Philipp Holzer 2020-01-26 20:30:24 +01:00
commit 0840938dff
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
12 changed files with 45 additions and 45 deletions

View file

@ -5,10 +5,10 @@ namespace Friendica\Collection;
use Friendica\BaseCollection;
use Friendica\Model;
class Notifications extends BaseCollection
class Notifies extends BaseCollection
{
/**
* @return Model\Notification
* @return Model\Notify
*/
public function current()
{

View file

@ -245,19 +245,19 @@ abstract class DI
}
/**
* @return \Friendica\Factory\Notification\NotificationFactory
* @return \Friendica\Factory\Notification\Notification
*/
public static function factNotification()
public static function notification()
{
return self::$dice->create(Factory\Notification\NotificationFactory::class);
return self::$dice->create(Factory\Notification\Notification::class);
}
/**
* @return \Friendica\Factory\Notification\IntroductionFactory
* @return \Friendica\Factory\Notification\Introduction
*/
public static function factNotIntro()
public static function notificationIntro()
{
return self::$dice->create(Factory\Notification\IntroductionFactory::class);
return self::$dice->create(Factory\Notification\Introduction::class);
}
//
@ -273,11 +273,11 @@ abstract class DI
}
/**
* @return Repository\Notification
* @return Repository\Notify
*/
public static function notification()
public static function notify()
{
return self::$dice->create(Repository\Notification::class);
return self::$dice->create(Repository\Notify::class);
}
/**

View file

@ -15,7 +15,7 @@ use Friendica\Database\Database;
use Friendica\Model\Contact;
use Friendica\Module\BaseNotifications;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Object\Notification\Introduction;
use Friendica\Object;
use Friendica\Util\Proxy;
use Psr\Log\LoggerInterface;
@ -25,7 +25,7 @@ use Psr\Log\LoggerInterface;
* - Friend suggestion
* - Friend/Follower request
*/
class IntroductionFactory extends BaseFactory
class Introduction extends BaseFactory
{
/** @var Database */
private $dba;
@ -61,7 +61,7 @@ class IntroductionFactory extends BaseFactory
* @param int $limit Maximum number of query results
* @param int $id When set, only the introduction with this id is displayed
*
* @return Introduction[]
* @return Object\Notification\Introduction[]
*/
public function getList(bool $all = false, int $start = 0, int $limit = BaseNotifications::DEFAULT_PAGE_LIMIT, int $id = 0)
{

View file

@ -16,7 +16,7 @@ use Friendica\Model\Item;
use Friendica\Module\BaseNotifications;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Protocol\Activity;
use Friendica\Repository\Notification;
use Friendica\Repository;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy;
use Friendica\Util\Temporal;
@ -31,11 +31,11 @@ use Psr\Log\LoggerInterface;
* - home
* - personal
*/
class NotificationFactory extends BaseFactory
class Notification extends BaseFactory
{
/** @var Database */
private $dba;
/** @var Notification */
/** @var Repository\Notify */
private $notification;
/** @var BaseURL */
private $baseUrl;
@ -44,7 +44,7 @@ class NotificationFactory extends BaseFactory
/** @var string */
private $nurl;
public function __construct(LoggerInterface $logger, Database $dba, Notification $notification, BaseURL $baseUrl, L10n $l10n, App $app, IPConfig $pConfig, ISession $session)
public function __construct(LoggerInterface $logger, Database $dba, Repository\Notify $notification, BaseURL $baseUrl, L10n $l10n, App $app, IPConfig $pConfig, ISession $session)
{
parent::__construct($logger);

View file

@ -42,17 +42,17 @@ use Psr\Log\LoggerInterface;
* @property-read string $msg_html
* @property-read string $msg_plain
*/
class Notification extends BaseModel
class Notify extends BaseModel
{
const OTYPE_ITEM = 'item';
const OTYPE_INTRO = 'intro';
const OTYPE_MAIL = 'mail';
const OTYPE_PERSON = 'person';
/** @var \Friendica\Repository\Notification */
/** @var \Friendica\Repository\Notify */
private $repo;
public function __construct(Database $dba, LoggerInterface $logger, \Friendica\Repository\Notification $repo, array $data = [])
public function __construct(Database $dba, LoggerInterface $logger, \Friendica\Repository\Notify $repo, array $data = [])
{
parent::__construct($dba, $logger, $data);

View file

@ -26,7 +26,7 @@ class Introductions extends BaseNotifications
$notifications = [
'ident' => 'introductions',
'notifications' => DI::factNotIntro()->getList($all, self::$firstItemNum, self::ITEMS_PER_PAGE, $id),
'notifications' => DI::notificationIntro()->getList($all, self::$firstItemNum, self::ITEMS_PER_PAGE, $id),
];
return [

View file

@ -24,7 +24,7 @@ class Notification extends BaseModule
// @TODO: Replace with parameter from router
if (DI::args()->get(1) === 'mark' && DI::args()->get(2) === 'all') {
try {
$success = DI::notification()->setAllSeen();
$success = DI::notify()->setAllSeen();
}catch (\Exception $e) {
$success = false;
}
@ -48,7 +48,7 @@ class Notification extends BaseModule
// @TODO: Replace with parameter from router
if (DI::args()->getArgc() > 2 && DI::args()->get(1) === 'view' && intval(DI::args()->get(2))) {
try {
$notification = DI::notification()->getByID(DI::args()->get(2));
$notification = DI::notify()->getByID(DI::args()->get(2));
$notification->setSeen();
if (!empty($notification->link)) {

View file

@ -31,7 +31,7 @@ class Notifications extends BaseNotifications
$notificationHeader = DI::l10n()->t('Network Notifications');
$notifications = [
'ident' => Notification::NETWORK,
'notifications' => DI::factNotification()->getNetworkList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE),
'notifications' => DI::notification()->getNetworkList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE),
];
// Get the system notifications
@ -39,7 +39,7 @@ class Notifications extends BaseNotifications
$notificationHeader = DI::l10n()->t('System Notifications');
$notifications = [
'ident' => Notification::SYSTEM,
'notifications' => DI::factNotification()->getSystemList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE),
'notifications' => DI::notification()->getSystemList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE),
];
// Get the personal notifications
@ -47,7 +47,7 @@ class Notifications extends BaseNotifications
$notificationHeader = DI::l10n()->t('Personal Notifications');
$notifications = [
'ident' => Notification::PERSONAL,
'notifications' => DI::factNotification()->getPersonalList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE),
'notifications' => DI::notification()->getPersonalList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE),
];
// Get the home notifications
@ -55,7 +55,7 @@ class Notifications extends BaseNotifications
$notificationHeader = DI::l10n()->t('Home Notifications');
$notifications = [
'ident' => Notification::HOME,
'notifications' => DI::factNotification()->getHomeList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE),
'notifications' => DI::notification()->getHomeList(self::$showAll, self::$firstItemNum, self::ITEMS_PER_PAGE),
];
// fallback - redirect to main page
} else {

View file

@ -10,28 +10,28 @@ use Friendica\Collection;
use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Util\DateTimeFormat;
class Notification extends BaseRepository
class Notify extends BaseRepository
{
protected static $table_name = 'notify';
protected static $model_class = Model\Notification::class;
protected static $model_class = Model\Notify::class;
protected static $collection_class = Collection\Notifications::class;
protected static $collection_class = Collection\Notifies::class;
/**
* {@inheritDoc}
*
* @return Model\Notification
* @return Model\Notify
*/
protected function create(array $data)
{
return new Model\Notification($this->dba, $this->logger, $this, $data);
return new Model\Notify($this->dba, $this->logger, $this, $data);
}
/**
* {@inheritDoc}
*
* @return Collection\Notifications
* @return Collection\Notifies
*/
public function select(array $condition = [], array $params = [])
{
@ -45,7 +45,7 @@ class Notification extends BaseRepository
/**
* {@inheritDoc}
*
* @return Model\Notification
* @return Model\Notify
* @throws NotFoundException
*/
public function getByID(int $id)
@ -67,7 +67,7 @@ class Notification extends BaseRepository
/**
* @param array $fields
*
* @return Model\Notification
* @return Model\Notify
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws Exception