protected function assertValidDisposition($disposition)
    {
        $translator = $this->translator();

        if (!in_array($disposition, [ self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE ])) {
            throw new InvalidArgumentException(sprintf(
                'The disposition must be either "%s" or "%s".',
                self::DISPOSITION_ATTACHMENT,
                self::DISPOSITION_INLINE
            ));
        }

        if (!is_string($disposition) && $disposition !== null) {
            $actualType = is_object($disposition) ? get_class($disposition) : gettype($disposition);
            $message = $translator->translate(
                '{{ parameter }} must be a {{ expectedType }}, received {{ actualType }}',
                [
                    '{{ parameter }}'    => '"disposition"',
                    '{{ expectedType }}' => 'string',
                    '{{ actualType }}'   => $actualType,
                ]
            );

            throw new InvalidArgumentException($message, 400);
        }
    }