private function getSerializer() { if (null === $this->serializer) { throw new \RuntimeException(sprintf('An instance of "%s" must be available. Call the "setSerializer" method.', SerializerInterface::class)); } return $this->serializer; }