Usage

There are just a couple of functions to access this project, the objects are not meant to be called by users. These functions – I call them remote functions – are short to type and easy to remember. Their names are changeable to help you out if you already have a function with that name. See Simple Dumps for examples.

IMPORTANT: You should write every remote function in its own line and only in one line. Do not write arguments in new lines, do not write anything after the remote function.

// Do it like this: pre($arg1); pre($arg2); ex($arg3); // or do it like this: ex($arg1,$arg2,$arg3); // DON'T do that: pre($arg1); pre($arg2); ex($arg3); // or that: ex($arg1, $arg2, $arg3);
pre() and ex()
pre() is my most frequently used function ever, not only for this project. The name resembles the HTML-tag <pre> as in its first incarnation it was nothing more than a wrapper for print_r() with a <pre> around it to make it easily readable. Well, we've all spent a lot of pennies since that days, and now it is a remote-function for the HLI package. Usage couldn't be simpler: Pass an arbitrary number of parameters (including zero) to it, and retrieve as much information for every one of it as you can possibly get with PHP.
ex() does exactly the same as pre() but also stops script execution by calling exit() after printing the dump.
ifpre() and ifex()
ifpre() and ifex() are almost identical to pre() and ex() but require at least one parameter. The dump will only be done if the first parameter is true. Very handy when debugging loops. Note that the first parameter has to be really true, that is, it has to be of the type boolean.
$arr = array('hello','goodbye','mama','papa','I\'m','it\'s','easy','hard','to','to','fry','die'); foreach ($arr as $key => $elem) { ifpre($key % 2 != 0,$elem); }
Will dump the values "goodbye", "papa", "it's", "hard", "to" and "die".
hli()
With hli() you can change HLI configuration on the spot. Pass the config option name as first parameter and the new value as second. Note that HLI automatically checks for validity of the new value.
hlionce()
NOT implemented yet! Planned for release 0.2.
With this function it will be possible to shadow config options for just the next call of one of the remote functions.
deprec()
NOT implemented yet! Planned for release 0.2.
Sometimes you may encounter a method which you think is not a good implementation of some functionality, and even its interface is unuseable. You want to do it more abstractly to cover more cases, and you want to mark the old one as deprecated. But marking it with PHPDoc will not change anything in your code and will not really help you find calls to that method. And you don't have time to do it now. So here is a solution:
Use the function deprec() to mark it and get page summaries of deprecated functions called. Turn this feature on and off regardless of the use of the other HLI functions. deprec() expects two parameters, both strings, both optional: A description, reason or tip and a function/method name to be used instead. Note that you can safely leave deprec() in your code as long as you include HLI/init.php or HLI/dead.php.
The first parameter is an ordinary string that is displayed as is. The second one will be parsed like a PHPDoc @see tag. Example:
function oneDeprecatedFunction(){ deprec('Do not use this function anymore','NEW_OBJECT::newFunction()'); /* old function stuff */ }
This will display the description together with the PHPDoc comments of both functions and the signature of the new one.