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


PHP Helpers::checkCallback方法代码示例

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


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

示例1: compile

 /**
  * Compiles template to PHP code.
  * @return string
  */
 public function compile($name)
 {
     foreach ($this->onCompile ?: array() as $cb) {
         call_user_func(Helpers::checkCallback($cb), $this);
     }
     $this->onCompile = array();
     $source = $this->getLoader()->getContent($name);
     try {
         $tokens = $this->getParser()->setContentType($this->contentType)->parse($source);
         $code = $this->getCompiler()->setContentType($this->contentType)->compile($tokens);
         if (preg_match('#^\\S{5,100}\\z#', $name)) {
             $code = "<?php\n// source: {$name}\n?>" . $code;
         }
     } catch (\Exception $e) {
         $e = $e instanceof CompileException ? $e : new CompileException("Thrown exception '{$e->getMessage()}'", NULL, $e);
         throw $e->setSource($source, $this->getCompiler()->getLine(), $name);
     }
     $code = Helpers::optimizePhp($code);
     return $code;
 }
开发者ID:prcharom,项目名称:w-pps-reality,代码行数:24,代码来源:Engine.php

示例2: compile

 /**
  * Compiles template to PHP code.
  * @return string
  */
 public function compile($name)
 {
     foreach ($this->onCompile ?: [] as $cb) {
         call_user_func(Helpers::checkCallback($cb), $this);
     }
     $this->onCompile = [];
     $source = $this->getLoader()->getContent($name);
     try {
         $tokens = $this->getParser()->setContentType($this->contentType)->parse($source);
         $code = $this->getCompiler()->setContentType($this->contentType)->compile($tokens, $this->getTemplateClass($name));
     } catch (\Exception $e) {
         if (!$e instanceof CompileException) {
             $e = new CompileException("Thrown exception '{$e->getMessage()}'", NULL, $e);
         }
         $line = isset($tokens) ? $this->getCompiler()->getLine() : $this->getParser()->getLine();
         throw $e->setSource($source, $line, $name);
     }
     if (!preg_match('#\\n|\\?#', $name)) {
         $code = "<?php\n// source: {$name}\n?>" . $code;
     }
     $code = PhpHelpers::reformatCode($code);
     return $code;
 }
开发者ID:nette,项目名称:latte,代码行数:27,代码来源:Engine.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: 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);
             }
         }
         throw new \LogicException("Filter '{$name}' is not defined.");
     }
     return call_user_func_array(Helpers::checkCallback($this->filters[$lname]), $args);
 }
开发者ID:novasky,项目名称:latte,代码行数:24,代码来源:Engine.php

示例5: __call

 /**
  * Call a template run-time filter. Do not call directly.
  * @param  string  filter name
  * @param  array   arguments
  * @return mixed
  */
 public function __call($name, $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);
             }
         }
         return parent::__call($name, $args);
     }
     return call_user_func_array(Helpers::checkCallback($this->filters[$lname]), $args);
 }
开发者ID:prcharom,项目名称:w-pps-reality,代码行数:24,代码来源:Template.php


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