Susan is correct, it is not part of the public API and this function will be gone in future releases, so do not use this in components if you want to protect your upgrade path. Obviously, with the state of the current code, it may be the only solution, and if you must use it, try to isolate your usage to a custom class that you re-use and can easily refactor when the new parser is available for use and you decide you want to upgrade.
FWIW, the future core has a fully recursive, source order parsing algorithm, that will avoid this issue, as well as a singular model of parser execution by which any MODx element (chunk, snippet, or otherwise) can be processed by simply instantiating the object and calling the process() function, as you can see from the implementation of the getChunk function for 0.9.7:
<?php
function getChunk($chunkName, $properties= array ()) {
$output= '';
if ($chunk= $this->getObject('modChunk', array ('name' => $chunkName), true)) {
$output= $chunk->process($properties);
}
return $output;
}
?>
There is also a new parameter called properties that allows you to pass in an associative array of replacement variables that will be prefixed with the name of the chunk, e.g. [[+chunkName.var1]] would be a valid placeholder which would return ’the value of var’ when calling the function like so:
<?php
$output = $modx->getChunk('chunkName', array('var' => 'the value of var'));
?>