call an callback array

@param array		$callbacks
@param array		$params
@param bool		$pass
@retrun array
335339
protected static function call( $callbacks, $params, $pass = false ) {
		
		$response = array();
		
		if ( $pass ) {
			$response = $params;
		}
		
		foreach ( $callbacks as $callback ) {
			if ( $pass ) {
				$response = call_user_func_array( $callback, array( $response ) );
			}
			else {
				$response[] = call_user_func_array( $callback, $params );
			}
		}
		
		return $response;
	}
229490
public function call($callback, array $parameters = [])
    {
        $this->_events[] = $event = new CallbackEvent($callback, $parameters);

        return $event;
    }
322590
public function call($callback, array $parameters = array())
    {
        $this->events[] = $event = new CallbackEvent($this->mutex, $callback, $parameters);

        return $event;
    }
59546
public static function pass( $event, $param = null ) {
		
		if ( !array_key_exists( $event, static::$events ) ) {
			return $param;
		}
		
		$event = static::$events[$event];
		
		if ( array_key_exists( 'before', $event ) ) {
			$param = static::call( $event['before'], $param, true );
		}
		
		if ( array_key_exists( 'callbacks', $event ) ) {
			$param = static::call( $event['callbacks'], $param, true );
		}
		
		if ( array_key_exists( 'after', $event ) ) {
			$param = static::call( $event['after'], $param, true );
		}
		
		return $param;
	}
297494
private function getArguments(callable $callback, array $callbackArguments)
    {
        $parameters = $this->getParameters($callback);
        $arguments = [];
        foreach ($parameters as $param) {
            if (array_key_exists($param->getName(), $callbackArguments)) {
                $arguments[] = $callbackArguments[$param->getName()];
            } elseif ($param->isDefaultValueAvailable()) {
                $arguments[] = $param->getDefaultValue();
            } else {
                $arguments[$param->getName()] = null;
            }
        }

        return $arguments;
    }
396342
protected function call_handler($name, array $params = array())
    {
        if(array_key_exists($name,$this->call_handlers)) {
            go(function () use ($name, $params) {
                sd_call_user_func_array($this->call_handlers[$name], $params);
            });
        }
    }
523349
protected function createClassesCallback($callback, array $parameters)
    {
        list($className, $method) = Str::parseCallback($callback, 'register');

        $instance = $this->container->make($className);

        $callable = array($instance, $method);

        return $this->createCallableCallback($callable, $parameters);
    }
1354196
public static function signal($signals, $callback)
    {
        foreach ($signals as $signal) {
            if (is_null($callback)) {
                \Swoole\Process::signal($signal, null);
                continue;
            }
            \Swoole\Process::signal($signal, function ($signal) use ($callback) {
                try {
                    call_user_func($callback, $signal);
                } catch (\Throwable $e) {
                    \Mix::$app->error->handleException($e);
                }
            });
        }
    }
244129
protected function handleCallback($callback, array $args = [])
    {
        $response = null;

        // Check if $callback is a closure.
        if ($callback instanceof \Closure || is_array($callback)) {
            $response = call_user_func($callback, $args);
        } elseif (is_string($callback)) {
            if (false !== strpos($callback, '@') || class_exists($callback)) {
                // We use a "ClassName@method" syntax.
                // Let's get a class instance and call its method.
                $callbackArray = $this->handleClassCallback($callback);
                $response = call_user_func($callbackArray, $args);
            } else {
                // Used as a classic callback function.
                $response = call_user_func($callback, $args);
            }
        }

        return $response;
    }
920869
public function call(array $args = array())
        {
            $callback = $this->getCallback();

            // Minor performance tweak, if the callback gets called more than once
            if (!isset(static::$isPhp54)) {
                static::$isPhp54 = version_compare(PHP_VERSION, '5.4.0rc1', '>=');
            }

            $argCount = count($args);

            if (static::$isPhp54 && is_string($callback)) {
                $result = $this->validateStringCallbackFor54($callback);

                if ($result !== true && $argCount <= 3) {
                    $callback       = $result;
                    // Minor performance tweak, if the callback gets called more
                    // than once
                    $this->callback = $result;
                }
            }

            // Minor performance tweak; use call_user_func() until > 3 arguments
            // reached
            switch ($argCount) {
                case 0:
                    if (static::$isPhp54) {
                        return $callback();
                    }
                    return call_user_func($callback);
                case 1:
                    if (static::$isPhp54) {
                        return $callback(array_shift($args));
                    }
                    return call_user_func($callback, array_shift($args));
                case 2:
                    $arg1 = array_shift($args);
                    $arg2 = array_shift($args);
                    if (static::$isPhp54) {
                        return $callback($arg1, $arg2);
                    }
                    return call_user_func($callback, $arg1, $arg2);
                case 3:
                    $arg1 = array_shift($args);
                    $arg2 = array_shift($args);
                    $arg3 = array_shift($args);
                    if (static::$isPhp54) {
                        return $callback($arg1, $arg2, $arg3);
                    }
                    return call_user_func($callback, $arg1, $arg2, $arg3);
                default:
                    return call_user_func_array($callback, $args);
            }
        }
635820
public function doTheJobChild($num, $callback, $params = array()) {
        if (!$callback instanceof CallbackHandler) {
            $callback = new CallbackHandler($callback);
        }
        if (!is_array($params)) {
            $params = array($params);
        }
        $this->callbackChildren[$num] = $callback;
        $this->callbackParamChildren[$num] = $params;
        return $this;
    }
1082326
public function addCallback( $type, $callback ) {
		if ( !isset( $this->callbacks[$type] ) ) {
			$this->callbacks[$type] = [];
		}
		$this->callbacks[$type][] = $callback;
	}
1374571
public function doTheJob($callback, $params = array()) {
        if (!$callback instanceof CallbackHandler) {
            $callback = new CallbackHandler($callback);
        }
        if (!is_array($params)) {
            $params = array($params);
        }
        $this->callback = $callback;
        $this->callbackParam = $params;
        return $this;
    }
1088026
public function basicConsume(array $params, $callback)
    {
        list(
            $queue,
            $consumer_tag,
            $no_local,
            $no_ack,
            $exclusive,
            $nowait,
            $ticket,
            $arguments
            ) = $params;

        return parent::basic_consume(
            $queue,
            $consumer_tag,
            $no_local,
            $no_ack,
            $exclusive,
            $nowait,
            $callback,
            $ticket,
            $arguments
        );
    }
47576
public static function callArgs($callback, array $args = [])
    {
        try {
            $callback = static::evaluateCallback($callback);

            return \call_user_func_array($callback, $args);
        } catch (\Exception $e) {
            $message = $e->getMessage();
        }

        if (\is_array($callback) && \is_object($callback[0])) {
            $callback[0] = \get_class($callback[0]);
        }

        throw new DcGeneralRuntimeException(
            \sprintf(
                'Execute callback %s failed - Exception message: %s',
                (\is_array($callback)
                    ? \implode('::', $callback)
                    : (\is_string($callback)
                        ? $callback
                        : \get_class(
                            $callback
                        ))),
                $message
            ),
            0,
            $e
        );
    }
636079
private function createCallbackFromString( $callFunc, $params ) {

		if ( is_string( $callFunc ) ) {
			$callFunc = function () use ( $callFunc, $params ) {
				$controllerParts    = explode( '@', $callFunc );
				$controllerParts[0] = explode( '\\', $controllerParts[0] );
				$hmvc               = '';
				$controllerPaths    = count( $controllerParts[0] );

				if ( $controllerPaths > 1 ) {

					foreach ( $controllerParts[0] as $idx => $controllerPart ) {

						if ( $idx == ( $controllerPaths - 1 ) ) {
							break;
						}

						$hmvc .= '\\' . $controllerPart;
					}

				}

				$controller = $hmvc . '\\Controllers\\' . $controllerParts[0][ $controllerPaths - 1 ];
				$c          = new \ReflectionClass( $controller );
				$c          = $c->newInstanceArgs( $params );

				return call_user_func_array( array( $c, $controllerParts[1] ), $this->route->getParams() );
			};

			return $callFunc;

		}

		return $callFunc;
	}
1146579
public function call($callback, $arguments = [])
    {
        $dependencies = $this->getMethodDependencies($callback, $arguments);

        return call_user_func_array($callback, $dependencies);
    }