activityManager = $manager; } public function parse($language, IEvent $event, IEvent $previousEvent = null) { if ($event->getApp() !== Application::ID) { throw new \InvalidArgumentException(); } $subject = $event->getSubject(); $params = $event->getSubjectParameters(); if ($subject === self::ROOM_CREATED) { $event->setParsedSubject('You created the room ' . $params['name']); } elseif ($subject === self::ROOM_DELETED) { if ($this->activityManager->getCurrentUserId() === $event->getAffectedUser()) { $event->setParsedSubject('You deleted the room ' . $params['name']); } else { $event->setParsedSubject($event->getAffectedUser() . ' deleted the room ' . $params['name']); } } return $event; } }