public static function injectExternalContainer(ContainerInterface $container, string $setMethod = '')
    {
        if (static::$externalContainer) {
            throw new ContainerLogicException(
                'Can\'t inject external container when external container already exists.'
            );
        }
        if (static::$internalContainer) {
            throw new ContainerLogicException(
                'Can\'t inject external container when internal container already exists.'
            );
        }
        if ($setMethod) {
            if (!method_exists($container, $setMethod)) {
                throw new ContainerInvalidArgumentException(
                    'External container type[' . get_class($container) . '] has no method[' . $setMethod . '].');
            }
            static::$setMethod = $setMethod;
        } elseif ($container instanceof \ArrayAccess) {
            static::$setMethod = 'offsetSet';
        } elseif (!method_exists($container, 'set')) {
            throw new ContainerInvalidArgumentException(
                'Empty arg setMethod and external container type['
                . get_class($container) . '] has no set() method and is not ArrayAccess.'
            );
        }
        static::$externalContainer = $container;
    }