public function compose(string $format, array $compose = [], string $method = 'compose')
    {
        if (! \in_array($format, $this->formats)) {
            return $this->composeError(null, [], 406);
        } elseif (! \method_exists($this, $method.\ucwords($format))) {
            throw new RuntimeException('Call to undefine method ['.$method.\ucwords($format).'].');
        }

        $config = $compose['on'][$format] ?? [];

        $config['view'] = $compose['view'];

        return $this->{$method.\ucwords($format)}(
            $this->prepareDataValue($config, $compose['data']),
            $compose['status'],
            $config
        );
    }
public function compose(string $format, array $compose = [], string $method = 'compose')
    {
        if (! \in_array($format, $this->formats)) {
            return $this->composeError(null, [], 406);
        } elseif (! \method_exists($this, $method.\ucwords($format))) {
            throw new RuntimeException('Call to undefine method ['.$method.\ucwords($format).'].');
        }

        $config = $compose['on'][$format] ?? [];

        $config['view'] = $compose['view'];

        return $this->{$method.\ucwords($format)}(
            $this->prepareDataValue($config, $compose['data']),
            $compose['status'],
            $config
        );
    }
public function compose ( string $ format , array $ compose = [ ] , string $ method = 'compose' ) { if ( ! \ in_array ( $ format , $ this -> formats ) ) { return $ this -> composeError ( null , [ ] , 406 ) ; } elseif ( ! \ method_exists ( $ this , $ method . \ ucwords ( $ format ) ) ) { throw new RuntimeException ( 'Call to undefine method [' . $ method . \ ucwords ( $ format ) . '].' ) ; } $ config = $ compose [ 'on' ] [ $ format ] ?? [ ] ; $ config [ 'view' ] = $ compose [ 'view' ] ; return $ this -> { $ method . \ ucwords ( $ format ) } ( $ this -> prepareDataValue ( $ config , $ compose [ 'data' ] ) , $ compose [ 'status' ] , $ config ) ; }
Compose requested format.

@param  string  $format
@param  array  $compose
@param  string  $method

@throws \RuntimeException

@return mixed
Compose requested format .