Getter for creating/returning the unique instance of this class.

@param \Pimple\Container|\Slim\Container|array $container The application's settings.
@return self
172318
public static function instance($container = [])
    {
        if (!isset(static::$instance)) {
            $called_class = get_called_class();

            static::$instance = new $called_class($container);
        }

        return static::$instance;
    }
616893
public function setContainer($container)
    {
        if (!is_array($container) && !$container instanceof \ArrayAccess) {
            throw new InvalidArgumentException('array or ArrayAccess Object', 0);
        }

        $this->container = $container;

        return $this;
    }
140194
protected static function createContainer()
    {
        $app = JFactory::getApplication();

        if (is_null($app->get('container', null))) {
            $app->set('container', new Container());
        }

        $container = $app->get('container');

        if (!method_exists($container, 'set')) {
            $container = new Container($container);
        }

        return $container;
    }
157792
protected function setDependencies(Container $container)
    {
        parent::setDependencies($container);

        $displayDetails = $container['settings']['displayErrorDetails'];
        $this->setDisplayErrorDetails($displayDetails);

        return $this;
    }
679563
public static function initContainer($container)
    {
        if ($container instanceof \Pimple\Container) {
            static::$container = $container;
            static::$logger = static::$container
                ->offsetGet(\oat\oatbox\log\LoggerService::SERVICE_ID)
                ->getLogger();
        }
    }
522939
public static function prepareContainer(Container $container)
    {
        if ( ! isset($container['config'])) {
            $container['config'] = [];
        }
        if ( ! isset($container['files'])) {
            $container['files'] = new Filesystem();
        }
        if ( ! isset($container['providers'])) {
            $container['providers'] = [];
        }
        $providers = $container['providers'];
        $providers[] = 'Consolet\DefaultCommandsProvider';
        $container['providers'] = $providers;
        return $container;
    }
169718
public function setContainer($container) : Router
    {
        $this->container = $container;
        $this->routeController->setContainer($container);
        $this->resourceController->setRouter($this);

        return $this;
    }
1306223
public function getContainer()
    {
        if (!is_object($this->container)) {
            return $this->container = Container::getInstance();
        }

        return $this->container;
    }
1109205
public function getRendererManager(Container $container)
    {
        if ($this->rendererManager) {
            return $this->rendererManager;
        }

        return $container->get(RendererManager::class);
    }
188071
public static function getContainer()
    {
        if (!(self::$container instanceof Container)) {
            self::$container = new Container();
            self::$container->load();
        }

        return self::$container;
    }
603113
public function register(Container $container)
    {
        $container->prepareSharedObject(QueueManager::class);

        $container->share(Queue::class, function (Container $container) {
            $manager = $container->get('queue.manager');
            $queue   = $manager->create(false);

            // Worker also uses Queue object, share it once to prevent infinity loop
            $container->share(Queue::class, $queue);

            return $queue->setDriver($manager->createDriverByConnection());
        });

        // Worker
        $container->share(Worker::class, function (Container $container) {
            return $container->newInstance(
                Worker::class,
                [
                    'logger' => $container->get('logger')->createRotatingLogger('queue')
                ]
            );
        })->alias('queue.worker', Worker::class);

        // Failer
        $container->share(QueueFailerInterface::class, function (Container $container) {
            return $container->get('queue.manager')->createFailer();
        })->alias('queue.failer', QueueFailerInterface::class);

        // B/C
        $container->alias(\Windwalker\Core\Queue\Queue::class, Queue::class);
    }
1140187
public function provideBusinessLayerDependencies(Container $container): Container
    {
        $container = parent::provideBusinessLayerDependencies($container);
        $container = $this->addBrandTransferExpanderPlugins($container);

        return $container;
    }
940143
public function on($class)
    {
        $this->instance = is_string($class) ? $this->container !== null ? $this->container->make($class) : new $class : $class;
        
        return $this;
    }
39003
public function provideBusinessLayerDependencies(Container $container): Container
    {
        $container = parent::provideBusinessLayerDependencies($container);

        $container[static::SERVICE_COMPUTOP_API] = function () use ($container) {
            return $container->getLocator()->computopApi()->service();
        };

        $container[static::FACADE_STORE] = function () use ($container) {
            return new ComputopApiToStoreFacadeBridge($container->getLocator()->store()->facade());
        };

        return $container;
    }
1162688
public function containerInspect($container)
    {
        return $this->browser->get(
            $this->uri->expand(
                '/containers/{container}/json',
                array(
                    'container' => $container
                )
            )
        )->then(array($this->parser, 'expectJson'));
    }
908728
public function initDependencyContainer(Dependency\ContainerInterface $container = null)
    {
        if (null === $container) {
            $container = Dependency\Container::getInstance();
        }

        $this->dependencyContainer = $container;

        return $this;
    }
54108
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, ResponseSender::class);
    }