class Printer

Generates PHP code.

Traits

Strict class for better experience.

Properties

protected string $indentation
protected int $linesBetweenProperties
protected int $linesBetweenMethods
protected string $returnTypeColon

Methods

string
printFunction(GlobalFunction $function, PhpNamespace $namespace = null)

No description

string
printClosure(Closure $closure)

No description

string
printArrowFunction(Closure $closure)

No description

string
printMethod(Method $method, PhpNamespace $namespace = null)

No description

string
printClass(ClassType $class, PhpNamespace $namespace = null)

No description

string
printNamespace(PhpNamespace $namespace)

No description

string
printFile(PhpFile $file)

No description

setTypeResolving(bool $state = true)

No description

string
indent(string $s)

No description

string
dump($var, int $column = 0)

No description

string
printUses(PhpNamespace $namespace)

No description

string
printParameters($function, PhpNamespace $namespace = null)

No description

string
printType(string|null $type, bool $nullable = false, PhpNamespace $namespace = null)

No description

Details

at line 39
string printFunction(GlobalFunction $function, PhpNamespace $namespace = null)

Parameters

GlobalFunction $function
PhpNamespace $namespace

Return Value

string

at line 51
string printClosure(Closure $closure)

Parameters

Closure $closure

Return Value

string

at line 70
string printArrowFunction(Closure $closure)

Parameters

Closure $closure

Return Value

string

at line 86
string printMethod(Method $method, PhpNamespace $namespace = null)

Parameters

Method $method
PhpNamespace $namespace

Return Value

string

at line 108
string printClass(ClassType $class, PhpNamespace $namespace = null)

Parameters

ClassType $class
PhpNamespace $namespace

Return Value

string

at line 167
string printNamespace(PhpNamespace $namespace)

Parameters

PhpNamespace $namespace

Return Value

string

at line 192
string printFile(PhpFile $file)

Parameters

PhpFile $file

Return Value

string

at line 210
Printer setTypeResolving(bool $state = true)

Parameters

bool $state

Return Value

Printer

at line 217
protected string indent(string $s)

Parameters

string $s

Return Value

string

at line 224
protected string dump($var, int $column = 0)

Parameters

$var
int $column

Return Value

string

at line 230
protected string printUses(PhpNamespace $namespace)

Parameters

PhpNamespace $namespace

Return Value

string

at line 250
string printParameters($function, PhpNamespace $namespace = null)

Parameters

$function
PhpNamespace $namespace

Return Value

string

at line 270
string printType(string|null $type, bool $nullable = false, PhpNamespace $namespace = null)

Parameters

string|null $type
bool $nullable
PhpNamespace $namespace

Return Value

string