final class PrintContext

PHP printing helpers and context.

Properties

$paramsExtraction
$blocks

Methods

__construct(string $contentType = ContentType::Html, bool $migrationWarnings = false)

No description

string
format(string $mask, mixed ...$args)

Expands %node, %dump, %raw, %args, %line, %escape(), %modify(), %modifyContent() in code.

beginEscape()

No description

void
restoreEscape()

No description

getEscaper()

No description

void
addBlock(Block $block)

No description

int
generateId()

No description

string
encodeString(string $str, string $quote = "'")

No description

string
infixOp(Node $node, Node $leftNode, string $operatorString, Node $rightNode)

No description

string
prefixOp(Node $node, string $operatorString, Node $expr)

No description

string
postfixOp(Node $node, Node $var, string $operatorString)

No description

string
parenthesize(OperatorNode $parentNode, Node $childNode, int $childPosition)

Prints an expression node with the least amount of parentheses necessary to preserve the meaning.

string
implode(array $nodes, string $glue = ', ')

Prints an array of nodes and implodes the printed values with $glue

string
objectProperty(Node $node)

No description

string
memberAsString(Node $node)

No description

string
callExpr(Node $expr)

Wraps the LHS of a call in parentheses if needed.

string
dereferenceExpr(Node $expr)

Wraps the LHS of a dereferencing operation in parentheses if needed.

string
argumentsAsArray(array $args)

No description

string
ensureString(ExpressionNode $name, string $entity)

Ensures that expression evaluates to string or throws exception.

Details

at line 33
__construct(string $contentType = ContentType::Html, bool $migrationWarnings = false)

No description

Parameters

string $contentType
bool $migrationWarnings

at line 44
string format(string $mask, mixed ...$args)

Expands %node, %dump, %raw, %args, %line, %escape(), %modify(), %modifyContent() in code.

Parameters

string $mask
mixed ...$args

Return Value

string

at line 103
Escaper beginEscape()

No description

Return Value

Escaper

at line 109
void restoreEscape()

No description

Return Value

void

at line 115
Escaper getEscaper()

No description

Return Value

Escaper

at line 121
void addBlock(Block $block)

No description

Parameters

Block $block

Return Value

void

at line 137
int generateId()

No description

Return Value

int

at line 146
string encodeString(string $str, string $quote = "'")

No description

Parameters

string $str
string $quote

Return Value

string

at line 154
string infixOp(Node $node, Node $leftNode, string $operatorString, Node $rightNode)

No description

Parameters

Node $node
Node $leftNode
string $operatorString
Node $rightNode

Return Value

string

at line 163
string prefixOp(Node $node, string $operatorString, Node $expr)

No description

Parameters

Node $node
string $operatorString
Node $expr

Return Value

string

at line 170
string postfixOp(Node $node, Node $var, string $operatorString)

No description

Parameters

Node $node
Node $var
string $operatorString

Return Value

string

at line 180
string parenthesize(OperatorNode $parentNode, Node $childNode, int $childPosition)

Prints an expression node with the least amount of parentheses necessary to preserve the meaning.

Parameters

OperatorNode $parentNode
Node $childNode
int $childPosition

Return Value

string

at line 193
string implode(array $nodes, string $glue = ', ')

Prints an array of nodes and implodes the printed values with $glue

Parameters

array $nodes
string $glue

Return Value

string

at line 208
string objectProperty(Node $node)

No description

Parameters

Node $node

Return Value

string

at line 216
string memberAsString(Node $node)

No description

Parameters

Node $node

Return Value

string

at line 227
string callExpr(Node $expr)

Wraps the LHS of a call in parentheses if needed.

Parameters

Node $expr

Return Value

string

at line 244
string dereferenceExpr(Node $expr)

Wraps the LHS of a dereferencing operation in parentheses if needed.

Parameters

Node $expr

Return Value

string

at line 268
string argumentsAsArray(array $args)

No description

Parameters

array $args

Return Value

string

at line 278
string ensureString(ExpressionNode $name, string $entity)

Ensures that expression evaluates to string or throws exception.

Parameters

ExpressionNode $name
string $entity

Return Value

string