Class Kitab\Compiler\IntermediateRepresentation\Documentation

class Documentation
{
    pub fn __construct(string $documentation);
    pub fn getDescription(): string;
    pub fn __toString(): string;
}

A documentation intermediate representation.

A documentation is block comment starting with /** and “attached” to a statement (like a function, a method, a class, an attribute etc.). “Attached” means that it immediately preceeds a statement, modulo whitespaces.

Kitab expects those documentation to contain CommonMark formatted text.

The first paragraph of the documentation is called the description. Paragraphes must be separated by 2 consecutive newlines.

Attributes

pub $documentation = '';

The raw extracted documentation, with not formatting applied.

Methods

pub fn __construct(string $documentation)

Allocate a documentation.

pub fn getDescription(): string

The description is the first paragraph of the documentation.

It generally gives an overview or the abstract idea of the documented feature. This is more or less like a summary that highlights important points.

pub fn __toString(): string

Transform the intermediate representation.

It basically returns the documentation. No extra allocation is applied.