Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cli_helper | ||
========== | ||
|
||
Helper functions for writing command line scripts in CodeIgniter | ||
Helper functions for writing command line scripts in CodeIgniter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/** | ||
* Command Line Helper | ||
* | ||
* functions to assist in writing CLI scripts | ||
* | ||
* @package cli_hepler | ||
* @author Glenn Stovall | ||
* @version 1.0 | ||
*/ | ||
|
||
/** | ||
* print line | ||
* | ||
* @param string | ||
* @return null | ||
*/ | ||
function pl($input) | ||
{ | ||
echo $input . PHP_EOL; | ||
} | ||
|
||
/** | ||
* prints an array in a human-readable format | ||
* | ||
* @param array | ||
* @return null | ||
* | ||
*/ | ||
function pl_array($input) | ||
{ | ||
if(!empty($input) && is_array($input)) { | ||
foreach($input as $key => $value) { | ||
pl("[" .$key. "] => " . $value); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* prints a horizontal line break | ||
* | ||
* @param int | ||
* @return null | ||
* | ||
*/ | ||
function line_break($length = 40) | ||
{ | ||
$output = ""; | ||
for($i = 0; $i < $length; $i++) { | ||
$output .= '-'; | ||
} | ||
return $output; | ||
} |