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 Indentation.
protected string $singleDocBlock

Insert the variable definitions in the same PHPDoc block?

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
getIndentation()

Get the indentation.

$this
setIndentation(string $value)

Set the indentation.

bool
isSingleDocBlock()

Insert the variable definitions in the same PHPDoc block?

$this
setIsSingleDocBlock(bool $value)

Insert the variable definitions in the same PHPDoc block?

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
describeVarUncommented(string $name, mixed $value)

Generate the PHPDoc content to describe a variable (without opening/closing comments).

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 getIndentation()

Get the indentation.

Return Value

string

$this setIndentation(string $value)

Set the indentation.

Parameters

string $value

Return Value

$this

bool isSingleDocBlock()

Insert the variable definitions in the same PHPDoc block?

Return Value

bool

$this setIsSingleDocBlock(bool $value)

Insert the variable definitions in the same PHPDoc block?

Parameters

bool $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 describeVarUncommented(string $name, mixed $value)

Generate the PHPDoc content to describe a variable (without opening/closing comments).

Parameters

string $name

The variable name

mixed $value

The variable value

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