private static function getRequiredAttribute(
            $entity,
            string $name,
            string $method
    ) {
        if (!method_exists($entity, $method)) {
            throw new XmlException(
                    'RSSFeedItem ' . get_class($entity)
                    . ' does not offer a method named "' . $method
                    . '" to return the ' . $name . ', but ' . $name
                    . ' is required.'
            );
        }

        return $entity->$method();
    }