src/ContainerAwareTrait.php
protected function _setContainer($container)
    {
        if (!is_null($container) && !($container instanceof BaseContainerInterface)) {
            throw $this->_createInvalidArgumentException($this->__('Not a valid container'), 0, null, $container);
        }

        $this->container = $container;

        return $this;
    }
protected function _setContainer($container)
    {
        if (!is_null($container) && !($container instanceof BaseContainerInterface)) {
            throw $this->_createInvalidArgumentException($this->__('Not a valid container'), 0, null, $container);
        }

        $this->container = $container;

        return $this;
    }
Associates a container with this instance.

@since [*next-version*]

@param BaseContainerInterface|null $container The container.

@throws InvalidArgumentException If not a valid container.