code: protected function _resolveContainer(BaseContainerInterface $container)
      {
          $parent = null;
  
          while ($container instanceof ContainerAwareInterface) {
              $parent = $container->getContainer();
  
              if (!($parent instanceof BaseContainerInterface)) {
                  break;
              }
              $container = $parent;
          }
  
          return $container;
      }
docs: Resolves the inner-most container of a container chain.
  
  Will recursively try and retrieve the assigned container, until reaching a non-container-aware container,
  or an inner container that is null, in which case the outer container is returned.
  
  @since [*next-version*]
  
  @param BaseContainerInterface|ContainerAwareInterface $container The optionally container-aware container to resolve.
  
  @return BaseContainerInterface The inner-most container.