<commit_before>﻿using System;
using System.Linq;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using Umbraco.Core.Models.Blocks;
using Umbraco.Core.Models.PublishedContent;
using System.Web;

namespace Umbraco.Web
{
    public static class BlockListTemplateExtensions
    {
        public const string DefaultFolder = "BlockList/";
        public const string DefaultTemplate = "Default";

        public static IHtmlString GetBlockListHtml(this HtmlHelper html, BlockListModel model, string template = DefaultTemplate)
        {
            if (model?.Count == 0) return new MvcHtmlString(string.Empty);

            var view = DefaultFolder + template;
            return html.Partial(view, model);
        }

        public static IHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedProperty property, string template = DefaultTemplate) => GetBlockListHtml(html, property?.GetValue() as BlockListModel, template);

        public static IHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedContent contentItem, string propertyAlias) => GetBlockListHtml(html, contentItem, propertyAlias, DefaultTemplate);

        public static IHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedContent contentItem, string propertyAlias, string template)
        {
            if (propertyAlias == null) throw new ArgumentNullException(nameof(propertyAlias));
            if (string.IsNullOrWhiteSpace(propertyAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(propertyAlias));

            var prop = contentItem.GetProperty(propertyAlias);
            if (prop == null) throw new InvalidOperationException("No property type found with alias " + propertyAlias);

            return GetBlockListHtml(html, prop?.GetValue() as BlockListModel, template);
        }

        public static IHtmlString GetBlockListHtml(this IPublishedProperty property, HtmlHelper html, string template = DefaultTemplate) => GetBlockListHtml(html, property?.GetValue() as BlockListModel, template);

        public static IHtmlString GetBlockListHtml(this IPublishedContent contentItem, HtmlHelper html, string propertyAlias) => GetBlockListHtml(html, contentItem, propertyAlias, DefaultTemplate);

        public static IHtmlString GetBlockListHtml(this IPublishedContent contentItem, HtmlHelper html, string propertyAlias, string template) => GetBlockListHtml(html, contentItem, propertyAlias, template);
    }
}<commit_msg>removing duplicated extension methods that could encourage bad practice when used in the wrong way.<commit_after>﻿using System;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using Umbraco.Core.Models.Blocks;
using Umbraco.Core.Models.PublishedContent;
using System.Web;

namespace Umbraco.Web
{
    public static class BlockListTemplateExtensions
    {
        public const string DefaultFolder = "BlockList/";
        public const string DefaultTemplate = "Default";

        public static IHtmlString GetBlockListHtml(this HtmlHelper html, BlockListModel model, string template = DefaultTemplate)
        {
            if (model?.Count == 0) return new MvcHtmlString(string.Empty);

            var view = DefaultFolder + template;
            return html.Partial(view, model);
        }

        public static IHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedProperty property, string template = DefaultTemplate) => GetBlockListHtml(html, property?.GetValue() as BlockListModel, template);

        public static IHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedContent contentItem, string propertyAlias) => GetBlockListHtml(html, contentItem, propertyAlias, DefaultTemplate);

        public static IHtmlString GetBlockListHtml(this HtmlHelper html, IPublishedContent contentItem, string propertyAlias, string template)
        {
            if (propertyAlias == null) throw new ArgumentNullException(nameof(propertyAlias));
            if (string.IsNullOrWhiteSpace(propertyAlias)) throw new ArgumentException("Value can't be empty or consist only of white-space characters.", nameof(propertyAlias));

            var prop = contentItem.GetProperty(propertyAlias);
            if (prop == null) throw new InvalidOperationException("No property type found with alias " + propertyAlias);

            return GetBlockListHtml(html, prop?.GetValue() as BlockListModel, template);
        }
    }
}
{'fraction_non_alphanumeric': 0.0758057194734453, 'fraction_numerical': 0.00045392646391284613, 'mean_word_length': 4.190812720848056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2486180', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1050, 'n_words': 334}