Calls a php function.

@param string $callback the function to call
@param array  $params   an array of parameters to send to the function

@return mixed the return value of the called function
437060
public function arrayMap($callback, array $params)
    {
        if ($params[0] === $this) {
            $addThis = true;
            array_shift($params);
        }
        if ((is_array($params[0]) || ($params[0] instanceof Iterator && $params[0] instanceof ArrayAccess))) {
            if (empty($params[0])) {
                return $params[0];
            }

            // array map
            $out = array();
            $cnt = count($params);

            if (isset($addThis)) {
                array_unshift($params, $this);
                $items = $params[1];
                $keys  = array_keys($items);

                if (is_string($callback) === false) {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = call_user_func_array($callback, array(1 => $items[$i]) + $params);
                    }
                } elseif ($cnt === 1) {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = $callback($this, $items[$i]);
                    }
                } elseif ($cnt === 2) {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = $callback($this, $items[$i], $params[2]);
                    }
                } elseif ($cnt === 3) {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = $callback($this, $items[$i], $params[2], $params[3]);
                    }
                } else {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = call_user_func_array($callback, array(1 => $items[$i]) + $params);
                    }
                }
            } else {
                $items = $params[0];
                $keys  = array_keys($items);

                if (is_string($callback) === false) {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = call_user_func_array($callback, array($items[$i]) + $params);
                    }
                } elseif ($cnt === 1) {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = $callback($items[$i]);
                    }
                } elseif ($cnt === 2) {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = $callback($items[$i], $params[1]);
                    }
                } elseif ($cnt === 3) {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = $callback($items[$i], $params[1], $params[2]);
                    }
                } elseif ($cnt === 4) {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = $callback($items[$i], $params[1], $params[2], $params[3]);
                    }
                } else {
                    while (($i = array_shift($keys)) !== null) {
                        $out[] = call_user_func_array($callback, array($items[$i]) + $params);
                    }
                }
            }

            return $out;
        } else {
            return $params[0];
        }
    }
851105
public function callback($callback, $func, $args=array())
	{
		// Make sure the callback is set (this is protecting us when running in non-interactive mode and callbacks aren't set)
		if (!isset($this->callbacks[$callback]))
		{
			return false;
		}

		// Call function
		return call_user_func_array(array($this->callbacks[$callback], $func), $args);
	}
1039616
function fetch_callback($sql, callable $callback)
	{
		$result = null;
		$rs = $this->query($sql, MYSQLI_USE_RESULT);
		while ($row = $rs->fetch_assoc())
		{
		//	if (call_user_func_array($callback, [&$row, &$result]) === false)	//	alternative: when using references, the values MUST be passed via an array with call_user_func_array(), call_user_func() only passes by value!
			if ($callback($row, $result) === false)
				break;
		}
		$rs->free_result();
		return $result;
	}
65223
public function call($callback, array $parameters = [], $defaultMethod = null)
    {
        return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
    }
568343
public function call($callback, array $parameters = [])
    {
        switch (count($parameters)) {
            case 0:
                return call_user_func($callback);
            case 1:
                return call_user_func($callback, $parameters[0]);
            case 2:
                return call_user_func($callback, $parameters[0], $parameters[1]);
            case 3:
                return call_user_func($callback, $parameters[0], $parameters[1], $parameters[2]);
            case 4:
                return call_user_func($callback, $parameters[0], $parameters[1], $parameters[2], $parameters[3]);
        }

        return call_user_func_array($callback, $parameters);
    }
941554
public static function call($function, \Closure $callback = null)
    {
        $result = null;
        if (is_array($function)) {
            $result = self::methodDI($function, $callback);
        } elseif (is_callable($function, true)) {
            $result = self::functionDI($function, $callback);
        }
        return $result;
    }
427934
public function AssignCallback($Callback, $Options = NULL) {
      if (!is_callable($Callback)) return FALSE;
      
      $this->Callback = $Callback;
      $this->CallbackOptions = $Options;
   }
718495
public static function factory( $callback, $params = array() ) {
		$route = new static();
		$route->callback = $callback;
		$route->params = $params;
		return $route;
	}
1017063
public function set($callback, $args = [])
    {
        if ($this->postTrigger) {
            if (isset($_POST[$this->postTrigger])) {
                $this->app->catch_runaway_callbacks = false;
                $this->triggered = $_POST[$this->postTrigger];

                $t = $this->app->run_called;
                $this->app->run_called = true;
                $ret = call_user_func_array($callback, $args);
                $this->app->run_called = $t;

                return $ret;
            }
        } else {
            if (isset($_GET[$this->urlTrigger])) {
                $this->app->catch_runaway_callbacks = false;
                $this->triggered = $_GET[$this->urlTrigger];

                $t = $this->app->run_called;
                $this->app->run_called = true;
                $this->owner->stickyGet($this->urlTrigger);
                $ret = call_user_func_array($callback, $args);
                //$this->app->stickyForget($this->name);
                $this->app->run_called = $t;

                return $ret;
            }
        }
    }
76262
protected function createStringCallback($callback, array $parameters)
    {
        if (function_exists($callback)) {
            return $this->createCallableCallback($callback, $parameters);
        } else {
            return $this->createClassesCallback($callback, $parameters);
        }
    }
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);
            }
        }
493828
public function handle(callable $callBack = null)
    {
        $ip = $this->getIpAddress();

        $isAllowed = $this->listMerger->isAllowed($ip, $this->defaultState);

        if ($callBack !== null) {
            return call_user_func($callBack, array($this, $isAllowed));
        } else {
            return $isAllowed;
        }
    }
1120858
public function execute($callback)
    {
        if (!$this->isBatch) {
            throw new \RuntimeException('Please batch json rpc first.');
        }
        $methods = $this->methods;
        $proxy = function ($err, $res) use ($methods, $callback) {
            if ($err !== null) {
                return call_user_func($callback, $err, null);
            }
            foreach ($methods as $key => $method) {
                if (isset($res[$key])) {
                    if (!is_array($res[$key])) {
                        $transformed = $method->transform([$res[$key]], $method->outputFormatters);
                        $res[$key] = $transformed[0];
                    } else {
                        $transformed = $method->transform($res[$key], $method->outputFormatters);
                        $res[$key] = $transformed;
                    }
                }
            }
            return call_user_func($callback, null, $res);
        };
        $this->requestManager->sendPayload('[' . implode(',', $this->batch) . ']', $proxy);
        $this->methods[] = [];
        $this->batch = [];
    }
490380
protected function callClassBasedExtension($callback, $parameters)
    {
        list($class, $method) = explode('@', $callback);

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

        return call_user_func_array(array($instance, $method), $parameters);
    }
1107908
public static function capture( $callback, $params = array() )
	{
		if ( is_string( $callback ) )
		{
			return $callback;
		}

		if ( !is_closure( $callback ) )
		{
			return "";
		}

		if ( !is_array( $params ) ) 
		{
			$params = array( $params );
		}

		ob_start();
		$return = call_user_func_array( $callback,  $params );
		$buffer = ob_get_clean();

		if ( !is_null( $return ) )
		{
			return $return;
		}

		return $buffer;
	}
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;
    }
431933
public function callback($callback)
    {
        $t = $this;
        $args = array_slice(func_get_args(),1);

        // use an event handler to dispatch to the callback
        $this->_events->register('startTransaction', function($event, $connection) use ($t, $callback, $args) {
            $t->results []= call_user_func_array($callback, $args);
        });

        return $this;
    }