inline {@source}

(phpDocumentor 1.1+ )

inline {@source} --  display source code of a function or method in the long description

Description

{@source} -or- {@source [startline]} -or- {@source [startline] [endline]}

The {@source} inline tag is used in front of functions

The inline {@source} differs from all ordinary tags. Inline tags parse and display their output directly in the documentation. In other words, this DocBlock:

/**
* Text with a normal tag, @copyright
* @copyright Copyright 2002, Greg Beaver
*/
function element()
{
}

Parses as:

element

element ( )

Text with a normal tag, @copyright
Function Parameters:
Function Info:
Copyright - Copyright 2002, Greg Beaver

/**
* Text with an inline source tag:
* {@source}
* displays without a break in the flow
*/
function element($pages)
{
    if (empty($pages))
    {
        die("<b>ERROR</b>: nothing parsed");
    }
}

Parses as:

element

void element ( $pages )

Text with an inline source tag:
function element($pages)
{
    if (empty($pages))
    {
        die("ERROR: nothing parsed");
    }
}
displays without a break in the flow
Function Parameters:
Function Info:

The {@source tag has two optional parameters, the starting line number to display and the ending line number to display. If only the first parameter is present, {@source} will print the source code starting on that line number to the end of the function source code. If both parameters are present, {@source} will print an excerpt of the source code beginning on the starting line number, and concluding with the ending line number.

/**
* Text with an inline source tag:
* {@source 3}
* displays without a break in the flow
*/
function element($pages)
{
    if (empty($pages))
    {
        die("<b>ERROR</b>: nothing parsed");
    }
    foreach($test as $hello)
    {
        echo "I love $hello";
    }

Parses as:

element

void element ( $pages )

Text with an inline source tag:
    {
        die("ERROR: nothing parsed");
    }
    foreach($test as $hello)
    {
        echo "I love $hello";
    }
}
displays without a break in the flow
Function Parameters:
Function Info:

/**
* Text with an inline source tag:
* {@source 3 6}
* displays without a break in the flow
*/
function element($pages)
{
    if (empty($pages))
    {
        die("<b>ERROR</b>: nothing parsed");
    }
    foreach($test as $hello)
    {
        echo "I love $hello";
    }

Parses as:

element

void element ( $pages )

Text with an inline source tag:
    if (empty($pages))
    {
        die("ERROR: nothing parsed");
    }
displays without a break in the flow
Function Parameters:
Function Info: