src/Modules/Notification.php
private static function is_notification_expired( $notification ) {
		if ( ! isset( $notification['display_at'] ) ) {
			return true;
		}

		$notifications = array_filter(
			self::$notifications,
			function ( $value ) use ( $notification ) {
				if ( isset( $value['id'] ) && isset( $notification['id'] ) && $value['id'] === $notification['id'] ) {
					return true;
				}

				return false;
			}
		);

		if ( empty( $notifications ) ) {
			return true;
		}
		$notification_definition = reset( $notifications );

		$when_to_expire = isset( $notification_definition['expires_at'] )
			? $notification_definition['expires_at'] :
			( isset( $notification_definition['expires'] )
				? ( $notification['display_at'] + $notification_definition['expires'] ) :
				( $notification['display_at'] + self::MAX_TIME_TO_LIVE * DAY_IN_SECONDS )
			);

		return ( $when_to_expire - time() ) < 0;
	}
private static function is_notification_expired( $notification ) {
		if ( ! isset( $notification['display_at'] ) ) {
			return true;
		}

		$notifications = array_filter(
			self::$notifications,
			function ( $value ) use ( $notification ) {
				if ( isset( $value['id'] ) && isset( $notification['id'] ) && $value['id'] === $notification['id'] ) {
					return true;
				}

				return false;
			}
		);

		if ( empty( $notifications ) ) {
			return true;
		}
		$notification_definition = reset( $notifications );

		$when_to_expire = isset( $notification_definition['expires_at'] )
			? $notification_definition['expires_at'] :
			( isset( $notification_definition['expires'] )
				? ( $notification['display_at'] + $notification_definition['expires'] ) :
				( $notification['display_at'] + self::MAX_TIME_TO_LIVE * DAY_IN_SECONDS )
			);

		return ( $when_to_expire - time() ) < 0;
	}
private static function is_notification_expired ( $ notification ) { if ( ! isset ( $ notification [ 'display_at' ] ) ) { return true ; } $ notifications = array_filter ( self :: $ notifications , function ( $ value ) use ( $ notification ) { if ( isset ( $ value [ 'id' ] ) && isset ( $ notification [ 'id' ] ) && $ value [ 'id' ] === $ notification [ 'id' ] ) { return true ; } return false ; } ) ; if ( empty ( $ notifications ) ) { return true ; } $ notification_definition = reset ( $ notifications ) ; $ when_to_expire = isset ( $ notification_definition [ 'expires_at' ] ) ? $ notification_definition [ 'expires_at' ] : ( isset ( $ notification_definition [ 'expires' ] ) ? ( $ notification [ 'display_at' ] + $ notification_definition [ 'expires' ] ) : ( $ notification [ 'display_at' ] + self :: MAX_TIME_TO_LIVE * DAY_IN_SECONDS ) ) ; return ( $ when_to_expire - time ( ) ) < 0 ; }
Check if the notification is expired.

@param array $notification Notification to check.

@return bool Either the notification is due.
Check if the notification is expired .