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


PHP Callback::invokeArgs方法代码示例

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


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

示例1: getBodyContent

 public function getBodyContent($data)
 {
     if (array_key_exists(self::CALLBACK, $this->option) === FALSE) {
         if (isset($data[$this->option[self::ID]]) === FALSE && is_null($data[$this->option[self::ID]]) === FALSE) {
             throw new Grid_Exception('Column ' . $this->option[self::ID] . ' does not exists in DataSource.');
         }
         $src = $data[$this->option[self::ID]];
     } else {
         $args = array($data);
         if (isset($this->option[self::CALLBACK_ARGS])) {
             if (!is_array($this->option[self::CALLBACK_ARGS])) {
                 throw new Grid_Exception(__CLASS__ . '::CALLBACK_ARGS must be an array. ' . gettype($this->option[self::CALLBACK_ARGS]) . ' given.');
             }
             $args = array_merge($args, $this->option[self::CALLBACK_ARGS]);
         }
         $src = Callback::invokeArgs($this->option[self::CALLBACK], $args);
     }
     $img = Html::el('img', array('src' => $src));
     if (isset($this->option[self::MAX_WIDTH]) === TRUE) {
         $img->style('max-width:' . $this->fixPixels($this->option[self::MAX_WIDTH]), TRUE);
     }
     if (isset($this->option[self::MAX_HEIGHT]) === TRUE) {
         $img->style('max-height:' . $this->fixPixels($this->option[self::MAX_HEIGHT]), TRUE);
     }
     return $img;
 }
开发者ID:mesour,项目名称:datagrid,代码行数:26,代码来源:Image.php

示例2: filter

 /**
  * Filter data
  * @param array $filters
  * @return static
  */
 public function filter(array $filters)
 {
     foreach ($filters as $filter) {
         if ($filter->isValueSet()) {
             if ($filter->hasConditionCallback()) {
                 Callback::invokeArgs($filter->getConditionCallback(), [$this->data_source, $filter->getValue()]);
             } else {
                 if ($filter instanceof Filter\FilterText) {
                     $this->applyFilterText($filter);
                 } else {
                     if ($filter instanceof Filter\FilterMultiSelect) {
                         $this->applyFilterMultiSelect($filter);
                     } else {
                         if ($filter instanceof Filter\FilterSelect) {
                             $this->applyFilterSelect($filter);
                         } else {
                             if ($filter instanceof Filter\FilterDate) {
                                 $this->applyFilterDate($filter);
                             } else {
                                 if ($filter instanceof Filter\FilterDateRange) {
                                     $this->applyFilterDateRange($filter);
                                 } else {
                                     if ($filter instanceof Filter\FilterRange) {
                                         $this->applyFilterRange($filter);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $this;
 }
开发者ID:ublaboo,项目名称:datagrid,代码行数:40,代码来源:FilterableDataSource.php

示例3: formatValue

 public function formatValue($row)
 {
     if ($this->callback) {
         return Callback::invokeArgs($this->callback, [$row, $this]);
     }
     return $this->getChainedValue($row);
 }
开发者ID:joseki,项目名称:datagrid,代码行数:7,代码来源:TextColumn.php

示例4: dispatch

 /**
  * @param AbstractRequest $request
  * @return AbstractResponse
  * @throws DispatcherException
  */
 public function dispatch(AbstractRequest $request)
 {
     switch ($request->getType()) {
         case AbstractRequest::TYPE_CONFIRM:
             if (!$this->confirmCallback) {
                 throw new DispatcherException("Dispatcher: Confirm callback is not defined.");
             }
             $res = Callback::invokeArgs($this->confirmCallback, [$request, $this->prepareConfirmResponse()]);
             if (!$res instanceof ConfirmResponse) {
                 throw new DispatcherException('Return value from callback is not ConfirmResponse type.');
             }
             return $res;
         case AbstractRequest::TYPE_SMS:
             if (!$this->smsCallback) {
                 throw new DispatcherException("Dispatcher: Info callback is not defined.");
             }
             $res = Callback::invokeArgs($this->smsCallback, [$request, $this->prepareResponse()]);
             if (!$res instanceof Response) {
                 throw new DispatcherException('Return value from callback is not Response type.');
             }
             return $res;
         default:
             throw new DispatcherException("Dispatcher: Uknown request type.");
     }
 }
开发者ID:minetro,项目名称:mobilni-platby,代码行数:30,代码来源:CallbackDispatcher.php

示例5: getValue

 /**
  * @param mixin $row
  * @return mixin
  */
 public function getValue($row)
 {
     if ($this->valueCallback === NULL) {
         return is_array($row) ? $row[$this->name] : $row->{$this->name};
     }
     return Callback::invokeArgs($this->valueCallback, [$row]);
 }
开发者ID:brosland,项目名称:datagrid,代码行数:11,代码来源:Column.php

示例6: fetchObject

 /**
  * @param \Venne\DataTransfer\DataTransferQuery $query
  * @return \Venne\DataTransfer\DataTransferObject
  */
 public function fetchObject(DataTransferQuery $query)
 {
     $class = '\\' . trim($query->getClass(), '\\');
     $values = $query->getValues();
     if (!class_exists($class)) {
         throw new InvalidArgumentException(sprintf('Class \'%s\' does not exist.', $class));
     }
     if (!is_subclass_of($class, 'Venne\\DataTransfer\\DataTransferObject')) {
         throw new InvalidArgumentException(sprintf('Class \'%s\' must inherit from \'Venne\\DataTransfer\\DataTransferObject\'.', $class));
     }
     if (!$query->isCacheEnabled()) {
         return new $class(function () use(&$values, $class) {
             $values = is_callable($values) ? Callback::invokeArgs($values) : $values;
             return $this->driver->getValuesByObject($values, $class::getKeys());
         });
     }
     $cacheDependencies = $query->getCacheDependencies();
     $primaryKeysCacheKey = $this->formatPrimaryKeysCacheKey($class, $query->getCacheKey());
     $primaryKey = $this->cache->load($primaryKeysCacheKey, function (&$dependencies) use(&$values, &$cacheDependencies) {
         $values = is_callable($values) ? Callback::invoke($values) : $values;
         $dependencies = Arrays::mergeTree((array) $cacheDependencies, $this->driver->getCacheDependenciesByObject($values));
         return $this->driver->getPrimaryKeyByObject($values);
     });
     $loadedValues = $this->cache->load(array($this->formatValuesCacheKey($class, $primaryKey), $primaryKeysCacheKey), function (&$dependencies) use(&$values, &$cacheDependencies, $class) {
         $values = is_callable($values) ? Callback::invoke($values) : $values;
         $dependencies = Arrays::mergeTree((array) $cacheDependencies, $this->driver->getCacheDependenciesByObject($values));
         /** @var DataTransferObject $dto */
         $dto = new $class($this->driver->getValuesByObject($values, $class::getKeys()));
         return $dto->toArray();
     });
     return new $class($loadedValues, true);
 }
开发者ID:venne,项目名称:data-transfer,代码行数:36,代码来源:DataTransferManager.php

示例7: handleAutocomplete

 public function handleAutocomplete($q)
 {
     if (!$this->callback) {
         throw new Nette\InvalidStateException('Undefined Typehad callback.');
     }
     $this->getPresenter()->sendJson(Nette\Utils\Callback::invokeArgs($this->callback, [$q]));
 }
开发者ID:nextras,项目名称:forms,代码行数:7,代码来源:Typeahead.php

示例8: createRouter

 /**
  * @param string $mask example images/<format>/<month>/<image>
  * @param IImageCallback $presenterCallback
  * @return Route
  */
 public static function createRouter($mask, IImageCallback $presenterCallback)
 {
     $filterIn = function ($params) {
         if ($params['presenter'] != 'Nette:Micro' || !isset($params['image']) || !isset($params['format'])) {
             return NULL;
         }
         return $params;
     };
     $filterOut = function ($params) use($mask) {
         if ($params['presenter'] != 'Nette:Micro' || !isset($params['image']) || !isset($params['format'])) {
             return NULL;
         }
         if ($params['image'] instanceof IFile) {
             $image = $params['image'];
             /* @var $file IFile */
             $params['image'] = $image->getName() . '.' . $image->getExt();
             if (preg_match('/<month>/', $mask)) {
                 $params['month'] = $image->getUploaded()->format('Ym');
             }
         }
         if ($params['format'] instanceof IImageFormat) {
             $params['format'] = $params['format']->getName();
         }
         return $params;
     };
     $callback = function ($image, $format) use($presenterCallback) {
         return \Nette\Utils\Callback::invokeArgs($presenterCallback, [$image, $format]);
     };
     $route = new Route($mask, [Route::PRESENTER_KEY => 'Nette:Micro', 'callback' => $callback, NULL => [Route::FILTER_IN => $filterIn, Route::FILTER_OUT => $filterOut]]);
     return $route;
 }
开发者ID:brosland,项目名称:media,代码行数:36,代码来源:ImageRouterFactory.php

示例9: __call

 public function __call($name, $args)
 {
     if (isset($this->methods[strtolower($name)])) {
         return Callback::invokeArgs($this->methods[strtolower($name)], $args);
     } else {
         return parent::__call($name, $args);
     }
 }
开发者ID:JanTvrdik,项目名称:nextras-orm,代码行数:8,代码来源:TestMapper.php

示例10: getLink

 /**
  * Returns final link for button or null.
  *
  * @param $row
  *
  * @return string|null
  */
 public function getLink($row)
 {
     if (!empty($this->linkCallback)) {
         return Callback::invokeArgs($this->linkCallback, [$row]);
     } else {
         return null;
     }
 }
开发者ID:janlavicka,项目名称:datagrid,代码行数:15,代码来源:Action.php

示例11: __call

 /**
  * Allows calling $column->icon() instead of $column->setIcon (Same for title, class, ...)
  * @param  string $name
  * @param  array  $args
  * @return mixed
  */
 public function __call($name, $args)
 {
     $method_setter = 'set' . ucfirst($name);
     if (method_exists($this, $method_setter)) {
         return Nette\Utils\Callback::invokeArgs([$this, $method_setter], $args);
     }
     parent::__call($name, $args);
 }
开发者ID:JakubKontra,项目名称:datagrid,代码行数:14,代码来源:Object.php

示例12: handleRemote

 /**
  * @param $params
  * @throws \Nette\InvalidStateException
  */
 public function handleRemote($params)
 {
     if (!is_callable($this->remote)) {
         throw new Nette\InvalidStateException('Undefined Typehad callback.');
     }
     $q = array_key_exists('q', $params) ? $params['q'] : NULL;
     // call remote function with displayed key and query
     $this->presenter->sendJson(Nette\Utils\Callback::invokeArgs($this->remote, [$this->display, $q]));
 }
开发者ID:vojtys,项目名称:typeahead,代码行数:13,代码来源:TypeaheadInput.php

示例13: getCount

 public function getCount($filter, $order)
 {
     if (!isset($this->limit)) {
         throw new InvalidStateException('Property limit must be set.');
     }
     if (!isset($this->offset)) {
         throw new InvalidStateException('Property offset must be set.');
     }
     $selection = Callback::invokeArgs($this->callback, [$filter, $order]);
     return $selection->count();
 }
开发者ID:janlavicka,项目名称:datagrid,代码行数:11,代码来源:NDAdapter.php

示例14: formatValue

 public function formatValue($row)
 {
     if ($this->callback) {
         return Callback::invokeArgs($this->callback, [$row, $this]);
     }
     $value = $this->getChainedValue($row);
     if (!is_numeric($value)) {
         $type = is_object($value) ? get_class($value) : gettype($value);
         throw new InvalidTypeException("Expected numeric value, but  '{$type}' given from '{$this->getName()}'");
     }
     return number_format($value, $this->precision, $this->decimalSeparator, $this->thousandSeparator);
 }
开发者ID:joseki,项目名称:datagrid,代码行数:12,代码来源:NumericColumn.php

示例15: 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


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