示例#1
0
        private static Value _md5(FlowController flow, Value[] arguments)
        {
            stringConverter.SetContext(flow);
            var stringValue = stringConverter.EvaluateToString(arguments[0]);

            if (stringValue == null)
            {
                return(flow.OutSet.AnyStringValue);
            }

            var phpBytes = new PhpBytes(stringValue.Value);

            Debug.Assert(arguments.Length > 0);

            if (arguments.Length > 1)
            {
                booleanConverter.SetContext(flow.OutSet.Snapshot);
                var isRawOutput = booleanConverter.EvaluateToBoolean(arguments[1]);

                if ((isRawOutput == null) || isRawOutput.Value)
                {
                    // TODO: Implement precisely
                    return(flow.OutSet.AnyStringValue);
                }
            }

            return(flow.OutSet.CreateString(PhpHash.MD5(phpBytes)));
        }