Skip to content

Commit 3cd7113

Browse files
committed
Add detailed docblocks to helper functions
Add detailed docblocks to functions in `src/helpers.php`. * **wpkirk_toc**: Add detailed docblock describing the function's purpose, process, and return type. * **wpkirk_output**: Add detailed docblock describing the function's purpose, parameters, and return type. * **wpkirk_section**: Add detailed docblock describing the function's purpose, parameters, and return type. * **wpkirk_code**: Add detailed docblock describing the function's purpose, parameters, and return type. * **wpkirk_execute_code**: Add detailed docblock describing the function's purpose, parameters, and return type. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/wpbones/wpkirk-helpers?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 1f4a3af commit 3cd7113

File tree

2 files changed

+281
-5
lines changed

2 files changed

+281
-5
lines changed

composer.lock

Lines changed: 242 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/helpers.php

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
if (!function_exists('wpkirk_toc')) {
44

55
/**
6-
* Table of Contents
6+
* Generates a Table of Contents (TOC) based on the sections in the buffer.
7+
*
8+
* This function scans the output buffer for section headers and generates a TOC.
9+
* The TOC is then displayed at the beginning of the content.
10+
*
11+
* @return void
712
*/
813
function wpkirk_toc()
914
{
@@ -35,7 +40,14 @@ function wpkirk_toc()
3540
if (!function_exists('wpkirk_output')) {
3641

3742
/**
38-
* Output
43+
* Outputs the result of a function within a details HTML element.
44+
*
45+
* This function executes the provided function and displays its output
46+
* within a details HTML element. The output is formatted based on the specified language.
47+
*
48+
* @param callable|string $func The function to execute or the code to evaluate.
49+
* @param string $language The language for syntax highlighting (default: 'json').
50+
* @return void
3951
*/
4052
function wpkirk_output($func, $language = 'json')
4153
{
@@ -50,7 +62,14 @@ function wpkirk_output($func, $language = 'json')
5062
if (!function_exists('wpkirk_section')) {
5163

5264
/**
53-
* Section
65+
* Outputs a section header with the specified ID and content.
66+
*
67+
* This function generates an H2 header with the specified ID and content.
68+
* The content can be a string or a callable function.
69+
*
70+
* @param string $id The ID for the section header.
71+
* @param string|callable $strFunc The content for the section header.
72+
* @return void
5473
*/
5574
function wpkirk_section($id, $strFunc)
5675
{
@@ -68,7 +87,14 @@ function wpkirk_section($id, $strFunc)
6887
if (!function_exists('wpkirk_code')) {
6988

7089
/**
71-
* Code
90+
* Outputs code within a preformatted code block.
91+
*
92+
* This function displays the provided code within a preformatted code block
93+
* with syntax highlighting based on the specified language.
94+
*
95+
* @param string $language The language for syntax highlighting (default: 'php').
96+
* @param string $func The code to display.
97+
* @return void
7298
*/
7399
function wpkirk_code($language = 'php', $func = '')
74100
{
@@ -81,7 +107,15 @@ function wpkirk_code($language = 'php', $func = '')
81107
if (!function_exists('wpkirk_execute_code')) {
82108

83109
/**
84-
* Execute Code
110+
* Executes the provided code and outputs the result within a preformatted code block.
111+
*
112+
* This function executes the provided code (either a callable function or a string)
113+
* and displays the result within a preformatted code block with syntax highlighting
114+
* based on the specified language.
115+
*
116+
* @param string $language The language for syntax highlighting (default: 'php').
117+
* @param callable|string $func The function to execute or the code to evaluate.
118+
* @return void
85119
*/
86120
function wpkirk_execute_code($language = 'php', $func = '')
87121
{

0 commit comments

Comments
 (0)