本文整理汇总了PHP中Closure::__invoke方法的典型用法代码示例。如果您正苦于以下问题:PHP Closure::__invoke方法的具体用法?PHP Closure::__invoke怎么用?PHP Closure::__invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Closure
的用法示例。
在下文中一共展示了Closure::__invoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: entityManager
public static final function entityManager()
{
if (self::$entityManager === null) {
self::$entityManager = self::$entityManagerFactory->__invoke();
}
return self::$entityManager;
}
示例2: __invoke
/**
* {@inheritdoc}
*/
public function __invoke($input, $index)
{
/** @noinspection PhpMethodParametersCountMismatchInspection */
/** @noinspection PhpMethodParametersCountMismatchInspection */
/** @noinspection PhpVoidFunctionResultUsedInspection */
return $this->function->__invoke($input, $index);
}
示例3: evaluate
/**
* Evaluates the underyling closure and returns its result.
*
* The given Options instance is passed to the closure as first argument.
* The previous default value set in the constructor is passed as second
* argument.
*
* @param Options $options The container with all concrete options.
*
* @return mixed The result of the closure.
*/
public function evaluate(Options $options)
{
if ($this->previousValue instanceof self) {
$this->previousValue = $this->previousValue->evaluate($options);
}
return $this->closure->__invoke($options, $this->previousValue);
}
示例4: _activateDependency
/**
* Activate the dependency and set it in the object.
*
* @return object The real dependency object
* @api
*/
public function _activateDependency()
{
$realDependency = $this->builder->__invoke();
foreach ($this->propertyVariables as &$propertyVariable) {
$propertyVariable = $realDependency;
}
return $realDependency;
}
示例5: process
/**
* @inheritdoc
*/
public function process()
{
if ($this->processType == self::PROCESS_TYPE_CLOSURE) {
return $this->process->__invoke($this->getParent());
} elseif ($this->processType == self::PROCESS_TYPE_CALLABLE) {
return call_user_func($this->process, $this->getParent());
}
return true;
}
示例6: isAllowed
/**
* {@inheritDoc}
*/
public function isAllowed($resource, $privilege = null, $role = null)
{
$this->loaded && $this->loaded->__invoke();
try {
return $this->acl->isAllowed($role ?: $this->identity, $resource, $privilege);
} catch (InvalidArgumentException $e) {
return false;
}
}
示例7: log
/**
* @param string $msg
* @param bool $writeln
*/
public function log($msg, $writeln = true)
{
$prefixed = '';
foreach ($this->logPrefixes as $prefix) {
$prefixed .= $prefixed ? ' ' . $prefix : $prefix;
}
$msg = $prefixed ? $prefixed . ' ' . $msg : $msg;
$this->logger->__invoke($msg, $writeln);
}
示例8: valid
public function valid()
{
if (count($this->batch) < 1) {
$this->batch = $this->provider->__invoke($this->key, $this->batch_size);
if ($this->batch && $this->batch instanceof \Traversable) {
$this->batch = iterator_to_array($this->batch);
}
}
return count($this->batch) > 0;
}
示例9: invoke
/**
* Invokes the advice method
*
* @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint The current join point which is passed to the advice method
* @return mixed Result of the advice method
*/
public function invoke(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
{
if ($this->runtimeEvaluator !== null && $this->runtimeEvaluator->__invoke($joinPoint, $this->objectManager) === false) {
return;
}
$adviceObject = $this->objectManager->get($this->aspectObjectName);
$methodName = $this->adviceMethodName;
$adviceObject->{$methodName}($joinPoint);
$this->emitAdviceInvoked($adviceObject, $methodName, $joinPoint);
}
示例10: isValid
/** @inheritdoc */
public function isValid($value)
{
$this->lastValidated = $value;
try {
if (isset($this->customValidateMethod)) {
$this->customValidateMethod->__invoke($this->objectName, $value);
}
return $this->validateValue($value);
} catch (\Exception $e) {
$this->error = $e->getMessage();
return false;
}
}
示例11: triggerRedirectIfApplicable
/**
* Searches for an applicable redirection record in the $redirectionRepository and sends redirect headers if one was found
*
* @param HttpRequest $request
* @return void
* @api
*/
public function triggerRedirectIfApplicable(HttpRequest $request)
{
try {
$redirection = $this->redirectionRepository->findOneByRequest($request);
} catch (\Exception $exception) {
// skip triggering the redirect if there was an error accessing the database (wrong credentials, ...)
return;
}
if ($redirection === NULL) {
return;
}
$this->sendRedirectHeaders($request, $redirection);
$this->exit->__invoke();
}
示例12: getCell
/**
* @return Html
*/
public function getCell()
{
if ($this->cell === NULL) {
$this->cell = $this->cellFactory->__invoke();
}
return $this->cell;
}
示例13: getHandler
/**
* @return \Closure|string
*/
public function getHandler($invoke = \true)
{
if ($invoke === \true && $this->handler instanceof \Closure) {
return $this->handler->__invoke();
}
return $this->handler;
}
示例14: myCapture
function myCapture(Closure $closure)
{
ob_start();
$closure->__invoke();
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
示例15: getExportName
public function getExportName(Option $option)
{
if ($option->isUnnamed) {
return $this->unnamedMapper->__invoke($option->name);
} else {
return $this->namedMapper->__invoke($option->name);
}
}