From 952c7892f3ac7bfadf8419062e44ff1af66ecc57 Mon Sep 17 00:00:00 2001 From: Bot Date: Mon, 25 Dec 2017 23:12:52 +0100 Subject: Formatting & Docstrings --- includes/sys_template.php | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'includes/sys_template.php') diff --git a/includes/sys_template.php b/includes/sys_template.php index 48ec7e8c..a988ca7c 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -3,15 +3,16 @@ /** * Render a stat for dashborad (big number with label). * If no style given, style is danger if number > 0, and success if number == 0. - * + * * @param string $label * @param string $number * @param string $style default, warning, danger or success. Optional. + * @return string */ function stats($label, $number, $style = null) { - if(empty($style)) { - if($number > 0) { + if (empty($style)) { + if ($number > 0) { $style = 'danger'; } else { $style = 'success'; @@ -27,24 +28,26 @@ function stats($label, $number, $style = null) /** * Renders tabs from the array. Array key is tab name, array value is tab content. - * + * * @param array $tabs - * @param int $selected The selected tab, default 0 + * @param int $selected The selected tab, default 0 * @return string HTML */ function tabs($tabs, $selected = 0) { $tab_header = []; $tab_content = []; - foreach($tabs as $header => $content) { + foreach ($tabs as $header => $content) { $class = ''; - if(count($tab_header) == $selected) { + if (count($tab_header) == $selected) { $class = 'active'; } $tab_header[] = ''; - $tab_content[] = '
' . $content . '
'; + ' + . $header . ''; + $tab_content[] = '
' + . $content + . '
'; } return div('', [ '', @@ -114,7 +117,9 @@ function glyph($glyph_name) */ function glyph_bool($boolean) { - return '' . glyph($boolean ? 'ok' : 'remove') . ''; + return '' + . glyph($boolean ? 'ok' : 'remove') + . ''; } /** @@ -265,12 +270,15 @@ function page_with_title($title, $elements) /** * Renders a description based on the data arrays key and values as label an description. + * * @param array $data + * @return string */ -function description($data) { +function description($data) +{ $elements = []; - foreach($data as $label => $description) { - if(!empty($label) && !empty($description)) { + foreach ($data as $label => $description) { + if (!empty($label) && !empty($description)) { $elements[] = '
' . $label . '
' . $description . '
'; } } -- cgit v1.2.3-54-g00ecf