當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。