Page MenuHomeWickedGov Phorge

FilterMiddleware.php
No OneTemporary

Size
1001 B
Referenced Files
None
Subscribers
None

FilterMiddleware.php

<?php
namespace MediaWiki\Notification\Middleware;
use MediaWiki\Notification\NotificationEnvelope;
use MediaWiki\Notification\NotificationMiddlewareInterface;
use MediaWiki\Notification\NotificationsBatch;
/**
* Middleware that allows to filter notifications
*
* @stable to extend
* @since 1.45
*/
abstract class FilterMiddleware implements NotificationMiddlewareInterface {
/**
* Decide whether we want to remove notification from the list
*
* Return FilterMiddlewareAction::KEEP to keep the envelope
* Return FilterMiddlewareAction::REMOVE to remove the envelope
*/
abstract protected function filter( NotificationEnvelope $envelope ): FilterMiddlewareAction;
/**
* @param NotificationsBatch $batch
* @param callable():void $next
*/
public function handle( NotificationsBatch $batch, callable $next ): void {
$next();
$batch->filter( function ( NotificationEnvelope $envelope ) {
return $this->filter( $envelope ) === FilterMiddlewareAction::KEEP;
} );
}
}

File Metadata

Mime Type
text/x-php
Expires
Aug 19 2026, 16:53 (4 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d1/e3/2e3dc3c7082b08baf2e1d6c7a403
Default Alt Text
FilterMiddleware.php (1001 B)

Event Timeline