on('beforeMethod:PUT', [$this, 'beforePut']); } public function beforePut(RequestInterface $request, ResponseInterface $response): bool { // evaluate if card size exceeds defined limit $eventSizeLimit = $this->config->getValueInt(Application::APP_ID, 'event_size_limit', 10485760); if ((int)$request->getRawServerValue('CONTENT_LENGTH') > $eventSizeLimit) { throw new Forbidden("VEvent or VTodo object exceeds $eventSizeLimit bytes"); } // all tests passed return true return true; } }