• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xcallable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xcallable函数的典型用法代码示例。如果您正苦于以下问题:PHP xcallable函数的具体用法?PHP xcallable怎么用?PHP xcallable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: paint

 /**
  * Paint the element.
  *
  * @param   \Hoa\Stream\IStream\Out  $out    Out stream.
  * @return  void
  */
 public function paint(Stream\IStream\Out $out)
 {
     $root = $this->getAbstractElementSuperRoot();
     $value = $this->computeValue();
     $with = '__main__';
     if (true === $this->abstract->attributeExists('with')) {
         $with = $this->abstract->readAttribute('with');
     }
     $translation = $root->getTranslation($with);
     if (null === $translation) {
         $out->writeAll($value);
         return;
     }
     $callable = null;
     $arguments = [$value];
     if (true === $this->abstract->attributeExists('n')) {
         $callable = xcallable($translation, '_n');
         $arguments[] = $this->abstract->readAttribute('n');
     } else {
         $callable = xcallable($translation, '_');
     }
     $with = $this->abstract->readCustomAttributes('with');
     if (!empty($with)) {
         foreach ($with as $w) {
             $arguments[] = $this->computeAttributeValue($w);
         }
     }
     $result = $callable->distributeArguments($arguments);
     if (false !== strpos($result, '<')) {
         $this->computeFromString($result);
     } else {
         $out->writeAll($result);
     }
     return;
 }
开发者ID:Jir4,项目名称:Xyl,代码行数:41,代码来源:Translate.php


示例2: __construct

 public function __construct($repository)
 {
     $this->_readline = new Hoa\Console\Readline();
     $git = new Hoa\Console\Processus('git log --pretty=\'format:\' --patch --reverse --raw -z', null, null, $repository);
     $git->on('output', xcallable($this, 'output'));
     $git->on('stop', xcallable($this, 'over'));
     $git->run();
 }
开发者ID:shulard,项目名称:Literature,代码行数:8,代码来源:Patcher.php


示例3: render

 public function render()
 {
     $this->renderInternal();
     Cursor::setStyle('▋', true);
     do {
         $this->readline = new Readline();
         $this->readline->addMapping('j', xcallable($this, '_bindJ'));
         $this->readline->addMapping('k', xcallable($this, '_bindK'));
         $line = $this->readline->readLine(' ');
     } while (false !== $line && 'quit' !== $line);
 }
开发者ID:jvelo,项目名称:datatext,代码行数:11,代码来源:NavigableTable.php


示例4: __construct

 /**
  * Start the stream reader/writer as if it is a XML document.
  *
  * @param   \Hoa\Stream\IStream\In  $stream                 Stream to
  *                                                          read/write.
  * @param   bool                    $initializeNamespace    Whether we
  *                                                          initialize
  *                                                          namespaces.
  * @param   mixed                   $entityResolver         Entity resolver.
  * @param   bool                    $autoSave               Whether we
  *                                                          should
  *                                                          auto-save.
  * @return  void
  * @throws  \Hoa\Xml\Exception
  */
 public function __construct(Stream\IStream\In $stream, $initializeNamespace = true, $entityResolver = null, $autoSave = true)
 {
     if (true === $autoSave && !$stream instanceof Stream\IStream\Out) {
         throw new Exception('The stream %s (that has opened %s) must implement ' . '\\Hoa\\Stream\\IStream\\In and \\Hoa\\Stream\\IStream\\Out interfaces.', 0, [get_class($stream), $stream->getStreamName()]);
     }
     parent::__construct('\\Hoa\\Xml\\Element\\ReadWrite', $stream, $initializeNamespace, $entityResolver);
     if (true === $autoSave) {
         event('hoa://Event/Stream/' . $stream->getStreamName() . ':close-before')->attach(xcallable($this, '_close'));
     }
     $this->_autoSave = $autoSave;
     return;
 }
开发者ID:Grummfy,项目名称:Central,代码行数:27,代码来源:ReadWrite.php


示例5: initializeFunctions

 /**
  * Initialize functions mapping.
  *
  * @return void
  */
 protected function initializeFunctions()
 {
     if (sizeof($this->opa_functions) > 0) {
         return;
     }
     $average = function () {
         $arguments = func_get_args();
         return array_sum($arguments) / count($arguments);
     };
     $this->opa_functions = array('abs' => xcallable('abs'), 'ceil' => xcallable('ceil'), 'floor' => xcallable('floor'), 'int' => xcallable('intval'), 'max' => xcallable('max'), 'min' => xcallable('min'), 'rand' => xcallable('rand'), 'round' => xcallable('round'), 'random' => xcallable('rand'), 'current' => xcallable('caIsCurrentDate'), 'future' => xcallable('caDateEndsInFuture'), 'wc' => xcallable('str_word_count'), 'length' => xcallable('strlen'), 'date' => xcallable('caDateToHistoricTimestamp'), 'formatdate' => xcallable('caFormatDate'), 'formatgmdate' => xcallable('caFormatGMDate'), 'sizeof' => xcallable(function () {
         return count(func_get_args());
     }), 'count' => xcallable(function () {
         return count(func_get_args());
     }), 'age' => xcallable('caCalculateAgeInYears'), 'ageyears' => xcallable('caCalculateAgeInYears'), 'agedays' => xcallable('caCalculateAgeInDays'), 'avgdays' => xcallable('caCalculateDateRangeAvgInDays'), 'average' => xcallable($average), 'avg' => xcallable($average), 'sum' => xcallable(function () {
         return array_sum(func_get_args());
     }));
     return;
 }
开发者ID:samrahman,项目名称:providence,代码行数:23,代码来源:ExpressionVisitor.php


示例6: resolve

 public function resolve($value)
 {
     if (self::STATE_PENDING !== $this->_state) {
         throw new Exception('This promise is not pending, cannot resolve it.', 0);
     }
     try {
         if ($value instanceof self) {
             $value->then(xcallable($this, 'resolve'), xcallable($this, 'reject'));
             return;
         }
         $this->setValue($value);
         $this->_state = self::STATE_FULFILLED;
         if (null === $this->_deferred) {
             return;
         }
         $this->handle($this->_deferred);
     } catch (\Exception $e) {
         $this->reject($e);
     }
     return;
 }
开发者ID:shulard,项目名称:Promise,代码行数:21,代码来源:Promise.php


示例7: case_callable_xcallable

 public function case_callable_xcallable()
 {
     $this->given($context = new CUT(), $context['foo'] = xcallable($this, 'fakeCallable'))->when($result = $context['foo'])->then->boolean($result)->isTrue();
 }
开发者ID:djuptho,项目名称:Ruler,代码行数:4,代码来源:Context.php


示例8: __construct

 /**
  * Start the stream reader/writer as if it is a XML document.
  *
  * @param   \Hoa\Stream\IStream\Out  $stream                 Stream to
  *                                                           read/write.
  * @param   bool                     $initializeNamespace    Whether we
  *                                                           initialize
  *                                                           namespaces.
  * @param   mixed                    $entityResolver         Entity resolver.
  * @return  void
  */
 public function __construct(Stream\IStream\Out $stream, $initializeNamespace = true, $entityResolver = null)
 {
     parent::__construct('\\Hoa\\Xml\\Element\\Write', $stream, $initializeNamespace, $entityResolver);
     event('hoa://Event/Stream/' . $stream->getStreamName() . ':close-before')->attach(xcallable($this, '_close'));
     return;
 }
开发者ID:Grummfy,项目名称:Central,代码行数:17,代码来源:Write.php


示例9: newBuffer

 /**
  * Start a new buffer.
  * The callable acts like a filter.
  *
  * @param   mixed   $callable    Callable.
  * @param   int     $size        Size.
  * @return  int
  */
 public function newBuffer($callable = null, $size = null)
 {
     $last = current(self::$_stack);
     $hash = $this->getHash();
     if (false === $last || $hash != $last[0]) {
         self::$_stack[] = [0 => $hash, 1 => 1];
     } else {
         ++self::$_stack[key(self::$_stack)][1];
     }
     end(self::$_stack);
     if (null === $callable) {
         ob_start();
     } else {
         ob_start(xcallable($callable), null === $size ? 0 : $size);
     }
     return $this->getBufferLevel();
 }
开发者ID:robertgeb,项目名称:Map-Project,代码行数:25,代码来源:Response.php


示例10: filter

 /**
  * Add a filter.
  * Used in the self::getStatistic() method, no in iterator.
  * A filter is a callable that will receive 3 values about a mark: ID, time
  * result, and time pourcent. The callable must return a boolean.
  *
  * @param   mixed  $callable    Callable.
  * @return  void
  */
 public function filter($callable)
 {
     $this->_filters[] = xcallable($callable);
     return $this;
 }
开发者ID:shulard,项目名称:Bench,代码行数:14,代码来源:Bench.php


示例11: invoke

 /**
  * Invoke.
  *
  * @acccess  protected
  * @param    \Hoa\Core\Consistency\Xcallable    &$reflection       Callable.
  * @param    \ReflectionFunctionAbstract        &$reflection       Reflection.
  * @param    array                              &$arguments        Arguments.
  * @param    bool                                $isConstructor    Whether
  *                                                                 it is a
  *                                                                 constructor.
  * @return   mixed
  * @throws   \Exception
  */
 protected function invoke(Core\Consistency\Xcallable &$callable, \ReflectionFunctionAbstract &$reflection, array &$arguments, $isConstructor)
 {
     if ($reflection instanceof \ReflectionFunction) {
         return $reflection->invokeArgs($arguments);
     }
     if (false === $isConstructor) {
         $_callback = $callable->getValidCallback();
         $_object = $_callback[0];
         return $reflection->invokeArgs($_object, $arguments);
     }
     $class = $reflection->getDeclaringClass();
     $instance = $class->newInstanceArgs($arguments);
     $callable = xcallable($instance, '__construct');
     $reflection = $callable->getReflection();
     return void;
 }
开发者ID:Grummfy,项目名称:Central,代码行数:29,代码来源:Runtime.php


示例12: getStarOperator

 /**
  * Return a "*" or "catch all" operator.
  *
  * @param Visitor\Element $element The node representing the operator.
  *
  * @return \Hoa\Core\Consistency\Xcallable
  */
 protected function getStarOperator(AST\Operator $element)
 {
     return xcallable(function () use($element) {
         return sprintf('%s(%s)', $element->getName(), implode(', ', func_get_args()));
     });
 }
开发者ID:royopa,项目名称:rulerz,代码行数:13,代码来源:SqlVisitor.php


示例13: setOperator

 /**
  * Set an operator.
  *
  * @param string   $operator    Operator.
  * @param callable $transformer Callable.
  *
  * @return self
  */
 public function setOperator($operator, callable $transformer)
 {
     $this->operators[$operator] = xcallable($transformer);
     return $this;
 }
开发者ID:royopa,项目名称:rulerz,代码行数:13,代码来源:GenericVisitor.php


示例14: initWebSocketServer

 /**
  * Initialize WebSocket server
  *
  * @return Hoa\Websocket\Server
  */
 public function initWebSocketServer()
 {
     $webSocketServer = $this->getWebSocketServer();
     $webSocketServer->setLogger($this->getLogger());
     if ($this->getNodeClass() !== null) {
         $webSocketServer->getConnection()->setNodeName($this->getNodeClass());
     }
     $socket = $webSocketServer->getConnection()->getSocket();
     $this->getLogger()->log('<fg=yellow>Starting server...</fg=yellow>');
     $this->getLogger()->log('Environment: <fg=green>%s</fg=green>', $this->kernelEnvironment);
     $this->getLogger()->log('Class used:');
     $this->getLogger()->log('  Logger           : %s', get_class($this->getLogger()));
     $this->getLogger()->log('  Runner           : %s', get_class($this));
     $this->getLogger()->log('  WebSocket Server : %s', get_class($webSocketServer));
     $this->getLogger()->log('  Socket Server    : %s', get_class($socket));
     $this->getLogger()->log('  Node             : %s', ltrim($webSocketServer->getConnection()->getNodeName(), '\\'));
     $this->getLogger()->log('<fg=yellow>Listening on %s:%d</fg=yellow>', $socket->getAddress(), $socket->getPort());
     $webSocketServer->on('open', xcallable($this, 'onOpen'));
     $webSocketServer->on('message', xcallable($this, 'onMessage'));
     $webSocketServer->on('binary-message', xcallable($this, 'onBinaryMessage'));
     $webSocketServer->on('ping', xcallable($this, 'onPing'));
     $webSocketServer->on('error', xcallable($this, 'onError'));
     $webSocketServer->on('close', xcallable($this, 'onClose'));
     $this->loadEvents();
     return $webSocketServer;
 }
开发者ID:atipik,项目名称:hoa-websocket-bundle,代码行数:31,代码来源:Runner.php


示例15: detach

 /**
  * Detach an object to an event.
  * Please see $this->attach() method.
  *
  * @param   mixed   $callable    Callable.
  * @return  \Hoa\Event\Event
  */
 public function detach($callable)
 {
     unset($this->_callable[xcallable($callable)->getHash()]);
     return $this;
 }
开发者ID:robertgeb,项目名称:Map-Project,代码行数:12,代码来源:Event.php


示例16: formatValue

 /**
  * Format an attribute value.
  * Formatter is of the form:
  *     @attr-formatter="functionName"
  * Arguments of functionName are declared as:
  *     @attr-formatter-argumentName="argumentValue"
  *
  *
  * @param   string     $value    Value.
  * @param   string     $name     Name.
  * @return  string
  */
 protected function formatValue($value, $name = null)
 {
     $_formatter = $name . 'formatter';
     $formatter = $this->abstract->readAttribute($_formatter);
     $arguments = $this->abstract->readCustomAttributes($_formatter);
     foreach ($arguments as &$argument) {
         $argument = $this->_formatValue($this->computeAttributeValue($argument));
     }
     $reflection = xcallable($formatter)->getReflection();
     $distribution = [];
     $placeholder = $this->_formatValue($value);
     foreach ($reflection->getParameters() as $parameter) {
         $name = strtolower($parameter->getName());
         if (true === array_key_exists($name, $arguments)) {
             $distribution[$name] = $arguments[$name];
             continue;
         } elseif (null !== $placeholder) {
             $distribution[$name] = $placeholder;
             $placeholder = null;
         }
     }
     if ($reflection instanceof \ReflectionMethod) {
         $value = $reflection->invokeArgs(null, $distribution);
     } else {
         $value = $reflection->invokeArgs($distribution);
     }
     return $value;
 }
开发者ID:Jir4,项目名称:Xyl,代码行数:40,代码来源:Concrete.php


示例17: run

 /**
  * This method starts the ec2dns eventloop
  *
  * @return void
  */
 function run()
 {
     try {
         $this->dns->on('query', xcallable($this, 'onQueryCallback'));
         $this->dns->run();
     } catch (\Hoa\Socket\Exception $e) {
         throw new \InvalidArgumentException($e->getMessage());
     }
 }
开发者ID:fruux,项目名称:ec2dns,代码行数:14,代码来源:ec2dns.php


示例18: getInstance

 /**
  * Get a memoization (multiton).
  *
  * @param   mixed   $callable    Callable.
  * @return  \Hoa\Cache\Memoize
  */
 public static function getInstance($callable)
 {
     $callable = xcallable($callable);
     $hash = $callable->getHash();
     if (!isset(self::$_multiton[$hash])) {
         self::$_multiton[$hash] = new static();
         self::$_multiton[$hash]->_callable = $callable;
     }
     return self::$_multiton[$hash];
 }
开发者ID:Grummfy,项目名称:Central,代码行数:16,代码来源:Memoize.php


示例19: detach

 /**
  * Detach a callable from a listenable component.
  *
  * @param   string  $listenerId    Listener ID.
  * @param   mixed   $callable      Callable.
  * @return  \Hoa\Event\Listener
  */
 public function detach($listenerId, $callable)
 {
     unset($this->_callables[$listenerId][xcallable($callable)->getHash()]);
     return $this;
 }
开发者ID:Hywan,项目名称:Event,代码行数:12,代码来源:Listener.php


示例20: __construct

 /**
  * Initialize the readline editor.
  *
  * @access  public
  * @return  void
  */
 public function __construct()
 {
     if (OS_WIN) {
         return;
     }
     $this->_mapping["[A"] = xcallable($this, '_bindArrowUp');
     $this->_mapping["[B"] = xcallable($this, '_bindArrowDown');
     $this->_mapping["[C"] = xcallable($this, '_bindArrowRight');
     $this->_mapping["[D"] = xcallable($this, '_bindArrowLeft');
     $this->_mapping[""] = xcallable($this, '_bindControlA');
     $this->_mapping[""] = xcallable($this, '_bindControlB');
     $this->_mapping[""] = xcallable($this, '_bindControlE');
     $this->_mapping[""] = xcallable($this, '_bindControlF');
     $this->_mapping[""] = $this->_mapping[""] = xcallable($this, '_bindBackspace');
     $this->_mapping[""] = xcallable($this, '_bindControlW');
     $this->_mapping["\n"] = xcallable($this, '_bindNewline');
     $this->_mapping["\t"] = xcallable($this, '_bindTab');
     return;
 }
开发者ID:alexpw,项目名称:Console,代码行数:25,代码来源:Readline.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xchan_query函数代码示例发布时间:2022-05-23
下一篇:
PHP xcache_unset_by_prefix函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap