Zend\Mvc\Controller\LazyControllerAbstractFactory::resolveParameter PHP Method

resolveParameter() private method

Returns a callback for resolving a parameter to a value.
private resolveParameter ( Interop\Container\ContainerInterface $container, string $requestedName ) : callable
$container Interop\Container\ContainerInterface
$requestedName string
return callable
    private function resolveParameter(ContainerInterface $container, $requestedName)
    {
        /**
         * @param ReflectionClass $parameter
         * @return mixed
         * @throws ServiceNotFoundException If type-hinted parameter cannot be
         *   resolved to a service in the container.
         */
        return function (ReflectionParameter $parameter) use($container, $requestedName) {
            if ($parameter->isArray() && $parameter->getName() === 'config' && $container->has('config')) {
                return $container->get('config');
            }
            if ($parameter->isArray()) {
                return [];
            }
            if (!$parameter->getClass()) {
                return;
            }
            $type = $parameter->getClass()->getName();
            $type = isset($this->aliases[$type]) ? $this->aliases[$type] : $type;
            if (!$container->has($type)) {
                throw new ServiceNotFoundException(sprintf('Unable to create controller "%s"; unable to resolve parameter "%s" using type hint "%s"', $requestedName, $parameter->getName(), $type));
            }
            return $container->get($type);
        };
    }
LazyControllerAbstractFactory