Call a method on an object, and rebind it into the container.

@param string $method
@param array  $parameters
@param string $builder

@throws \Rocketeer\Services\Builders\TaskCompositionException
343377
protected function delegateAndRebind($method, array $parameters, $builder)
    {
        $object = (array) array_shift($parameters);
        $object = $this->builder->$builder(...$object);
        $object->$method(...$parameters);

        $this->container->add('rocketeer.'.$object->getIdentifier(), $object);
    }
1073772
public function setMethod($method)
    {
        $method = (string) $method;
        if ($method === '') {
            throw new \InvalidArgumentException('$method cannot be empty');
        }

        $this->method = $method;
    }
1090065
public function invoke($method, $parameters)
    {
        /* @var Aop $aop */
        $aop = \bean(Aop::class);

        return $aop->execute($this->target, $method, $parameters);
    }
1000750
public function compose(string $format, array $compose = [], string $method = 'compose')
    {
        if (! \in_array($format, $this->formats)) {
            return $this->composeError(null, [], 406);
        } elseif (! \method_exists($this, $method.\ucwords($format))) {
            throw new RuntimeException('Call to undefine method ['.$method.\ucwords($format).'].');
        }

        $config = $compose['on'][$format] ?? [];

        $config['view'] = $compose['view'];

        return $this->{$method.\ucwords($format)}(
            $this->prepareDataValue($config, $compose['data']),
            $compose['status'],
            $config
        );
    }
862229
public static function __callstatic($method, $params) {

    if ($method == 'map') {
        $maps = array_map('strtoupper', $params[0]);
        $uri = strpos($params[1], '/') === 0 ? $params[1] : '/' . $params[1];
        $callback = $params[2];
    } else {
        $maps = null;
        $uri = strpos($params[0], '/') === 0 ? $params[0] : '/' . $params[0];
        $callback = $params[1];
    }

    array_push(self::$maps, $maps);
    array_push(self::$routes, $uri);
    array_push(self::$methods, strtoupper($method));
    array_push(self::$callbacks, $callback);
  }
959193
protected function doActionObject($method, ObjectBuilderInterface $builder, array $options): void
    {
        if (null !== $this->parent) {
            $this->parent->{$method}($builder, $options);
        }

        $this->innerType->{$method}($builder, $options);

        foreach ($this->typeExtensions as $extension) {
            /* @var ObjectTypeExtensionInterface $extension */
            $extension->{$method}($builder, $options);
        }
    }
1263521
public static function call($object, string $method, array $parameters)
    {
        $reflectionClass = new \ReflectionClass($object);
        $reflectionMethod = $reflectionClass->getMethod($method);
        $arguments = [];

        foreach ($reflectionMethod->getParameters() as $i => $reflectionParameter) {
            $argument = null;

            if (array_key_exists($reflectionParameter->name, $parameters) || array_key_exists($i, $parameters)) {
                $argument = $parameters[$reflectionParameter->name] ?? $parameters[$i] ?? null;
            } elseif ($reflectionParameter->isDefaultValueAvailable()) {
                $argument = $reflectionParameter->getDefaultValue();
            }

            if ($reflectionType = $reflectionParameter->getType()) {
                if ($reflectionType->isBuiltin()) {
                    if ($argument !== null || !$reflectionType->allowsNull()) {
                        settype($argument, $reflectionType->getName());
                    }
                } elseif ($argument === null && !$reflectionType->allowsNull()) {
                    return null;
                }
            }

            $arguments[] = $argument;
        }

        if ($reflectionMethod->isConstructor()) {
            return $reflectionClass->newInstanceArgs($arguments);
        }

        $reflectionMethod->setAccessible(true);

        return $reflectionMethod->invokeArgs($reflectionMethod->isStatic() ? null : $object, $arguments);
    }
318625
public function dispatch($method, $parameters = [])
    {
        $base = ucfirst($method);
        $traits = $this->getRecursiveTraits();

        foreach ($traits as $trait) {
            $trait = explode('\\', $trait);
            $trait = str_replace('model', '', strtolower(array_pop($trait)));

            $method = $trait.$base;

            if (method_exists($this, $method)) {
                call_user_func_array([$this, $method], $parameters);
            }
        }
    }
844969
public function call($method, array $params = array(), $format = 'php')
    {
        $params['method']       = $method;
        $params['token_auth']   = $this->token;
        $params['format']       = $format;

        $data = $this->getConnection()->send($params);

        if ('php' === $format) {
            $object = unserialize($data);

            if (isset($object['result']) && 'error' === $object['result']) {
                throw new Exception($object['message']);
            }

            return $object;
        } else {
            return $data;
        }
    }
231565
public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
    {
        $this->currentUri = $this->prepareUrlForRequest($uri);

        $symfonyRequest = SymfonyRequest::create(
            $this->currentUri, $method, $parameters,
            $cookies, $files, $server, $content
        );

        $response = $this->app->prepareResponse(
            $this->app->handle(Request::createFromBase($symfonyRequest))
        );
        $this->response = $this->createTestResponse($response);

        return $this->response;
    }
713364
protected function call($method, array $params)
    {
        $uri = $this->getConfig('base_url') . '/xmlrpc.php';
        $bridge = new \fXmlRpc\Transport\GuzzleBridge($this);
        $client = new \fXmlRpc\Client($uri, $bridge);

        // We have to nest the params in an array otherwise we get a "Wrong
        // number of method parameters" error.
        return $client->call($method, array($params));
    }
661199
private function makeRequest($method, $uri, array $parameters = []) {
    try {
      $response = $this->request($method, $uri, $parameters);
      if (200 != $response->getStatusCode()) {
        throw new DaxkoClientException(sprintf('Got non 200 response code for the uri %s.', $uri));
      }

      if (!$body = $response->getBody()) {
        throw new DaxkoClientException(sprintf('Failed to get response body for the uri %s.', $uri));
      }

      if (!$contents = $body->getContents()) {
        throw new DaxkoClientException(sprintf('Failed to get body contents for the uri: %s.', $uri));
      }

      $object = json_decode($contents);

      // todo remove todo??? @todo Check if object contains data.
      if (isset($object->data)) {
        return $object->data;
      }
      elseif (isset($object->tags)) {
        return $object->tags;
      }

      throw new DaxkoClientException(sprintf('Got unknown body name for method %s.', $method));
    }
    catch (\Exception $e) {
      throw new DaxkoClientException(sprintf('Failed to make a request for uri %s with message %s.', $uri, $e->getMessage()));
    }

  }
65223
public function call($callback, array $parameters = [], $defaultMethod = null)
    {
        return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
    }
595388
public function notification(string $method, array $parameters)
    {
        if ($this->isSingleRequest) {
            $this->units = [];
        }

        $this->units[] = new Notification($method, $parameters);

        if ($this->isSingleRequest) {
            $this->execute(new InvokeSpec($this->units, true));
            return null;
        }

        return $this;
    }
605219
public function registerTask($task, $method)
	{
		if (in_array(strtolower($method), $this->_taskMap))
		{
			$this->_taskMap[strtolower($task)] = $method;
		}

		return $this;
	}
642229
public function setMethod($method)
    {
        $valid_methods = array(self::METHOD_POST, self::METHOD_GET);

        if (!in_array($method, $valid_methods)) {
            throw new SwatException("‘{$method}’ is not a valid form method.");
        }

        $this->method = $method;
    }
226113
private function executeCommand($class, string $method, bool $server, $bindParams)
    {
        $this->beforeCommand(\get_parent_class($class), $method, $server);
        PhpHelper::call([$class, $method], $bindParams);
        $this->afterCommand($method, $server);
    }