public FunctionList Parse()
        {
            var logger        = loggerFactory.CreateLogger <FunctionList>();
            var functionsList = new FunctionList();

            if (string.IsNullOrEmpty(operations) == false)
            {
                logger.LogInformation("raw operations presented {operations}", operations);

                var ops = operations
                          .ToLowerInvariant()
                          .Split(';', StringSplitOptions.RemoveEmptyEntries);

                var produceThumbnail = false;

                foreach (var op in ops)
                {
                    logger.LogInformation("trying op '{op}'", op);

                    var matched = false;

                    foreach (var builder in builders)
                    {
                        logger.LogInformation("  matching against {0}", builder.Key);

                        var regex = new Regex(builder.Key);
                        var match = regex.Match(op);

                        if (match.Success && "thumb".Equals(op))
                        {
                            produceThumbnail = true;
                            matched          = true;
                            break;
                        }
                        else if (match.Success)
                        {
                            var func = builder.Value(match);
                            logger.LogInformation("adding operation '{0}' to list", op);
                            functionsList.Add(func);

                            matched = true;
                            break;
                        }
                    }

                    if (matched == false)
                    {
                        logger.LogInformation("invalid operation '{op}'", op);
                        throw new InvalidOperationException(string.Format("Operation '{0}' is not a valid transform", op));
                    }
                }

                if (produceThumbnail == true)
                {
                    var func = builders["thumb"](null);

                    logger.LogInformation("adding final thumbnail operation to list");
                    functionsList.Add(func);
                }
            }

            logger.LogInformation("all transforms parsed, there are {0}", functionsList.NumberOfOperations);
            return(functionsList);
        }
 public FunctionProcessor(FunctionList functionsList, ILoggerFactory loggerFactory)
 {
     this.functionsList = functionsList.Functions;
     this.loggerFactory = loggerFactory;
 }