public function makeImgElementResponsive(
        \DOMElement &$img, 
        $class, 
        $change_src_attr = false, 
        $add_default_dimension_attrs = false
    )
    {
        if ($img->tagName != 'img') throw new \InvalidArgumentException('$img must be an "img" element');
        if ((string) $class == '' || !array_key_exists($class, $this->classes)) {
            throw new ImageClassNotRegisteredException($class);
        }
        $imageurl = $img->getAttribute('src');
        if ($imageurl != '') {
            try {
                $ri = $this->getResponsiveImage($imageurl, $class);
                $img->setAttribute('srcset', $ri->getSrcsetAttributeValue());
                $img->setAttribute('sizes', $ri->getSizesAttributeValue());
                $default = $ri->getDefaultImageInfo();
                if ($default instanceof WebImageInfo) {
                    if ($change_src_attr) {
                        $img->setAttribute('src', $default->getUrl());
                    }
                    if ($add_default_dimension_attrs) {
                        $img->setAttribute('width', $default->getWidth());
                        $img->setAttribute('height', $default->getHeight());
                    }
                }
            } catch (\Exception $e) {
            };
        }
    }