From 6c65601cc4781a4fac00f4ae2a7a8def24c28e72 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Wed, 31 May 2023 21:36:23 -0500 Subject: formatting --- index.php | 187 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 94 insertions(+), 93 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index a61df1e..28a2cfe 100644 --- a/index.php +++ b/index.php @@ -1,115 +1,116 @@ - * @param string $api_url The API endpoint to use for extraction - * @param string $inline_title The

title to use in the HTML - * @return string $html_output The formatted HTML result of stories from the API - */ +* Extract a set of stories from Hacker News API and format in HTML +* +* @access public +* @author cmc +* @param string $api_url The API endpoint to use for extraction +* @param string $inline_title The

title to use in the HTML +* @return string $html_output The formatted HTML result of stories from the API +*/ function get_stories($api_url, $inline_title) { - $response_raw = file_get_contents($api_url); + $response_raw = file_get_contents($api_url); $response = json_decode($response_raw, true); $html_output = '

' . $inline_title . '

'; @@ -130,23 +131,23 @@ function get_stories($api_url, $inline_title) { } /** - * Send formatted HTML results to the user via a template - * - * @access public - * @author cmc - * @param string $page_url Canoncial URL for HTML header - * @param string $page_description Page description for HTML header - * @param string $page_title Page title for HTML header - * @param string $page_content Page content to display in
- */ +* Send formatted HTML results to the user via a template +* +* @access public +* @author cmc +* @param string $page_url Canoncial URL for HTML header +* @param string $page_description Page description for HTML header +* @param string $page_title Page title for HTML header +* @param string $page_content Page content to display in
+*/ function echo_html(string $page_url, string $page_description, string $page_title, string $page_content) { include_once 'src/View/class-template.php'; $template = new HN\View\Template( - $page_url, - $page_description, - $page_title, - $page_content + $page_url, + $page_description, + $page_title, + $page_content ); $template->echo_template(); -- cgit v1.2.3-70-g09d2