friendica-addons/advancedcontentfilter/vendor/slim/slim/Slim/DeferredCallable.php
Hypolite Petovan 20862be7d0 [advancedcontentfilter] Add Composer dependencies
- slim/slim: ^3.1
- symfony/expression-language: ^3.4
- fxp/composer-asset-plugin: ~1.3
- bower-asset/vue: ^2.5
- bower-asset/vue-resource: ^1.5
2018-04-16 22:11:51 -04:00

46 lines
1.1 KiB
PHP

<?php
/**
* Slim Framework (https://slimframework.com)
*
* @link https://github.com/slimphp/Slim
* @copyright Copyright (c) 2011-2017 Josh Lockhart
* @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License)
*/
namespace Slim;
use Closure;
use Psr\Container\ContainerInterface;
class DeferredCallable
{
use CallableResolverAwareTrait;
private $callable;
/** @var ContainerInterface */
private $container;
/**
* DeferredMiddleware constructor.
* @param callable|string $callable
* @param ContainerInterface $container
*/
public function __construct($callable, ContainerInterface $container = null)
{
$this->callable = $callable;
$this->container = $container;
}
public function __invoke()
{
$callable = $this->resolveCallable($this->callable);
if ($callable instanceof Closure) {
$callable = $callable->bindTo($this->container);
}
$args = func_get_args();
return call_user_func_array($callable, $args);
}
}