src/Charcoal/Admin/Action/Filesystem/LoadAction.php
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);
        }
    }
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);
        }
    }
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 ) ; } }
Asserts that the response disposition is valid, throws an exception if not.

@param  mixed $disposition A response disposition.
@throws InvalidArgumentException If the disposition is not a string or NULL.
@return void
Asserts that the response disposition is valid throws an exception if not .