protected function _containerHas($container, $key)
    {
        $key = $this->_normalizeKey($key);

        if ($container instanceof BaseContainerInterface) {
            return $container->has($key);
        }

        if ($container instanceof ArrayAccess) {
            // Catching exceptions thrown by `offsetExists()`
            try {
                return $container->offsetExists($key);
            } catch (RootException $e) {
                throw $this->_createContainerException($this->__('Could not check for key "%1$s"', [$key]), null, $e, null);
            }
        }

        if (is_array($container)) {
            return array_key_exists($key, $container);
        }

        if ($container instanceof stdClass) {
            return property_exists($container, $key);
        }

        throw $this->_createInvalidArgumentException($this->__('Not a valid container'), null, null, $container);
    }