本文整理汇总了PHP中Board::indent方法的典型用法代码示例。如果您正苦于以下问题:PHP Board::indent方法的具体用法?PHP Board::indent怎么用?PHP Board::indent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board::indent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
protected function build(Board $board, $depth = 0)
{
$weight = $this->getPrecedence();
$indent = $board->indent($depth);
$index = 0;
/* @var $child Node */
foreach ($this->getChildren() as $child) {
// Prep
$wrap = $child->getPrecedence() < $weight;
// Indent
if ($this->isBlock()) {
$index && $board->write("\n");
$board->write($indent);
}
// Operator
if ($index) {
$board->write($child->isBlock() && !$wrap ? '' : ' ');
}
// Child:
$wrap && $board->write("(");
$child->isBlock() && $board->write("\n");
$child->build($board, $depth + 1);
$wrap && $board->write(")");
// ===
$index++;
}
}
示例2: build
/**
* @param Board $board
* @param int $depth
*/
protected function build(Board $board, $depth)
{
$weight = $this->getPrecedence();
$indent = $board->indent($depth);
$index = 0;
/* @var $child Node */
foreach ($this->getChildren() as $child) {
// Prep
$wrap = $child->getPrecedence() <= $weight;
// Operator
if ($index) {
$board->write(',');
if ($this->isBlock()) {
$board->write("\n");
(!$child->isBlock() || $wrap) && $board->write($indent);
} else {
$board->write(" ");
}
} else {
$this->isBlock() && $board->write($indent);
}
// Child:
if ($wrap) {
$board->write("(");
$child->isBlock() && $board->write("\n");
}
$child->build($board, $depth + 1);
$wrap && $board->write(")");
// ===
$index++;
}
}
示例3: build
protected function build(Board $board, $depth)
{
$index = 0;
$indent = $board->indent($depth);
//
foreach ($this->components as $compo) {
if ($index > 0) {
$board->write("\n");
}
$board->write($indent);
if ($compo['type']) {
$board->write($compo['type'])->write(' ');
}
$compo['ref']->build($board, $depth + 1);
if ($compo['alias']) {
$board->write(' AS ');
$compo['alias']->build($board, $depth + 1);
}
if ($compo['cond']) {
$board->write(' ON (');
$compo['cond']->build($board, $depth + 1);
$board->write(')');
}
$index++;
}
}
示例4: buildPart
/**
*
* @param string $part
* @param Node|null $node
* @param Board $board
* @param int $depth
*/
protected function buildPart($part, $node, $board, $depth)
{
if ($node) {
$indent = $board->indent($depth);
$board->write($indent)->write($part);
$board->write($node->isBlock() ? "\n" : ' ');
$node->build($board, $depth + 1);
$board->write("\n");
}
}
示例5: build
/**
* @param Board $board
* @param int $depth
*/
protected function build(Board $board, $depth)
{
$expr = $this->getExpr();
$alias = $this->getAlias();
$wrap = $expr->getPrecedence() < $this->getPrecedence();
$indent = $board->indent($depth);
$block = $this->isBlock();
// Column:
$block && $board->write($indent);
$wrap && $board->write('(');
$expr->isBlock() && $board->write("\n");
$expr->build($board, $depth + 1);
$block && $board->write($indent);
$wrap && $board->write(')');
// Alias:
if ($alias) {
$board->write(' AS ');
$alias->build($board, $depth + 1);
}
}