src/RestPHP/Response/ResponseFactory.php
public function build($type, $data, $hypertextRoutes = [])
    {
        if (!isset($this->types[$type])) {
            throw new \Exception("Unknown response type.");
        }
        return new $this->types[$type]($data, $hypertextRoutes);
    }
public function build($type, $data, $hypertextRoutes = [])
    {
        if (!isset($this->types[$type])) {
            throw new \Exception("Unknown response type.");
        }
        return new $this->types[$type]($data, $hypertextRoutes);
    }
public function build ( $ type , $ data , $ hypertextRoutes = [ ] ) { if ( ! isset ( $ this -> types [ $ type ] ) ) { throw new \ Exception ( "Unknown response type." ) ; } return new $ this -> types [ $ type ] ( $ data , $ hypertextRoutes ) ; }
Builds the response object.

@param string $type The type of response to build.
@param mixed $data The response data.
@param optional array $hypertextRoutes An array of hypertext routes.

@throws Exception Throws an exception for unknown response types.

@return \RestPHP\Response The created object.
Builds the response object .