private function transformToHtml($data, $hypertextRoutes = [])
    {
        // Generate the html for the hypertext routes
        $hypertextHtml = $this->getHypertextHtml($hypertextRoutes);

        // Check if the data is not an array
        if (!is_array($data)) {
            return "<p>{$data}</p>\n{$hypertextHtml}";
        }

        // Generate the html table
        $html = "<table style=\"border: 1px solid black;\">";
        foreach ($data as $k => $v) {
            if (is_array($v)) {
                // Recursively transform underlying data
                $html .= "<tr><td style=\"border: 1px solid black; font-weight: bold;\">{$k}:</td><td style=\"border: 1px solid black;\">{$this->transformToHtml($v)}</td></tr>";
            } else {
                $html .= "<tr><td style=\"border: 1px solid black; font-weight: bold;\">{$k}:</td><td style=\"border: 1px solid black;\">{$v}</td></tr>";
            }
        }

        // Add the hypertext html
        $html .= "<tr><td style=\"border: 1px solid black; font-weight: bold;\">Hypertext:</td><td style=\"border: 1px solid black;\">{$hypertextHtml}</td></tr>";
        $html .= "</table>";
        return $html;
    }
private function transformToHtml($data, $hypertextRoutes = [])
    {
        // Generate the html for the hypertext routes
        $hypertextHtml = $this->getHypertextHtml($hypertextRoutes);

        // Check if the data is not an array
        if (!is_array($data)) {
            return "<p>{$data}</p>\n{$hypertextHtml}";
        }

        // Generate the html table
        $html = "<table style=\"border: 1px solid black;\">";
        foreach ($data as $k => $v) {
            if (is_array($v)) {
                // Recursively transform underlying data
                $html .= "<tr><td style=\"border: 1px solid black; font-weight: bold;\">{$k}:</td><td style=\"border: 1px solid black;\">{$this->transformToHtml($v)}</td></tr>";
            } else {
                $html .= "<tr><td style=\"border: 1px solid black; font-weight: bold;\">{$k}:</td><td style=\"border: 1px solid black;\">{$v}</td></tr>";
            }
        }

        // Add the hypertext html
        $html .= "<tr><td style=\"border: 1px solid black; font-weight: bold;\">Hypertext:</td><td style=\"border: 1px solid black;\">{$hypertextHtml}</td></tr>";
        $html .= "</table>";
        return $html;
    }
private function transformToHtml ( $ data , $ hypertextRoutes = [ ] ) { // Generate the html for the hypertext routes $ hypertextHtml = $ this -> getHypertextHtml ( $ hypertextRoutes ) ; // Check if the data is not an array if ( ! is_array ( $ data ) ) { return "<p>{$data}</p>\n{$hypertextHtml}" ; } // Generate the html table $ html = "<table style=\"border: 1px solid black;\">" ; foreach ( $ data as $ k => $ v ) { if ( is_array ( $ v ) ) { // Recursively transform underlying data $ html .= "<tr><td style=\"border: 1px solid black; font-weight: bold;\">{$k}:</td><td style=\"border: 1px solid black;\">{$this->transformToHtml($v)}</td></tr>" ; } else { $ html .= "<tr><td style=\"border: 1px solid black; font-weight: bold;\">{$k}:</td><td style=\"border: 1px solid black;\">{$v}</td></tr>" ; } } // Add the hypertext html $ html .= "<tr><td style=\"border: 1px solid black; font-weight: bold;\">Hypertext:</td><td style=\"border: 1px solid black;\">{$hypertextHtml}</td></tr>" ; $ html .= "</table>" ; return $ html ; }
Recursively converts the response into an html string.
This is an html string with tables and underlying tables.

@param mixed $data The data to transform.
@param optional array $hypertextRoutes An array with hypertext routes.

@return string The response as an html string.
Recursively converts the response into an html string . This is an html string with tables and underlying tables .