public function removeNotification(OW_Event $event) { $params = $event->getParams(); if (empty($params['entityType']) || empty($params['entityId'])) { throw new InvalidArgumentException('`entityType` and `entityId` params are required'); } $userId = empty($params['userId']) ? null : $params['userId']; $entityType = $params['entityType']; $entityId = $params['entityId']; if ($userId !== null) { $this->service->deleteNotification($entityType, $entityId, $userId); } else { $this->service->deleteNotificationByEntity($entityType, $entityId); } }