Get the controller callable

@param \Psr\Container\ContainerInterface|null $container

@throws \InvalidArgumentException

@return callable
182688
public function getCallable(?ContainerInterface $container = null) : callable
    {
        $callable = $this->handler;

        if (is_string($callable) && strpos($callable, '::') !== false) {
            $callable = explode('::', $callable);
        }

        if (is_array($callable) && isset($callable[0]) && is_object($callable[0])) {
            $callable = [$callable[0], $callable[1]];
        }

        if (is_array($callable) && isset($callable[0]) && is_string($callable[0])) {
            $callable = [$this->resolveClass($container, $callable[0]), $callable[1]];
        }

        if (is_string($callable) && method_exists($callable, '__invoke')) {
            $callable = $this->resolveClass($container, $callable);
        }

        if (! is_callable($callable)) {
            throw new InvalidArgumentException('Could not resolve a callable for this route');
        }

        return $callable;
    }
314314
public function withContainer(ContainerInterface $container): ContainerizedInterface
    {
        $route = clone $this;
        $route->container = $container;
        if ($route->target instanceof TargetInterface) {
            $route->target = clone $route->target;
        }

        $route->pipeline = $route->makePipeline();

        return $route;
    }
1154437
public function pathResolvable(Container $container)
    {
        $event = $this->loadEventFromPath($container);
        return ($event instanceof EventInterface) && $event->id();
    }
935608
public function get($container = null)
    {
        if ($container) {
            return $container->get($this->id);
        }
        return Ioc::container()->get($this->id);
    }
444153
public function build(ContainerInterface $container): object
    {
        return new Application(
            $container->get(RequestHandlerInterface::class),
            $container->get(EmitterInterface::class)
        );
    }
687556
public function createService(ServiceLocatorInterface $container)
    {
        // Retrieve the parent container when under zend-servicemanager v2
        if (method_exists($container, 'getServiceLocator')) {
            $container = $container->getServiceLocator() ?: $container;
        }

        return $this($container, ModuleOptions::class);
    }
649891
public function execute(Container $container = null): string
    {
       try {
           $this->response = $this->response->withHeader(
               Response::HEADER_CONTENT_TYPE,
               $this->view->getContentType($this->request)
           );
           $args = [];
           $action = $this->request->getAttribute("action", "");
           if ($container) {
               foreach (
                   (new ReflectionMethod($this, $action))->getParameters()
                as $value) {
                   $args[] = $container->get($value->getType()->__toString());
               }
           }
           $this->__call($action, $args);
           return $this->view->render();
       } catch (Throwable $e) {
           $this->response = $e instanceof ViewException
                           ? $this->response->withStatus(406)
                           : ($e instanceof BadMethodCallException
                           || $e instanceof ReflectionException
                           ? $this->response->withStatus(405)
                           : ($e instanceof ModelException
                           ? $this->response->withStatus(404)
                           : $this->response->withStatus(500)));
           throw new RuntimeException(
               "Can't execute " . static::class . ": " .$e->getMessage());
       }
    }
457369
public function pathResolvable(Container $container)
    {
        $news = $this->loadNewsFromPath($container);
        return ($news instanceof NewsInterface) && $news->id();
    }
574460
protected function makeController($controller)
	{
		Controller::setFilterer($this->filterer);

		return $this->container->make($controller);
	}
1121413
protected function createController($controller)
    {
        if (false === strpos($controller, '::')) {
            throw new \InvalidArgumentException(sprintf('Unable to find controller "%s".', $controller));
        }

        list($class, $method) = explode('::', $controller, 2);

        if ($this->container->has($class)) {
            $controller = $this->container->get($class);
        } else {
            if ( ! class_exists($class)) {
                throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
            }

            $controller = new $class();
        }

        if ($controller instanceof ContainerAwareInterface) {
            $controller->setContainer($this->container);
        }

        return array($controller, $method);
    }
109410
protected static function ctxGetContainer(ContextInterface $context): ContainerInterface
    {
        assert(static::ctxHasContainer($context));

        return $context->get(ContextProperties::CTX_CONTAINER);
    }
749984
public function get(Container $container)
    {
        if ($this->scope === null) {
            $this->scope = $this->getDefaultScope();
        }

        return $this->scope->get($this, $container);
    }
1142310
private function getControllerLocator($controller)
    {
        $class = null;
        $prefix = null;

        if (0 === strpos($controller, '@')) {
            $file = $this->locator->locate($controller);
            $controllerClass = ClassUtils::findClassInFile($file);

            if (false === $controllerClass) {
                throw new \InvalidArgumentException(sprintf('Can\'t find class for controller "%s"', $controller));
            }

            $controller = $controllerClass;
        }

        if ($this->container->has($controller)) {
            // service_id
            $prefix = $controller.':';

            if (Kernel::VERSION_ID >= 40100) {
                $prefix .= ':';
            }

            $useScope = method_exists($this->container, 'enterScope') && $this->container->hasScope('request');
            if ($useScope) {
                $this->container->enterScope('request');
                $this->container->set('request', new Request());
            }
            $class = get_class($this->container->get($controller));
            if ($useScope) {
                $this->container->leaveScope('request');
            }
        } elseif (class_exists($controller)) {
            // full class name
            $class = $controller;
            $prefix = $class.'::';
        } elseif (false !== strpos($controller, ':')) {
            // bundle:controller notation
            try {
                $notation = $this->controllerParser->parse($controller.':method');
                list($class) = explode('::', $notation);
                $prefix = $class.'::';
            } catch (\Exception $e) {
                throw new \InvalidArgumentException(
                    sprintf('Can\'t locate "%s" controller.', $controller)
                );
            }
        }

        if (empty($class)) {
            throw new \InvalidArgumentException(sprintf(
                'Class could not be determined for Controller identified by "%s".', $controller
            ));
        }

        return [$prefix, $class];
    }
1056027
public static function get(ContainerInterface $container) {
    $storage_type = $container
      ->get('config.factory')
      ->get('acm.commerce_users')
      ->get('storage_type');

    switch ($storage_type) {
      case 'database_store':
        $storage = $container
          ->get('acm.database_session_store')
          ->get('acm');
        break;

      default:
        $storage = $container
          ->get('acm.php_session_store');
        break;
    }

    return $storage;
  }
304559
public function createService(ServiceLocatorInterface $container)
    {
        // Retrieve the parent container when under zend-servicemanager v2
        if (method_exists($container, 'getServiceLocator')) {
            $container = $container->getServiceLocator() ?: $container;
        }

        return $this($container, Writer\Db::class);
    }
1308906
protected function FormUrl(Container $container = null)
    {
        
        $args = array();
        if ($container)
        {
            $args['container'] = $container->GetID();
        }
        return BackendRouter::ModuleUrl(new ContainerForm(), $args);
    }
530799
public function getOptions(ContainerInterface $container)
    {
        $options = $container->get('config');
        $options = $options['zend_authentication']['options'];
        $options['objectManager'] = $container->get(EntityManager::class);

        return new Authentication($options);
    }