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


PHP Callback::check方法代码示例

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


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

示例1: __construct

 /**
  * @param string   $name
  * @param string   $caption
  * @param callable $callback
  */
 public function __construct($name, $caption, $callback)
 {
     $this->name = $name;
     $this->caption = $caption;
     Callback::check($callback);
     $this->callback = $callback;
 }
开发者ID:mike227,项目名称:n-datagrid,代码行数:12,代码来源:Action.php

示例2: getHeaderContent

 public function getHeaderContent()
 {
     if (array_key_exists(self::CALLBACK, $this->option)) {
         Callback::check($this->option[self::CALLBACK]);
     }
     return $this->getTranslator() ? $this->getTranslator()->translate($this->option[self::HEADER]) : $this->option[self::HEADER];
 }
开发者ID:mesour,项目名称:datagrid,代码行数:7,代码来源:Image.php

示例3: addCallbackItem

 public function addCallbackItem($name, $description, $callback)
 {
     $this->check($name);
     Callback::check($callback);
     $item = new CallbackItem($this, $name, $description, $callback);
     $this->items[$name] = $item;
     return $item;
 }
开发者ID:mesour,项目名称:datagrid,代码行数:8,代码来源:SubItem.php

示例4: setQueues

 public function setQueues(array $queues)
 {
     $this->queues = array();
     foreach ($queues as $name => $queue) {
         if (!isset($queue['callback'])) {
             throw new InvalidArgumentException("The queue '{$name}' is missing a callback.");
         }
         Callback::check($queue['callback']);
         $this->queues[$name] = $queue;
     }
 }
开发者ID:HotelQuickly,项目名称:RabbitMq,代码行数:11,代码来源:MultipleConsumer.php

示例5: addMacro

 public function addMacro($name, $begin, $end = NULL, $attr = NULL)
 {
     foreach (array($begin, $end, $attr) as $arg) {
         if ($arg && !is_string($arg)) {
             Nette\Utils\Callback::check($arg);
         }
     }
     $this->macros[$name] = array($begin, $end, $attr);
     $this->compiler->addMacro($name, $this);
     return $this;
 }
开发者ID:pdostal,项目名称:nette-blog,代码行数:11,代码来源:MacroSet.php

示例6: __construct

 /**
  * @param  NSelection $selection
  * @param  string|callable $entity
  * @param  string $refTable
  * @param  string $refColumn
  */
 public function __construct(NSelection $selection, $entity, $refTable = NULL, $refColumn = NULL)
 {
     $this->selection = $selection;
     $this->refTable = $refTable;
     $this->refColumn = $refColumn;
     try {
         NCallback::check($entity);
         $this->entity = NCallback::closure($entity);
     } catch (\Exception $e) {
         $this->entity = $entity;
     }
 }
开发者ID:uestla,项目名称:yetorm,代码行数:18,代码来源:EntityCollection.php

示例7: getBodyContent

 public function getBodyContent($data)
 {
     $template = $this->getTemplate();
     if (array_key_exists(self::CALLBACK, $this->option)) {
         Callback::check($this->option[self::CALLBACK]);
         $args = array($data, $template);
         if (isset($this->option[self::CALLBACK_ARGS]) && is_array($this->option[self::CALLBACK_ARGS])) {
             $args = array_merge($args, $this->option[self::CALLBACK_ARGS]);
         }
         Callback::invokeArgs($this->option[self::CALLBACK], $args);
     }
     return trim($template);
 }
开发者ID:mesour,项目名称:datagrid,代码行数:13,代码来源:Template.php

示例8: run

	/**
	 * @return Nette\Application\IResponse
	 */
	public function run(Application\Request $request)
	{
		$this->request = $request;

		if ($this->httpRequest && $this->router && !$this->httpRequest->isAjax() && ($request->isMethod('get') || $request->isMethod('head'))) {
			$refUrl = clone $this->httpRequest->getUrl();
			$url = $this->router->constructUrl($request, $refUrl->setPath($refUrl->getScriptPath()));
			if ($url !== NULL && !$this->httpRequest->getUrl()->isEqual($url)) {
				return new Responses\RedirectResponse($url, Http\IResponse::S301_MOVED_PERMANENTLY);
			}
		}

		$params = $request->getParameters();
		if (!isset($params['callback'])) {
			throw new Application\BadRequestException('Parameter callback is missing.');
		}
		$params['presenter'] = $this;
		$callback = $params['callback'];
		$reflection = Nette\Utils\Callback::toReflection(Nette\Utils\Callback::check($callback));
		$params = Application\UI\PresenterComponentReflection::combineArgs($reflection, $params);

		if ($this->context) {
			foreach ($reflection->getParameters() as $param) {
				if ($param->getClassName()) {
					unset($params[$param->getPosition()]);
				}
			}

			$params = Nette\DI\Helpers::autowireArguments($reflection, $params, $this->context);
			$params['presenter'] = $this;
		}

		$response = call_user_func_array($callback, $params);

		if (is_string($response)) {
			$response = array($response, array());
		}
		if (is_array($response)) {
			list($templateSource, $templateParams) = $response;
			$response = $this->createTemplate()->setParameters($templateParams);
			if (!$templateSource instanceof \SplFileInfo) {
				$response->getLatte()->setLoader(new Latte\Loaders\StringLoader);
			}
			$response->setFile($templateSource);
		}
		if ($response instanceof Application\UI\ITemplate) {
			return new Responses\TextResponse($response);
		} else {
			return $response;
		}
	}
开发者ID:nakoukal,项目名称:fakturace,代码行数:54,代码来源:MicroPresenter.php

示例9: closure

 /**
  * @param  mixed   class, object, callable
  * @param  string  method
  * @return \Closure
  */
 public static function closure($callable, $m = NULL)
 {
     if ($m !== NULL) {
         $callable = array($callable, $m);
     } elseif ($callable instanceof \Closure) {
         return $callable;
     }
     self::check($callable, TRUE);
     $_callable_ = $callable;
     return function () use($_callable_) {
         Callback::check($_callable_);
         return call_user_func_array($_callable_, func_get_args());
     };
 }
开发者ID:lcandida,项目名称:push-message-serie-web,代码行数:19,代码来源:Callback.php

示例10: flatMapAssoc

 /**
  * @param array|\Traversable $array
  * @param callable $callback
  * @return array
  */
 public static function flatMapAssoc($array, $callback)
 {
     Callback::check($callback);
     $result = array();
     $walker = function ($array, $keys = array()) use(&$walker, &$result, $callback) {
         foreach ($array as $key => $value) {
             $currentKeys = $keys + array(count($keys) => $key);
             if (is_array($value)) {
                 $walker($value, $currentKeys);
                 continue;
             }
             $result[] = $callback($value, $currentKeys);
         }
         return $result;
     };
     return $walker($array);
 }
开发者ID:noikiy,项目名称:Curl,代码行数:22,代码来源:Helpers.php

示例11: addFilter

 /**
  * Adds a filter callback.
  * @param  callable
  * @return self
  */
 public function addFilter($filter)
 {
     Nette\Utils\Callback::check($filter);
     $this->rules[] = $rule = new Rule();
     $rule->control = $this->control;
     $rule->validator = function (IControl $control) use($filter) {
         $control->setValue(call_user_func($filter, $control->getValue()));
         return TRUE;
     };
     return $this;
 }
开发者ID:Richmond77,项目名称:learning-nette,代码行数:16,代码来源:Rules.php

示例12: setRowIdentifierCallback

 /**
  * @param string|callable $callback
  * @return self
  */
 public function setRowIdentifierCallback($callback)
 {
     Callback::check($callback);
     $this->rowIdentifierCallback = $callback;
     return $this;
 }
开发者ID:brosland,项目名称:datagrid,代码行数:10,代码来源:Datagrid.php

示例13: setPagination

 public function setPagination($itemsPerPage, $itemsCountCallback = NULL)
 {
     if ($itemsPerPage === FALSE) {
         $this->paginator = NULL;
         $this->paginatorItemsCountCallback = NULL;
     } else {
         if ($itemsCountCallback === NULL) {
             throw new \InvalidArgumentException('Items count callback must be set.');
         }
         Callback::check($itemsCountCallback);
         $this->paginator = new Paginator();
         $this->paginator->itemsPerPage = $itemsPerPage;
         $this->paginatorItemsCountCallback = $itemsCountCallback;
     }
 }
开发者ID:racinmat,项目名称:datagrid,代码行数:15,代码来源:Datagrid.php

示例14: __construct

 /**
  * @param string $caption column's textual caption
  * @param string $format date format supported by $func
  * @param string $func function to format date
  */
 public function __construct($caption = NULL, $format = '%x', $func = 'strftime')
 {
     parent::__construct($caption);
     $this->format = $format;
     $this->func = \Nette\Utils\Callback::check($func);
 }
开发者ID:lohini,项目名称:cf,代码行数:11,代码来源:DateColumn.php

示例15: setFilterFormFactory

 public function setFilterFormFactory($filterFormFactory)
 {
     Callback::check($filterFormFactory);
     $this->filterFormFactory = $filterFormFactory;
 }
开发者ID:joseki,项目名称:datagrid,代码行数:5,代码来源:Datagrid.php


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