Core_Controller_Shell::_parse_doc_comment
null Core_Controller_Shell::_parse_doc_comment( )
File: ./core/controllers-shell/shell.controller.php
protected static function _parse_doc_comment( $comment )
{
// Normalize all new lines to \n
$comment = str_replace( array( "\r\n", "\n" ), "\n", $comment );
// Remove the phpdoc open/close tags and split
$comment = array_slice( explode( "\n", $comment ), 1, - 1 );
// Tag content
$param = array();
foreach ( $comment as $i => $line )
{
// Remove all leading whitespace
$line = preg_replace( '/^\s*\* ?/m', '', $line );
// Search this line for a tag
if ( preg_match( '/^@(\S+)(?:\s*(.+))?$/', $line, $matches ) )
{
// This is a tag line
unset( $comment[$i] );
$name = $matches[1];
$text = isset( $matches[2] ) ? $matches[2] : '';
if ( $text && $name == 'param' )
{
// Add the tag
$param[] = $text;
}
else
{
continue;
}
}
else
{
// Overwrite the comment line
$comment[$i] = ( string ) $line;
}
}
return array( 'title' => $comment, 'param' => $param );
}