public static function locateExternalContainer()
    {
        // Get container from global var $app;
        // a Slim\App\Container or something similar.
        if (!empty($GLOBALS['app'])) {
            /** @var \Slim\App $app */
            $app = $GLOBALS['app'];
            if (method_exists($app, 'getContainer')) {
                /** @var \Psr\Container\ContainerInterface $container */
                $container = $app->getContainer();
                if ($container instanceof ContainerInterface) {
                    return $container;
                }
            }
        }
        return null;
    }
public static function locateExternalContainer()
    {
        // Get container from global var $app;
        // a Slim\App\Container or something similar.
        if (!empty($GLOBALS['app'])) {
            /** @var \Slim\App $app */
            $app = $GLOBALS['app'];
            if (method_exists($app, 'getContainer')) {
                /** @var \Psr\Container\ContainerInterface $container */
                $container = $app->getContainer();
                if ($container instanceof ContainerInterface) {
                    return $container;
                }
            }
        }
        return null;
    }
public static function locateExternalContainer ( ) { // Get container from global var $app; // a Slim\App\Container or something similar. if ( ! empty ( $ GLOBALS [ 'app' ] ) ) { /** @var \Slim\App $app */ $ app = $ GLOBALS [ 'app' ] ; if ( method_exists ( $ app , 'getContainer' ) ) { /** @var \Psr\Container\ContainerInterface $container */ $ container = $ app -> getContainer ( ) ; if ( $ container instanceof ContainerInterface ) { return $ container ; } } } return null ; }
Try finding an external container.

This implementation only supports Slim\App\Container or similar,
accessible via global var $app.

Method public for test reasons. Call container() instead.

@return ContainerInterface|null
Null: none found.
Try finding an external container .