Bind Service to method argument

@param string $controllerName Controller class name
@param string $methodName     Method name
@param string $argumentName   Argument name
@param string $serviceName    Registered Service name

@return ControllerDispatcher
552326
public function bindService($controllerName, $methodName, $argumentName, $serviceName)
    {
        $this->bindings[$controllerName][$methodName][$argumentName] = $serviceName;
        return $this;
    }
347631
protected function controller($controllername)
    {
        if (str_contains($controllername, '/')) {
            $controllername = str_replace('/', '\\', $controllername);
        }

        if (str_contains($controllername, '@')) {
            return ucfirst($controllername);
        }
        return ucfirst($controllername . '@index');
    }
1352508
public static function createBoundValidator($methodName, ...$boundArgs)
    {
        return function (...$args) use ($methodName, $boundArgs) {
            return call_user_func_array("self::$methodName", array_merge($boundArgs, $args));
        };
    }
1294165
protected function activate($serviceName, $serviceConfig)
    {
        $activator = $this->activatorFactory->getActivator($serviceName, $serviceConfig);

        return $activator->createInstance($this, $serviceName, $serviceConfig);
    }
1179399
public function getServiceMethod($methodName)
    {
        return $this->getService($this->getServiceName($methodName)) instanceof Service ? $this->getService($this->getServiceName($methodName))->getMethod($methodName) : null;
    }
398530
public function loadMetadataForAction($controllerClassName, $actionMethod)
    {
        $key = $controllerClassName . '_' . $actionMethod;
        if (array_key_exists($key, $this->classAnnotations)) {
            return $this->classAnnotations[$key];
        }

        $r = new ReflectionClass($controllerClassName);
        $rMethod = $r->getMethod($actionMethod);

        $metadata = new Metadata();


        /** @var Annotation\RunWorkflowParamFromRoute|null $workflowRouterMapAnnotation */
        $workflowRouterMapAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\RunWorkflowParamFromRoute::class);
        if ($workflowRouterMapAnnotation) {
            $metadata->setWorkflowManagerNameRouterParam($workflowRouterMapAnnotation->managerName);
            $metadata->setWorkflowManagerAliasRouterParam($workflowRouterMapAnnotation->managerAlias);
            $metadata->setWorkflowActionNameRouterParam($workflowRouterMapAnnotation->actionName);
            $metadata->setWorkflowNameRouterParam($workflowRouterMapAnnotation->name);
            $metadata->setEntryIdRouterParam($workflowRouterMapAnnotation->entryId);
        }

        return $metadata;
    }
1099234
public static function bindInstance($instance, $methodName, $args = null)
    {
        $helper = new self();
        return $helper->createClosure($methodName, $args)->bindTo($instance, get_class($instance));
    }
1359047
public function bind($routeName)
    {
        if ($this->isFrozen) {
            throw new ControllerFrozenException(sprintf('Calling %s on frozen %s instance.', __METHOD__, __CLASS__));
        }

        $this->routeName = $routeName;

        return $this;
    }
973759
public function create( $serviceName ) {

		if ( is_string( $serviceName ) && isset( $this->aliases[$serviceName] ) ) {
			$serviceName = $this->aliases[$serviceName];
		}

		return $this->getReturnValueFromCallbackHandlerFor( $serviceName, func_get_args() );
	}
1319827
protected function invoke($controller, $method, $params)
    {
        if (!class_exists($controller)) {
            throw new Exception("Controller [ $controller ] does not exist.");
        }

        try {
            $instance = $this->container->make($controller);

            $resolving = $this->container->resolveMethod($controller, $method, $params, true);

            $this->validateForm($resolving);

            return call_user_func_array([$instance, $method], $resolving);
        } catch (DefinitionException $e) {
            throw new BindingException("Binding Error [ ". $e->getMessage() ." ]");
        }

    }
515854
public function createServiceWithName(
        ServiceLocatorInterface $serviceLocator,
        $name,
        $requestedName
    ) {
        return new BaseController(
            $serviceLocator->getServiceLocator()->get('Config'),
            $requestedName,
            $serviceLocator
        );
    }
231092
protected function getRegisterServiceArguments($serviceName)
    {
        $this->assertServiceExist($serviceName);

        return isset($this->services[$serviceName]['arguments'])
            ? $this->services[$serviceName]['arguments']
            : $this->services[$serviceName]['arguments'] = $this->getServiceArgumentNames($this->services[$serviceName]['definition']);
    }
1359229
public function createForService($serviceName) {
		if ($this->_basePath === null) {
			throw new ConfigError('Base path was not given');
		}
		
		$filename = $this->_filenameTemplate;
		
		if (strpos($filename, self::PATTERN_SERVICE) !== false) {
			$filename = str_replace(self::PATTERN_SERVICE, $serviceName, $filename);
		}
		
		if (strpos($filename, self::PATTERN_DATE) !== false) {
			$filename = str_replace(self::PATTERN_DATE, date($this->_dateFormat), $filename);
		}
		
		$path = $this->_basePath;
		
		if ($this->_separateDirs) {
			$path .= DIRECTORY_SEPARATOR . $serviceName;
			
			if ((! file_exists($path) || ! is_dir($path)) && ! mkdir($path)) {
				throw new NoDirectory('Directory does not exists and unable to create: "' . $path . '"');
			}
		}
		
		$path .= DIRECTORY_SEPARATOR . $filename;
		
		if (isset($this->_loggers[$serviceName])) {
			return $this->_loggers[$serviceName];
		}
		
		$adapter = $this->getCreateCallback()->__invoke($path);
		$logger  = new Logger($adapter);
		
		$this->_loggers[$serviceName] = $logger;
		return $logger;
	}
730977
public function getControllerDispatcher()
	{
		if (is_null($this->controllerDispatcher))
		{
			$this->controllerDispatcher = new ControllerDispatcher($this, $this->container);
		}

		return $this->controllerDispatcher;
	}
626561
private function addBinding($serviceName)
    {
        $this->addToDebug("Adding binding: '$serviceName'");
        // SH. don't add to main doc just yet
        // $bindingTag=$this->addElement("binding");
        $bindingTag = $this->addElement('binding', $this->definitions);
        $bindingTag->setAttribute('name', $serviceName.'Binding');
        $bindingTag->setAttribute('type', 'tns:'.$serviceName.'PortType');

            //soap binding tag
            $soapBindingTag = $this->addElement('soap:binding', $bindingTag);
        $soapBindingTag->setAttribute('style', ($this->binding_style == SOAP_RPC) ? 'rpc' : 'document');
        $soapBindingTag->setAttribute('transport', 'http://schemas.xmlsoap.org/soap/http');

        //keep a reference
        $this->bindingTags[$serviceName] = $bindingTag;
        //and return
        return $bindingTag;
    }
867274
protected function _getCommands($controllerName)
    {
        $commands = [];

        foreach (get_class_methods($controllerName) as $method) {
            if (preg_match('#^(.*)Command$#', $method, $match) === 1 && $match[1] !== 'help') {
                $commands[] = $match[1];
            }
        }

        return $commands;
    }
984394
protected function bindServices()
    {
        $reflection = new \ReflectionObject($this);
        $methods    = $reflection->getMethods();
        foreach ($methods as $method) {
            if ((strlen($method->name) > 10) && (strpos($method->name, 'initShared') === 0)) {
                $this->setShared(lcfirst(substr($method->name, 10)), $method->getClosure($this));
                continue;
            }
            if ((strlen($method->name) > 4) && (strpos($method->name, 'init') === 0)) {
                $this->set(lcfirst(substr($method->name, 4)), $method->getClosure($this));
            }
        }
    }