예제 #1
0
 private PhpValue(PhpString.Blob blob)
 {
     Debug.Assert(blob != null);
     _type  = TypeTable.MutableStringTable;
     _value = default(ValueField);
     _obj   = blob;
 }
예제 #2
0
        public static int Compare(PhpString.Blob sx, PhpValue y)
        {
            switch (y.TypeCode)
            {
            case PhpTypeCode.Boolean: return(Compare(sx.ToBoolean(), y.Boolean));

            case PhpTypeCode.Long: return(Compare(sx.ToString(), y.Long));

            case PhpTypeCode.Double: return(Compare(sx.ToString(), y.Double));

            case PhpTypeCode.PhpArray: return(-1);      // - 1 * (array.CompareTo(string))

            case PhpTypeCode.String: return(Compare(sx.ToString(), y.String));

            case PhpTypeCode.MutableString: return(Compare(sx, y.MutableStringBlob));

            case PhpTypeCode.Object: return(CompareStringToObject(sx.ToString(), y.Object));

            case PhpTypeCode.Alias: return(Compare(sx, y.Alias.Value));

            case PhpTypeCode.Null: return((sx.Length == 0) ? 0 : 1);
            }

            throw InvalidTypeCodeException("compare", "string", y.TypeCode.ToString());
        }
예제 #3
0
 internal static PhpValue Create(PhpString.Blob blob) => new PhpValue(blob);