Bind a callback to the "help" route.
@param  callable $callback The callback to be binded to the route. If omitted triggers the callback.
507365
public static function help(callable $callback = null){
        $callback
          ? is_callable($callback) && static::$help = $callback
          : static::$help && call_user_func(static::$help);
    }
1193242
public function extract(callable $callback = null)
    {
        $this->response = Di::getDefault()->get('response');

        if ($callback === null) {
            $this->response->setContent(json_encode($this->result->toArray()));
        }

        else {
            $this->response->setContent($callback(
                json_encode($this->result->toArray())
            ));
        }

        $this->response->send();

    }
250231
public function setUserCallback (callable $callback)
	{
		//$this->usercallback = $callback;

		if (count ($this->usercallback) > 0)
			throw new InvalidParameter ("A usercallback was already set. Use addUserCallback to add multiple callbacks");

		$this->addUserCallback ('default', $callback);

		return $this;
	}
299750
public function maybe(Closure $callback) {
        $predicate = new Predicate(self::MAYBE);
        $predicate->bindCallback($callback);

        $this->_params[] = $predicate;

        $this->addBinding(null, $predicate);

        return $this;
    }
1219251
public function map($callback)
    {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException('Callback has to be a valid callable, '.gettype($callback).' given.');
        }

        for ($i = 0; $this->checkIfLineNumberIsValid($i, false); $i++) {
            $this->setCurrentLineNumber($i);
            call_user_func($callback, $this->getLine($i), $i, $this);
        }
    }
1253531
public function callback(Closure $callback)
    {
        foreach ($this->getInnerIterator() as $key => $value) {
            yield $callback($value, $key);
        }
    }
1131193
public function notice(callable $callback)
    {
        $this->registerError(E_DEPRECATED, $callback);
        $this->registerError(E_USER_DEPRECATED, $callback);
        $this->registerError(E_NOTICE, $callback);
        $this->registerError(E_USER_NOTICE, $callback);
    }
719209
public function alias(callable $callback)
    {
        $fqn = $this->function_name->fullyQualifiedName();
        \Patchwork\redefine($fqn, $callback);
        $this->assertRedefined($fqn);
    }
631369
public function changeHeaders(callable $callback): void
    {
        foreach ($this->headers as $name => $value) {
            $this->headers[$name] = call_user_func($callback, $name, $value);
        }
    }
580643
public function setCallback($callback)
    {
        if (!$callback instanceof Closure) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid parameter for callback: must be %s',
                Closure::class
            ));
        }

        return parent::setCallback($callback);
    }
1136699
public function bind(string $event, callable $callback) {
        // We can't bind to something that isn't callable
        if (!is_callable($callback)) {
            return false;
        }

        if (!isset($this->bindings[$event]) || !is_array($this->bindings[$event])) {
            $this->bindings[$event] = [];
        }

        // Check if this event is already registered
        $signature = $this->hash($callback);
        if (array_key_exists($signature, $this->bindings[$event])) {
            return $signature;
        }

        $this->bindings[$event][$signature] = $callback;
        return $signature;
    }
126743
public function addCallback($concrete, callable $callback)
    {
        //Strip all leading backslashes
        if ($concrete[0] === '\\') {
            $concrete = substr($concrete, 1);
        }

        if (!isset($this->callbacks[$concrete])) {
            $this->callbacks[$concrete] = [];
        }
        $this->callbacks[$concrete][] = $callback;
    }
114474
public function setApiCallback($callback)
    {

        if (empty($callback)) {
            $this->apiResponseCallback = false;
            return;
        }

        if (!is_callable($callback)) {
            throw new \Exception('Callback should be a function or false.');
        }

        $this->apiResponseCallback = $callback;
    }
751931
public function each(callable $callback)
    {
        foreach ($this->items as $key => $item) {
            $result = $callback($item, $key);

            if (false === $result) {
                break;
            }

            if (!is_object($item)) {
                $this->items[$key] = $result;
            }
        }

        return $this;
    }
248693
public function call(Closure $callback = null, $caller = null)
    {
        if ($callback instanceof Closure) {
            // Make dependency injection possible
            $parameters = $this->resolveMethodDependencies(
                [$caller], new ReflectionFunction($callback)
            );
            call_user_func_array($callback, $parameters);
        }

        return $caller;
    }
765471
public function control(callable $callback, $context = null)
    {
        $this->control = $callback;
        $this->controlContext = $context;

        return $this;
    }
1290622
public function each(callable $callback)
    {
        $array = $this->getArrayCopy();
        foreach ($array as $key => $value) {
            $callback($value, $key, $array);
        }
    }