Class Kitab\Compiler\IntermediateRepresentation\Documentation

class Documentation
{
    public function __construct(string $documentation);
    public function getDescription(): string;
    public function __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

public $documentation = '';

The raw extracted documentation, with not formatting applied.

Methods

public function __construct(string $documentation)

Allocate a documentation.

public function 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.

public function __toString(): string

Transform the intermediate representation.

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