46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Notification\Users;
|
||
|
|
||
|
use Notification;
|
||
|
|
||
|
require_once 'Notification.php';
|
||
|
|
||
|
class PostReportNotification extends \Notification
|
||
|
{
|
||
|
public function __construct(array $data)
|
||
|
{
|
||
|
$data['type'] = 'users.reportedPost';
|
||
|
parent::__construct($data);
|
||
|
}
|
||
|
|
||
|
public function getNotificationLink()
|
||
|
{
|
||
|
return '/user/' . $this->recipient->getUsername() . '/post/' . $this->parameters;
|
||
|
}
|
||
|
|
||
|
public function getNotificationImage()
|
||
|
{
|
||
|
return $this->recipient->getProfilePicture();
|
||
|
}
|
||
|
|
||
|
public function messageForNotification(Notification $notification)
|
||
|
{
|
||
|
return ['line' => 'users.reportedPost.single', 'attributes' => [$this->recipient->getName()]];
|
||
|
}
|
||
|
|
||
|
public function messageForNotifications(array $notifications, $realCount = 0)
|
||
|
{
|
||
|
if ($realCount === 0) {
|
||
|
$realCount = count($notifications);
|
||
|
}
|
||
|
|
||
|
if ($realCount < 5) {
|
||
|
$names = $this->manyNames($notifications);
|
||
|
return ['line' => 'users.reportedPost.multiple', 'attributes' => [$names]];
|
||
|
} else {
|
||
|
$names = $this->manyNamesCutoff($notifications, $realCount);
|
||
|
return ['line' => 'users.reportedPost.many', 'attributes' => [$names]];
|
||
|
}
|
||
|
}
|
||
|
}
|