Binds the callable function and executes it by its id

@param string   $id       The callable function id
@param callable $callback The callable function
484322
public function extend($id, callable $callback)
    {
        if (is_callable($callback) || method_exists($callback, '__invoke')) {
            $this->callables[$id] = $callback;
        }
    }
937851
public function bind($id, callable $serviceGenerator)
    {
        $this->callables[(string)$id] = function ($zit) use ($serviceGenerator) {
            static $object;

            if (null === $object) {
                $object = $serviceGenerator($zit);
            }

            return $object;
        };
    }
1083178
public function on(string $eventIdentifier, \Closure $callback): void
    {
        $this->eventCallbacks[$eventIdentifier][] = $callback;
    }
921190
protected function attachEvent(EventManagerInterface $events, $id, $event, $callback)
    {
        /** @var \Zend\EventManager\SharedEventManager $sharedEvents */
        $sharedEvents = $events->getSharedManager();

        $this->listeners[] = $sharedEvents->attach($id, $event, array($this, $callback), 100);
    }
596315
protected function executeCallback($callback, $args)
    {
        if (is_string($callback)) {
            return $this->callStringCallback($callback, $args);
        } elseif ($callback instanceof Closure) {
            return call_user_func_array($callback, $args);
        }

        return '';
    }
393917
public function bindCallback(Closure $callback, $query = null) {
        call_user_func_array($callback, [$this, $query]);

        return $this;
    }
215649
protected function bindOriginalRow(Closure $callback, $key)
    {
        $originalRow = static::$originalGridData[$key];

        return $callback->bindTo(static::$model->newFromBuilder($originalRow));
    }
385533
public function registerCallback(EventCallbackInterface $callback)
    {
        if (!in_array($callback, $this->callbacks)) {
            $this->callbacks[] = $callback;
        }
    }
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);
    }
370864
public final function hook($hookId, callable $callback = null)
	{
		if (null === $callback) {
			//触发
			if (isset($this->hooks[$hookId])) {
				return ($this->hooks[$hookId])($this);
			}
		} else {
			//绑定
			$id = 1;
			while ($hookId > 0) {
				if ($hookId & 1 == 1) {
					$this->hooks[$id] = $callback;
				}
				$id *= 2;
				$hookId >>= 1;
			}
		}
	}
569868
public function register(string $id, callable $callback): self
    {
        Internal\Data\Addons::$registrations[$id] = $callback;
        return $this;
    }
627658
public function bind(string $name, callable $callback): self
    {
        $this->bindings[$name] = $callback;
        return $this;
    }
507365
public static function help(callable $callback = null){
        $callback
          ? is_callable($callback) && static::$help = $callback
          : static::$help && call_user_func(static::$help);
    }
251989
public function setCallable(string $id, callable $callable, bool $multi = false, array $arguments = []): self
    {
        return $this->set($id, new Definition\Callable_($callable, $arguments), $multi);
    }
422861
public function setEditableCallback($callback)
    {
        $this->isEditable() ?: $this->setEditable();
        $this->editableCallback = $callback;

        return $this;
    }
1082599
public function bind($event, callable $handler)
    {
        if (in_array($event, [self::EVENT_INIT, self::EVENT_FORK, self::EVENT_START])) {
            throw new InvalidArgumentException('You can not bind a callback for this event');
        }

        parent::bind($event, $handler);
    }
497338
public function setCallbackUrl($id, $url)
    {
        return $this->put($this->getPath().'/'.rawurlencode($id).'/callbackUrl', array('value' => $url));
    }