class PhpDocGenerator (View source)

Helper class to generate PHPDoc.

Properties

protected bool $insideNamespace

Are we generating PHPDoc to be placed inside a namespace?

protected string $indentation

Intentation.

Methods

bool
isInsideNamespace()

Are we generating PHPDoc to be placed inside a namespace?

$this
setIsInsideNamespace(bool $value)

Are we generating PHPDoc to be placed inside a namespace?

string
getIntentation()

Get the indentation.

$this
setIntentation(string $value)

Set the indentation.

string
describeVar(string $name, mixed $value)

Generate the PHPDoc to describe a variable.

string
describeVars(array $vars, bool $sortByName = true)

Generate the PHPDoc to describe a list of variables.

string
getVarType(mixed $var, int $arrayLevel = 0)

Get the PHPDoc type name of a variable.

array
getObjectDescriptors(mixed $var)

Get all the names representing an object instance (class name, parent class names, interface names).

Details

bool isInsideNamespace()

Are we generating PHPDoc to be placed inside a namespace?

Return Value

bool

$this setIsInsideNamespace(bool $value)

Are we generating PHPDoc to be placed inside a namespace?

Parameters

bool $value

Return Value

$this

string getIntentation()

Get the indentation.

Return Value

string

$this setIntentation(string $value)

Set the indentation.

Parameters

string $value

Return Value

$this

string describeVar(string $name, mixed $value)

Generate the PHPDoc to describe a variable.

Parameters

string $name

The variable name

mixed $value

The variable value

Return Value

string

string describeVars(array $vars, bool $sortByName = true)

Generate the PHPDoc to describe a list of variables.

Parameters

array $vars
bool $sortByName

Return Value

string

protected string getVarType(mixed $var, int $arrayLevel = 0)

Get the PHPDoc type name of a variable.

Parameters

mixed $var
int $arrayLevel

Return Value

string

protected array getObjectDescriptors(mixed $var)

Get all the names representing an object instance (class name, parent class names, interface names).

Parameters

mixed $var

Return Value

array