PHP Класс PhpParser\PrettyPrinterAbstract

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$canUseSemicolonNamespaces
$docStringEndToken
$noIndentToken
$options
$precedenceMap

Открытые методы

Метод Описание
__construct ( array $options = [] ) Creates a pretty printer instance using the given options.
prettyPrint ( array $stmts ) : string Pretty prints an array of statements.
prettyPrintExpr ( PhpParser\Node\Expr $node ) : string Pretty prints an expression.
prettyPrintFile ( array $stmts ) : string Pretty prints a file of statements (includes the opening

Защищенные методы

Метод Описание
handleMagicTokens ( $str )
p ( phpparser\Node $node ) : string Pretty prints a node.
pCommaSeparated ( array $nodes ) : string Pretty prints an array of nodes and implodes the printed values with commas.
pComments ( array $comments ) : string Prints reformatted text of the passed comments.
pImplode ( array $nodes, string $glue = '' ) : string Pretty prints an array of nodes and implodes the printed values.
pInfixOp ( $type, phpparser\Node $leftNode, $operatorString, phpparser\Node $rightNode )
pNoIndent ( string $string ) : string Signals the pretty printer that a string shall not be indented.
pPostfixOp ( $type, phpparser\Node $node, $operatorString )
pPrec ( phpparser\Node $node, integer $parentPrecedence, integer $parentAssociativity, integer $childPosition ) : string Prints an expression node with the least amount of parentheses necessary to preserve the meaning.
pPrefixOp ( $type, $operatorString, phpparser\Node $node )
pStmts ( array $nodes, boolean $indent = true ) : string Pretty prints an array of nodes (statements) and indents them optionally.
preprocessNodes ( array $nodes ) Preprocesses the top-level nodes to initialize pretty printer state.

Описание методов

__construct() публичный Метод

Supported options: * bool $shortArraySyntax = false: Whether to use [] instead of array() as the default array syntax, if the node does not specify a format.
public __construct ( array $options = [] )
$options array Dictionary of formatting options

handleMagicTokens() защищенный Метод

protected handleMagicTokens ( $str )

p() защищенный Метод

Pretty prints a node.
protected p ( phpparser\Node $node ) : string
$node phpparser\Node Node to be pretty printed
Результат string Pretty printed node

pCommaSeparated() защищенный Метод

Pretty prints an array of nodes and implodes the printed values with commas.
protected pCommaSeparated ( array $nodes ) : string
$nodes array Array of Nodes to be printed
Результат string Comma separated pretty printed nodes

pComments() защищенный Метод

Prints reformatted text of the passed comments.
protected pComments ( array $comments ) : string
$comments array List of comments
Результат string Reformatted text of comments

pImplode() защищенный Метод

Pretty prints an array of nodes and implodes the printed values.
protected pImplode ( array $nodes, string $glue = '' ) : string
$nodes array Array of Nodes to be printed
$glue string Character to implode with
Результат string Imploded pretty printed nodes

pInfixOp() защищенный Метод

protected pInfixOp ( $type, phpparser\Node $leftNode, $operatorString, phpparser\Node $rightNode )
$leftNode phpparser\Node
$rightNode phpparser\Node

pNoIndent() защищенный Метод

Signals the pretty printer that a string shall not be indented.
protected pNoIndent ( string $string ) : string
$string string Not to be indented string
Результат string String marked with $this->noIndentToken's.

pPostfixOp() защищенный Метод

protected pPostfixOp ( $type, phpparser\Node $node, $operatorString )
$node phpparser\Node

pPrec() защищенный Метод

Prints an expression node with the least amount of parentheses necessary to preserve the meaning.
protected pPrec ( phpparser\Node $node, integer $parentPrecedence, integer $parentAssociativity, integer $childPosition ) : string
$node phpparser\Node Node to pretty print
$parentPrecedence integer Precedence of the parent operator
$parentAssociativity integer Associativity of parent operator (-1 is left, 0 is nonassoc, 1 is right)
$childPosition integer Position of the node relative to the operator (-1 is left, 1 is right)
Результат string The pretty printed node

pPrefixOp() защищенный Метод

protected pPrefixOp ( $type, $operatorString, phpparser\Node $node )
$node phpparser\Node

pStmts() защищенный Метод

Pretty prints an array of nodes (statements) and indents them optionally.
protected pStmts ( array $nodes, boolean $indent = true ) : string
$nodes array Array of nodes
$indent boolean Whether to indent the printed nodes
Результат string Pretty printed statements

preprocessNodes() защищенный Метод

Preprocesses the top-level nodes to initialize pretty printer state.
protected preprocessNodes ( array $nodes )
$nodes array Array of nodes

prettyPrint() публичный Метод

Pretty prints an array of statements.
public prettyPrint ( array $stmts ) : string
$stmts array Array of statements
Результат string Pretty printed statements

prettyPrintExpr() публичный Метод

Pretty prints an expression.
public prettyPrintExpr ( PhpParser\Node\Expr $node ) : string
$node PhpParser\Node\Expr Expression node
Результат string Pretty printed node

prettyPrintFile() публичный Метод

Pretty prints a file of statements (includes the opening
public prettyPrintFile ( array $stmts ) : string
$stmts array Array of statements
Результат string Pretty printed statements

Описание свойств

$canUseSemicolonNamespaces защищенное свойство

protected $canUseSemicolonNamespaces

$docStringEndToken защищенное свойство

protected $docStringEndToken

$noIndentToken защищенное свойство

protected $noIndentToken

$options защищенное свойство

protected $options

$precedenceMap защищенное свойство

protected $precedenceMap