private function getRequest() { $request = $this->requestStack->getCurrentRequest(); if (is_null($request)) { throw new \InvalidArgumentException("Can not parse a request that is null"); } return $request; }