<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Dolstagis.Web.Lifecycle
{
    public class Interceptors
    {
        private IList<IInterceptor> _interceptors;

        public Interceptors()
        {
            _interceptors = new List<IInterceptor>();
        }

        public Interceptors(IEnumerable<IInterceptor> interceptors)
        {
            _interceptors = interceptors.ToList();
        }

        public async Task<IRequestContext> BeginRequest(IRequestContext context)
        {
            foreach (var interceptor in _interceptors) {
                context = await interceptor.BeginRequest(context);
            }
            return context;
        }

        public async Task<object> ControllerFound(IRequestContext context, object controller)
        {
            foreach (var interceptor in _interceptors) {
                controller = await interceptor.ControllerFound(context, controller);
            }
            return controller;
        }

        public async Task<object[]> ModelBound(IRequestContext context, object[] model, MethodInfo method)
        {
            foreach (var interceptor in _interceptors) {
                model = await interceptor.ModelBound(context, model, method);
            }
            return model;
        }

        public async Task<object> ControllerResult(IRequestContext context, object controller, object result)
        {
            foreach (var interceptor in _interceptors) {
                result = await interceptor.ControllerResult(context, controller, result);
            }
            return result;
        }


        public async Task<Exception> Exception(IRequestContext context, Exception ex)
        {
            foreach (var interceptor in _interceptors) {
                ex = await interceptor.Exception(context, ex);
            }
            return ex;
        }

        public async Task EndRequest(IRequestContext context)
        {
            foreach (var interceptor in _interceptors) {
                await interceptor.EndRequest(context);
            }
        }
    }
}
<commit_msg>Fix breaking tests.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Dolstagis.Web.Lifecycle
{
    public class Interceptors
    {
        private IList<IInterceptor> _interceptors;

        public Interceptors()
        {
            _interceptors = new List<IInterceptor>();
        }

        public Interceptors(IEnumerable<IInterceptor> interceptors)
        {
            _interceptors = interceptors?.ToList() ?? new List<IInterceptor>();
        }

        public async Task<IRequestContext> BeginRequest(IRequestContext context)
        {
            foreach (var interceptor in _interceptors) {
                context = await interceptor.BeginRequest(context);
            }
            return context;
        }

        public async Task<object> ControllerFound(IRequestContext context, object controller)
        {
            foreach (var interceptor in _interceptors) {
                controller = await interceptor.ControllerFound(context, controller);
            }
            return controller;
        }

        public async Task<object[]> ModelBound(IRequestContext context, object[] model, MethodInfo method)
        {
            foreach (var interceptor in _interceptors) {
                model = await interceptor.ModelBound(context, model, method);
            }
            return model;
        }

        public async Task<object> ControllerResult(IRequestContext context, object controller, object result)
        {
            foreach (var interceptor in _interceptors) {
                result = await interceptor.ControllerResult(context, controller, result);
            }
            return result;
        }


        public async Task<Exception> Exception(IRequestContext context, Exception ex)
        {
            foreach (var interceptor in _interceptors) {
                ex = await interceptor.Exception(context, ex);
            }
            return ex;
        }

        public async Task EndRequest(IRequestContext context)
        {
            foreach (var interceptor in _interceptors) {
                await interceptor.EndRequest(context);
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.06908537910058657, 'fraction_numerical': 0.0, 'mean_word_length': 1.8367221195317314, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '331', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1047, 'n_words': 274}