当前位置: 首页>>代码示例>>PHP>>正文


PHP Board::indent方法代码示例

本文整理汇总了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++;
     }
 }
开发者ID:rakorium,项目名称:okapi,代码行数:27,代码来源:Phrase.php

示例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++;
     }
 }
开发者ID:rakorium,项目名称:okapi,代码行数:36,代码来源:Enum.php

示例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++;
     }
 }
开发者ID:rakorium,项目名称:okapi,代码行数:26,代码来源:Table.php

示例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");
     }
 }
开发者ID:rakorium,项目名称:okapi,代码行数:17,代码来源:Select.php

示例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);
     }
 }
开发者ID:rakorium,项目名称:okapi,代码行数:24,代码来源:Alias.php


注:本文中的Board::indent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。