Skip to content

Commit

Permalink
Add detailed docblocks to helper functions
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
gfazioli committed Oct 30, 2024
1 parent 1f4a3af commit 3cd7113
Show file tree
Hide file tree
Showing 2 changed files with 281 additions and 5 deletions.
242 changes: 242 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 39 additions & 5 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
if (!function_exists('wpkirk_toc')) {

/**
* Table of Contents
* Generates a Table of Contents (TOC) based on the sections in the buffer.
*
* This function scans the output buffer for section headers and generates a TOC.
* The TOC is then displayed at the beginning of the content.
*
* @return void
*/
function wpkirk_toc()
{
Expand Down Expand Up @@ -35,7 +40,14 @@ function wpkirk_toc()
if (!function_exists('wpkirk_output')) {

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

/**
* Section
* Outputs a section header with the specified ID and content.
*
* This function generates an H2 header with the specified ID and content.
* The content can be a string or a callable function.
*
* @param string $id The ID for the section header.
* @param string|callable $strFunc The content for the section header.
* @return void
*/
function wpkirk_section($id, $strFunc)
{
Expand All @@ -68,7 +87,14 @@ function wpkirk_section($id, $strFunc)
if (!function_exists('wpkirk_code')) {

/**
* Code
* Outputs code within a preformatted code block.
*
* This function displays the provided code within a preformatted code block
* with syntax highlighting based on the specified language.
*
* @param string $language The language for syntax highlighting (default: 'php').
* @param string $func The code to display.
* @return void
*/
function wpkirk_code($language = 'php', $func = '')
{
Expand All @@ -81,7 +107,15 @@ function wpkirk_code($language = 'php', $func = '')
if (!function_exists('wpkirk_execute_code')) {

/**
* Execute Code
* Executes the provided code and outputs the result within a preformatted code block.
*
* This function executes the provided code (either a callable function or a string)
* and displays the result within a preformatted code block with syntax highlighting
* based on the specified language.
*
* @param string $language The language for syntax highlighting (default: 'php').
* @param callable|string $func The function to execute or the code to evaluate.
* @return void
*/
function wpkirk_execute_code($language = 'php', $func = '')
{
Expand Down

0 comments on commit 3cd7113

Please sign in to comment.