public function setOutput($output, string $mime = "text/html")
    {
        if (
            !is_string($output) && !is_callable($output) 
            && !(is_object($output) && method_exists($output, '__toString'))
        )
        {
            throw new \InvalidArgumentException(
                "Output must be text, string-castable object or valid callback"
            );
        }
        $this->addMimeType($mime);
        $this->output[$mime] = $output;
        return $this;
    }
public function setOutput($output, string $mime = "text/html")
    {
        if (
            !is_string($output) && !is_callable($output) 
            && !(is_object($output) && method_exists($output, '__toString'))
        )
        {
            throw new \InvalidArgumentException(
                "Output must be text, string-castable object or valid callback"
            );
        }
        $this->addMimeType($mime);
        $this->output[$mime] = $output;
        return $this;
    }
public function setOutput ( $ output , string $ mime = "text/html" ) { if ( ! is_string ( $ output ) && ! is_callable ( $ output ) && ! ( is_object ( $ output ) && method_exists ( $ output , '__toString' ) ) ) { throw new \ InvalidArgumentException ( "Output must be text, string-castable object or valid callback" ) ; } $ this -> addMimeType ( $ mime ) ; $ this -> output [ $ mime ] = $ output ; return $ this ; }
Set or replace the output for a content type
@param mixed $str The text to add. This can be a string, a callback
function returning a string or an object with a
__toString method.
@param string $mime The mime-type for the content
@return StringResponse Provides fluent interface
Set or replace the output for a content type