當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Generator::interpolate方法代碼示例

本文整理匯總了PHP中Generator::interpolate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Generator::interpolate方法的具體用法?PHP Generator::interpolate怎麽用?PHP Generator::interpolate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Generator的用法示例。


在下文中一共展示了Generator::interpolate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: generate


//.........這裏部分代碼省略.........
             foreach ($entry->{$kind} as $subentry) {
                 $categories[$subentry->getCategory()][] = $subentry;
             }
         }
     }
     // sort categories
     ksort($categories);
     foreach (array('Methods', 'Properties') as $category) {
         if (isset($categories[$category])) {
             $entries = $categories[$category];
             unset($categories[$category]);
             $categories[$category] = $entries;
         }
     }
     /*------------------------------------------------------------------------*/
     // compile TOC
     $result[] = $openTag;
     // compile TOC by categories
     if ($byCategory) {
         foreach ($categories as $category => $entries) {
             if ($compiling) {
                 $result[] = $closeTag;
             } else {
                 $compiling = true;
             }
             // assign TOC hash
             if (count($result) == 2) {
                 $toc = $category;
             }
             // add category
             array_push($result, $openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $category . '`');
             // add entries
             foreach ($entries as $entry) {
                 $result[] = Generator::interpolate('* [`#{member}#{separator}#{name}`](##{hash})', $entry);
             }
         }
     } else {
         foreach ($api as $entry) {
             if ($compiling) {
                 $result[] = $closeTag;
             } else {
                 $compiling = true;
             }
             $member = $entry->member . $entry->getName();
             // assign TOC hash
             if (count($result) == 2) {
                 $toc = $member;
             }
             // add root entry
             array_push($result, $openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $member . '`', Generator::interpolate('* [`' . $member . '`](##{hash})', $entry));
             // add static and plugin sub-entries
             foreach (array('static', 'plugin') as $kind) {
                 if ($kind == 'plugin' && count($entry->plugin)) {
                     array_push($result, $closeTag, $openTag, '## `' . $member . ($entry->isCtor() ? '.prototype`' : '`'));
                 }
                 foreach ($entry->{$kind} as $subentry) {
                     $subentry->member = $member;
                     $result[] = Generator::interpolate('* [`#{member}#{separator}#{name}`](##{hash})', $subentry);
                 }
             }
         }
     }
     array_push($result, $closeTag, $closeTag);
     /*------------------------------------------------------------------------*/
     // compile content
     $compiling = false;
開發者ID:bcardarella,項目名稱:testem,代碼行數:67,代碼來源:Generator.php

示例2: generate


//.........這裏部分代碼省略.........
     }
     uksort($api, 'sortCompare');
     // sort static and plugin sub-entries
     foreach ($api as $entry) {
         foreach (array('static', 'plugin') as $kind) {
             $sortBy = array('a' => array(), 'b' => array(), 'c' => array());
             foreach ($entry->{$kind} as $subentry) {
                 $name = $subentry->getName();
                 // functions w/o ALL-CAPs names are last
                 $sortBy['a'][] = $subentry->getType() == 'Function' && !preg_match('/^[A-Z_]+$/', $name);
                 // ALL-CAPs properties first
                 $sortBy['b'][] = preg_match('/^[A-Z_]+$/', $name);
                 // lowercase alphanumeric sort
                 $sortBy['c'][] = strtolower($name);
             }
             array_multisort($sortBy['a'], SORT_ASC, $sortBy['b'], SORT_DESC, $sortBy['c'], SORT_ASC, $entry->{$kind});
         }
     }
     /*------------------------------------------------------------------------*/
     // compile TOC
     $result[] = $openTag;
     foreach ($api as $key => $entry) {
         $entry->hash = $this->getHash($entry);
         $entry->href = $this->getLineUrl($entry);
         $member = $entry->getMembers(0);
         $member = ($member ? $member . ($entry->isPlugin() ? '.prototype.' : '.') : '') . $entry->getName();
         $entry->member = preg_replace('/' . $entry->getName() . '$/', '', $member);
         $compiling = $compiling ? $result[] = $closeTag : true;
         // assign TOC hash
         if (count($result) == 2) {
             $toc = $member;
         }
         // add root entry
         array_push($result, $openTag, '## ' . (count($result) == 2 ? '<a id="' . $toc . '"></a>' : '') . '`' . $member . '`', Generator::interpolate('* [`' . $member . '`](##{hash})', $entry));
         // add static and plugin sub-entries
         foreach (array('static', 'plugin') as $kind) {
             if ($kind == 'plugin' && count($entry->plugin)) {
                 array_push($result, $closeTag, $openTag, '## `' . $member . ($entry->isCtor() ? '.prototype`' : '`'));
             }
             foreach ($entry->{$kind} as $subentry) {
                 $subentry->hash = $this->getHash($subentry);
                 $subentry->href = $this->getLineUrl($subentry);
                 $subentry->member = $member;
                 $subentry->separator = $this->getSeparator($subentry);
                 $result[] = Generator::interpolate('* [`#{member}#{separator}#{name}`](##{hash})', $subentry);
             }
         }
     }
     array_push($result, $closeTag, $closeTag);
     /*------------------------------------------------------------------------*/
     // compile content
     $compiling = false;
     $result[] = $openTag;
     foreach ($api as $entry) {
         // skip aliases
         if ($entry->isAlias()) {
             continue;
         }
         // add root entry
         $member = $entry->member . $entry->getName();
         $compiling = $compiling ? $result[] = $closeTag : true;
         array_push($result, $openTag, '## `' . $member . '`');
         foreach (array($entry, 'static', 'plugin') as $kind) {
             $subentries = is_string($kind) ? $entry->{$kind} : array($kind);
             // title
             if ($kind != 'static' && $entry->getType() != 'Object' && count($subentries) && $subentries[0] != $kind) {
開發者ID:nibblebot,項目名稱:subspace.js,代碼行數:67,代碼來源:Generator.php


注:本文中的Generator::interpolate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。