Page MenuHomeWickedGov Phorge

SuppressNotificationByTypeMiddleware.php
No OneTemporary

Size
756 B
Referenced Files
None
Subscribers
None

SuppressNotificationByTypeMiddleware.php

<?php
namespace MediaWiki\Notification\Middleware;
use MediaWiki\Notification\NotificationEnvelope;
/**
* An example Middleware that allows to remove notifications of specific types
*
* @since 1.44
* @unstable
*/
class SuppressNotificationByTypeMiddleware extends FilterMiddleware {
private string $notificationToSuppress;
/**
* Suppress sending specific notification
*/
public function __construct( string $notificationTypeToSuppress ) {
$this->notificationToSuppress = $notificationTypeToSuppress;
}
/**
* Decide whether we want to remove notification from the list
*/
protected function filter( NotificationEnvelope $envelope ): bool {
return $envelope->getNotification()->getType() !== $this->notificationToSuppress;
}
}

File Metadata

Mime Type
text/x-php
Expires
Tue, Aug 18, 14:58 (3 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
57/32/54690a6859d052dd1ea7c076fcf5
Default Alt Text
SuppressNotificationByTypeMiddleware.php (756 B)

Event Timeline