delegate

@param   string $name
@param   array  $args

@return   mixed
483957
protected function delegate($name, ...$args)
    {
        if (!count($args)) {
            $args[] = $this->getData();
        }

        $name = str_replace('.', '_', $name);

        $name = StringNormalise::toCamelCase($name);

        if (is_callable([$this, $name])) {
            return $this->$name(...$args);
        }

        return null;
    }
693210
public function trigger($name, ...$args)
    {
        if ($this->addThisToEvents) {
            array_unshift($args, $this);
        }
        if (isset($this->eventHandlers[$name])) {
            $this->lastEventName = $name;
            foreach ($this->eventHandlers[$name] as $cb) {
                if ($cb(...$args) === true) {
                    return $this;
                }
            }
        }
        return $this;
    }
620662
public function provide($name, $args)
    {
        $services = $this->getServices();
        if (isset($services[$name])) {
            return (new Service($name, $services[$name]))
                ->resolve($args, $this->getDi());
        } else {
            $method = self::METHOD_PREFIX . $name;
            if (method_exists($this, $method)) {
                if (empty($args)) {
                    return $this->$method();
                } else {
                    return call_user_func_array([$this, $method], $args);
                }
            } else {
                throw new Exception("Cannot load '{$name}' from " . get_class($this));
            }
        }
    }
366127
public static function get($name, array $args = [])
    {
        if (!isset(self::$services[$name])) {
            throw new ServiceNotFoundException(sprintf('Service "%s" does not exist.', $name));
        }

        $instance = self::$services[$name]->resolve(self::getInstance(), $args);

        if ($instance instanceof ContainerAwareInterface) {
            $instance->setContainer(self::getInstance());
        }

        return $instance;
    }
967411
protected function _preCall(&$name, array &$args) {
        if (!method_exists($this, $name)) {
            $settings = $this->getCachedSettings($name);
            if (array_key_exists('reference', $settings['attrs']) || $settings['type'] == 'ReferenceMany') {
                $modelTable = array_key_exists('model', $settings['attrs']) ?
                        $settings['attrs']['model'] :
                        $settings['attrs']['reference']['model'];
                $columnValue = is_object($this->$name) ? $this->$name->getArrayCopy() : $this->$name;
                $nam = !is_array($columnValue) ? explode('__:DS:__', $columnValue) : $columnValue;
                $column = array_key_exists('column', $settings['attrs']) ?
                        $settings['attrs']['column'] :
                        $settings['attrs']['reference']['column'];
                $args['relateWhere'] = array();
                foreach ($nam as $val) {
                        $args['relateWhere'][] = array($column => $val);
                }
            }
            if ($modelTable || (!$modelTable && $modelTable = self::getModelTable(Util::camelTo_($name)))) {
                $model = is_array($modelTable) ?
                        new $modelTable[count($modelTable) - 1] :
                        new $modelTable;

                $name = $model->getTableName();
                if (!isset($args[0]['returnType']) || $args[0]['returnType'] == Table::RETURN_MODEL){
                    $relTable = $this->getConnection()->table($name);

                    $model->setConnection($this->getConnection());
                    $model->init($relTable);
                    $args['model'] = $model;
                }
            }
        }
    }
100672
protected function executeMethod($name, $args)
    {
        // Send request, retry one time when using persistent connections on the first request only
        if ($this->persistent && $this->requests === 0) {
            $this->requests = 1;
            try {
                $response = $this->redis->$name(...$args);
            } catch (\RedisException $e) {
                if ($e->getMessage() === 'read error on connection') {
                    $this->close(true);
                    $this->connect();
                    $response = $this->redis->$name(...$args);
                } else {
                    throw $e;
                }
            }
        } else {
            $response = $this->redis->$name(...$args);
        }

        // Proxy pipeline mode to the phpredis library
        if ($name === 'pipeline' || $name === 'multi') {
            $this->redisMulti = $response;

            return $this;
        }

        if ($name === 'exec' || $name === 'discard') {
            $this->redisMulti = null;

            return $response;
        }

        if ($this->redisMulti !== null) { // Multi and pipeline return self for chaining
            return $this;
        }

        return $response;
    }
1340531
public function helperMethod($name, $method, $args)
    {
        $args[0] = $this->helperName($name);
        $dependencies = $this->formatter->getDependencies();

        return call_user_func_array([$dependencies, $method], $args);
    }
1204217
public function map($name, $callback, array $arguments = [])
    {
        $command = new Command($name, $callback, $arguments);
        $this->commands[$name] = $command;
        return $command;
    }
676024
public function runMacro($name, $args)
    {
        if (isset($this->macros[$name])) {
            if (is_callable($this->macros[$name])) {
                return call_user_func_array($this->macros[$name], array_merge([$this], $args));
            }
        }
    }
1349737
private function funcCondition($name, $arg = null)
    {
        $this->getExpr()->addCondition(new ConditionFunc(
            $name,
            $this,
            $arg !== null ? $this->getExpr()->value($arg) : null
        ));

        return $this->getExpr();
    }
420031
protected function executeCommand($name, array $arguments)
    {
        $command = $this->client->createCommand($name, $arguments);

        return $this->client->executeCommand($command);
    }
802726
protected function getMinifierInstance($name, array $args = [])
	{
		$className = 's9e\\TextFormatter\\Configurator\\JavaScript\\Minifiers\\' . $name;
		if (!class_exists($className))
		{
			throw new InvalidArgumentException('Invalid minifier ' . var_export($name, true));
		}

		$reflection = new ReflectionClass($className);
		$minifier   = (empty($args)) ? $reflection->newInstance() : $reflection->newInstanceArgs($args);

		return $minifier;
	}
982988
protected function getResults($name, $args)
    {
        if (method_exists($this->scope, $name)) {
            return call_user_func_array(array($this->scope, $name), $args);
        }

        return $this->scope->call($name, $args);
    }
1305813
public function staticCatchAll($name, array $args, &$processed) {
		#Article::where() / ::limit() / ::orderBy() / ..
		if(method_exists('Asgard\Orm\ORM', $name)) {
			$processed = true;
			return call_user_func_array([$this->getDataMapper()->orm($this->entityClass), $name], $args);
		}
	}
1153058
public function factory($name, array $args = array())
    {
        foreach ($this->factories as $factory) {
            $command = $factory->factory($name, $args);
            if ($command) {
                return $command;
            }
        }
    }
421341
public function performAction($name, array $args, Resource $resource)
    {
        if (isset($args[0]) && is_array($args[0])) {
            $args = $args[0];
        }

        $action = $this->model->search('action', $resource->getType(), $name);

        $command = $this->prepareCommand($action['request'], $resource, $args);
        $result = $this->apiClient->execute($command);

        if (isset($action['resource'])) {
            $id = $this->createIdentityForRelatedResource(
                $action['resource']['identifiers'],
                function (array $param) use ($resource, $command, $result) {
                    return $this->resolveValue($param, $resource, $command, $result);
                }
            );

            return $this->createResources($action['resource'], $result, $id);
        } else {
            return $result;
        }
    }
1336614
public function addArgument($name, Argument $arg = null) {
        if (isset($this->configOpts[$name]) || isset($this->configArgs[$name])) {
            throw new ConfigException('option/argument already set: ' . $name);
        }

        if (is_null($arg)) {
            $arg = new Argument();
        }

        $this->configArgs[$name] = $arg;
        return $arg;
    }