PHP 클래스 PhpParser\PrettyPrinterAbstract

파일 보기 프로젝트 열기: nikic/php-parser 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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