Defines a method injection

@param string $name
@param array  $parameters

@return ObjectDefinitionHelper
433981
public function method($name, array $parameters = [])
    {
        $this->_methods[$name] = new MethodInjection($name, $parameters);
        return $this;
    }
539963
public function registerParameters($parameters = [])
    {
        foreach ($parameters as $name => $value) {
            $this->registerParameter($name, $value);
        }

        return $this;
    }
1270085
public function generate($name, $parameters = array(), $absolute = false)
    {
        $this->urlGenerator = new UrlGenerator($this->routeCollection, $this->context);

        return $this->urlGenerator->generate($name, $parameters, $absolute);
    }
78332
public function objectAction(string $name) : Action\ObjectActionDefiner
    {
        return new ObjectActionDefiner(
            $this->dataSource,
            $this->authSystem,
            $this->requiredPermissions,
            $name,
            function (IObjectAction $action) {
                $this->actions[$action->getName()] = $action;
            }
        );
    }
904374
public function initialize(array $parameters = array())
        {
            // set default parameters
            foreach ($this->getDefaultParameters() as $key => $value) {
                if (is_array($value)) {
                    $this->parameters->set($key, reset($value));
                } else {
                    $this->parameters->set($key, $value);
                }
            }
            $this->helper->initialize($this, $parameters);
            return $this;
        }
1001586
protected function wrapService(string $name, ?array $parameters = null)
    {
        $config = $this->config->get($name);
        if (true === $config['wrap']) {
            $that = $this;

            return function () use ($that, $name, $parameters) {
                return $that->autoWireClass($name, $parameters);
            };
        }

        return $this->autoWireClass($name, $parameters);
    }
370476
public function initializeParameters($parameters = array())
    {
        $this->parameters = new ParameterContainer;

        Helper::initialize($this, $parameters);

        return $this;
    }
155143
public function setParameter($name, $parameter)
  {
    if ($this->isLocked()) {
      return $this->getObj()->setParameter($name, $parameter)->setLocked();
    } else {
      return parent::setParameter($name, $parameter);
    }
  }
395015
protected function autoWireMethod(string $name, ReflectionMethod $method, array $config, ?array $parameters = null): array
    {
        $params = $method->getParameters();
        $args = [];

        foreach ($params as $param) {
            $type = $param->getClass();
            $param_name = $param->getName();

            if (isset($parameters[$param_name])) {
                $args[$param_name] = $parameters[$param_name];
            } elseif (isset($config['arguments'][$param_name])) {
                $args[$param_name] = $this->parseParam($config['arguments'][$param_name], $name);
            } elseif (null !== $type) {
                $args[$param_name] = $this->resolveServiceArgument($name, $type, $param);
            } elseif ($param->isDefaultValueAvailable()) {
                $args[$param_name] = $param->getDefaultValue();
            } elseif ($param->allowsNull()) {
                $args[$param_name] = null;
            } else {
                throw new Exception\InvalidConfiguration('no value found for argument '.$param_name.' in method '.$method->getName().' for service '.$name);
            }

            if (!$param->canBePassedByValue()) {
                $value = &$args[$param_name];
                $args[$param_name] = &$value;
            }
        }

        return $args;
    }
1043672
protected function callClientMethod($name, array $arguments = array())
    {
        $this->logDebug("$name(" . implode(",", $arguments) . ")");
        return call_user_func_array(array($this->client, $name), $arguments);
    }
1250811
protected function newMethodSegment($name, array $arguments = [])
    {
        return $this->repositoryProvider->createRepository($this->newMethod($name, $arguments));
    }
541714
public function get($name, array $parameters = [])
    {
        // Shared services are preserved through whole request
        if (isset($this->shared[$name])) {
            return $this->shared[$name];
        }

        if (!$this->has($name)) {
            throw new NotFoundException('No definition found for service "' . $name . '".');
        }

        $definition = $this->definitions[$name];

        // Alias is a link to another definition
        if (isset($definition['alias'])) {
            return $this->get($definition['alias']);
        }

        // "Init" directive is a function that returns instance of service
        if (isset($definition['init'])) {
            $service_class = call_user_func($definition['init'], $this, $parameters);

            if ($service_class === false) {
                throw new NotFoundException('"Init" directive for service "' . $name . '" did not produced any object.');
            }
        } else {
            $arguments = [];

            // Array of arguments which are given to constructor method
            if (isset($definition['arguments'])) {
                $arguments = $this->resolveArrayOfArguments($definition['arguments'], $parameters);
            }

            // Service is made by static method
            if (isset($definition['static'])) {
                $service_class = call_user_func_array([$definition['class'], $definition['static']], $arguments);

                if ($service_class === false) {
                    throw new NotFoundException('Class "' . $definition['class'] . '" for service "' . $name . '" was not found.');
                }
            } else {
                // Service is made by normal constructor
                try {
                    $reflection_class = new \ReflectionClass($definition['class']);
                } catch (\ReflectionException $e) {
                    throw new NotFoundException('Class "' . $definition['class'] . '" for service "' . $name . '" was not found.');
                }

                $service_class = $reflection_class->newInstanceArgs($arguments);
            }
        }

        // "After" directive is a function that is called after instantiation of service object
        if (isset($definition['after'])) {
            call_user_func($definition['after'], $this, $service_class, $parameters);
        }

        // Preserve shared service
        if (isset($definition['shared']) && $definition['shared'] === true) {
            $this->shared[$name] = $service_class;
        }

        return $service_class;
    }
549973
public function generateUrl(string $name, array $parameters = []): string
    {
        $definition = $this->provider->getRouteDefinitionByName($name);
        return $definition->formatUrl($parameters);
    }
420453
public function renderComponent($name, $parameters = [])
    {
        $result = null;
        $previousContext = $this->componentContext;

        if ($componentObj = $this->findComponentByName($name)) {
            $componentObj->id = uniqid($name);
            $componentObj->setProperties(array_merge($componentObj->getProperties(), $parameters));
            $this->componentContext = $componentObj;
            $result = $componentObj->onRender();
        }

        if (!$result) {
            $result = $this->renderPartial($name.'::default', [], false);
        }

        $this->componentContext = $previousContext;
        return $result;
    }
1299309
public function setParameters(array $parameters)
    {
        $this->_parameters       = array();
        $this->_parameterNameMap = array();
        $this->addParameters($parameters);
        return $this;
    }
63750
public function addMethod($name, callable $method)
    {
        $this->methods[$name] = \Closure::bind($method, $this, $this);

        return $this;
    }
686494
protected function encode($method, array $parameters = [])
    {
        $this->encoder = $this->encoder ?: new XmlrpcEncoder();

        return $this->encoder->encodeCall($method, $parameters);
    }