final class PrintContext

PHP printing helpers and context.

Constants

private Left

associativity

private None

associativity

private Right

associativity

Properties

$paramsExtraction
$blocks

Methods

__construct(string $contentType = ContentType::Html)

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)

Prints an infix operation while taking precedence into account.

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

Prints a prefix operation while taking precedence into account.

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

Prints a postfix operation while taking precedence into account.

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 79
__construct(string $contentType = ContentType::Html)

No description

Parameters

string $contentType

at line 88
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 147
Escaper beginEscape()

No description

Return Value

Escaper

at line 153
void restoreEscape()

No description

Return Value

void

at line 159
Escaper getEscaper()

No description

Return Value

Escaper

at line 165
void addBlock(Block $block)

No description

Parameters

Block $block

Return Value

void

at line 181
int generateId()

No description

Return Value

int

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

No description

Parameters

string $str
string $quote

Return Value

string

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

Prints an infix operation while taking precedence into account.

Parameters

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

Return Value

string

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

Prints a prefix operation while taking precedence into account.

Parameters

Node $node
string $operatorString
Node $expr

Return Value

string

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

Prints a postfix operation while taking precedence into account.

Parameters

Node $node
Node $var
string $operatorString

Return Value

string

at line 268
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 283
string objectProperty(Node $node)

No description

Parameters

Node $node

Return Value

string

at line 291
string memberAsString(Node $node)

No description

Parameters

Node $node

Return Value

string

at line 302
string callExpr(Node $expr)

Wraps the LHS of a call in parentheses if needed.

Parameters

Node $expr

Return Value

string

at line 322
string dereferenceExpr(Node $expr)

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

Parameters

Node $expr

Return Value

string

at line 349
string argumentsAsArray(array $args)

No description

Parameters

array $args

Return Value

string

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

Ensures that expression evaluates to string or throws exception.

Parameters

ExpressionNode $name
string $entity

Return Value

string