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


PHP Helpers::getSuggestion方法代码示例

本文整理汇总了PHP中Helpers::getSuggestion方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::getSuggestion方法的具体用法?PHP Helpers::getSuggestion怎么用?PHP Helpers::getSuggestion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helpers的用法示例。


在下文中一共展示了Helpers::getSuggestion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __get

 public function __get($key)
 {
     $hint = Helpers::getSuggestion(array_keys((array) $this), $key);
     trigger_error("Attempt to read missing column '{$key}'" . ($hint ? ", did you mean '{$hint}'?" : '.'), E_USER_NOTICE);
 }
开发者ID:dg,项目名称:dibi,代码行数:5,代码来源:Row.php

示例2: expandMacro

 /**
  * Expands macro and returns node & code.
  * @param  string
  * @param  string
  * @param  string
  * @return MacroNode
  * @internal
  */
 public function expandMacro($name, $args, $modifiers = NULL, $nPrefix = NULL)
 {
     $inScript = in_array($this->context[0], array(self::CONTENT_JS, self::CONTENT_CSS), TRUE);
     if (empty($this->macros[$name])) {
         $hint = ($t = Helpers::getSuggestion(array_keys($this->macros), $name)) ? ", did you mean {{$t}}?" : '';
         throw new CompileException("Unknown macro {{$name}}{$hint}" . ($inScript ? ' (in JavaScript or CSS, try to put a space after bracket.)' : ''));
     }
     if (strpbrk($name, '=~%^&_')) {
         if ($this->context[1] === self::CONTENT_URL) {
             $modifiers = preg_replace('#\\|nosafeurl\\s?(?=\\||\\z)#i', '', $modifiers, -1, $found);
             if (!$found && !preg_match('#\\|datastream(?=\\s|\\||\\z)#i', $modifiers)) {
                 $modifiers .= '|safeurl';
             }
         }
         $modifiers = preg_replace('#\\|noescape\\s?(?=\\||\\z)#i', '', $modifiers, -1, $found);
         if (!$found) {
             $modifiers .= '|escape';
         }
         if (!$found && $inScript && $name === '=' && preg_match('#["\'] *\\z#', $this->tokens[$this->position - 1]->text)) {
             throw new CompileException("Do not place {$this->tokens[$this->position]->text} inside quotes.");
         }
     }
     foreach (array_reverse($this->macros[$name]) as $macro) {
         $node = new MacroNode($macro, $name, $args, $modifiers, $this->macroNode, $this->htmlNode, $nPrefix);
         if ($macro->nodeOpened($node) !== FALSE) {
             return $node;
         }
     }
     throw new CompileException('Unknown ' . ($nPrefix ? 'attribute ' . Parser::N_PREFIX . ($nPrefix === MacroNode::PREFIX_NONE ? '' : "{$nPrefix}-") . $name : 'macro {' . $name . ($args ? " {$args}" : '') . '}'));
 }
开发者ID:Richmond77,项目名称:learning-nette,代码行数:38,代码来源:Compiler.php

示例3: invokeFilter

 /**
  * Call a run-time filter.
  * @param  string  filter name
  * @param  array   arguments
  * @return mixed
  */
 public function invokeFilter($name, array $args)
 {
     $lname = strtolower($name);
     if (!isset($this->filters[$lname])) {
         $args2 = $args;
         array_unshift($args2, $lname);
         foreach ($this->filters[NULL] as $filter) {
             $res = call_user_func_array(Helpers::checkCallback($filter), $args2);
             if ($res !== NULL) {
                 return $res;
             } elseif (isset($this->filters[$lname])) {
                 return call_user_func_array(Helpers::checkCallback($this->filters[$lname]), $args);
             }
         }
         $hint = ($t = Helpers::getSuggestion(array_keys($this->filters), $name)) ? ", did you mean '{$t}'?" : '.';
         throw new \LogicException("Filter '{$name}' is not defined{$hint}");
     }
     return call_user_func_array(Helpers::checkCallback($this->filters[$lname]), $args);
 }
开发者ID:sallyx,项目名称:latte,代码行数:25,代码来源:Engine.php

示例4: expandMacro

 /**
  * Expands macro and returns node & code.
  * @param  string
  * @param  string
  * @param  string
  * @return MacroNode
  * @internal
  */
 public function expandMacro($name, $args, $modifiers = NULL, $nPrefix = NULL)
 {
     $inScript = in_array($this->context, [self::CONTEXT_HTML_JS, self::CONTEXT_HTML_CSS], TRUE);
     if (empty($this->macros[$name])) {
         $hint = ($t = Helpers::getSuggestion(array_keys($this->macros), $name)) ? ", did you mean {{$t}}?" : '';
         throw new CompileException("Unknown macro {{$name}}{$hint}" . ($inScript ? ' (in JavaScript or CSS, try to put a space after bracket or use n:syntax=off)' : ''));
     }
     if (preg_match('#\\|(no)?safeurl(?!\\w)#i', $modifiers, $m)) {
         $hint = $m[1] ? '|nocheck' : '|checkurl';
         $modifiers = str_replace($m[0], $hint, $modifiers);
         trigger_error("Modifier {$m['0']} is deprecated, please replace it with {$hint}.", E_USER_DEPRECATED);
     }
     if (strpbrk($name, '=~%^&_')) {
         if (in_array($this->context, [self::CONTEXT_HTML_ATTRIBUTE_URL, self::CONTEXT_HTML_ATTRIBUTE_UNQUOTED_URL], TRUE)) {
             if (!Helpers::removeFilter($modifiers, 'nosafeurl|nocheck') && !preg_match('#\\|datastream(?=\\s|\\||\\z)#i', $modifiers)) {
                 $modifiers .= '|checkurl';
             }
         }
         if (!Helpers::removeFilter($modifiers, 'noescape')) {
             $modifiers .= '|escape';
             if ($inScript && $name === '=' && preg_match('#["\'] *\\z#', $this->tokens[$this->position - 1]->text)) {
                 throw new CompileException("Do not place {$this->tokens[$this->position]->text} inside quotes.");
             }
         }
     }
     if ($nPrefix === MacroNode::PREFIX_INNER && !strcasecmp($this->htmlNode->name, 'script')) {
         $context = [$this->contentType, self::CONTEXT_HTML_JS];
     } elseif ($nPrefix === MacroNode::PREFIX_INNER && !strcasecmp($this->htmlNode->name, 'style')) {
         $context = [$this->contentType, self::CONTEXT_HTML_CSS];
     } elseif ($nPrefix) {
         $context = [$this->contentType, self::CONTEXT_HTML_TEXT];
     } else {
         $context = [$this->contentType, $this->context];
     }
     foreach (array_reverse($this->macros[$name]) as $macro) {
         $node = new MacroNode($macro, $name, $args, $modifiers, $this->macroNode, $this->htmlNode, $nPrefix);
         $node->context = $context;
         $node->startLine = $nPrefix ? $this->htmlNode->startLine : $this->getLine();
         if ($macro->nodeOpened($node) !== FALSE) {
             return $node;
         }
     }
     throw new CompileException('Unknown ' . ($nPrefix ? 'attribute ' . Parser::N_PREFIX . ($nPrefix === MacroNode::PREFIX_NONE ? '' : "{$nPrefix}-") . $name : 'macro {' . $name . ($args ? " {$args}" : '') . '}'));
 }
开发者ID:nette,项目名称:latte,代码行数:52,代码来源:Compiler.php


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