示例#1
0
 /// <summary>
 /// Formats a property name for serialization according to its visibility and declaing type.
 /// </summary>
 /// <param name="property">The property info.</param>
 /// <returns>The property name formatted according to the <paramref name="property"/> as used by PHP serialization.
 /// </returns>
 public static string /*!*/ FormatSerializedPropertyName(PhpPropertyInfo /*!*/ property)
 {
     if (property.IsPrivate)
     {
         return("\0" + property.ContainingType.Name + "\0" + property.PropertyName);
     }
     if (property.IsProtected)
     {
         return("\0*\0" + property.PropertyName);
     }
     return(property.PropertyName);
 }
示例#2
0
 /// <summary>
 /// Formats a property name for serialization according to its visibility and declaing type.
 /// </summary>
 /// <param name="property">The property info.</param>
 /// <param name="declaringtype">Declaring type of the property.</param>
 /// <returns>The property name formatted according to the <paramref name="property"/> as used by PHP serialization.
 /// </returns>
 public static string /*!*/ FormatSerializedPropertyName(PhpPropertyInfo /*!*/ property, PhpTypeInfo declaringtype)
 {
     if (property.IsPrivate)
     {
         return("\0" + declaringtype.Name + "\0" + property.PropertyName);
     }
     if (property.IsProtected)
     {
         return("\0*\0" + property.PropertyName);
     }
     return(property.PropertyName);
 }
示例#3
0
        /// <summary>
        /// Gets field name to be used as array key when casting object to array.
        /// </summary>
        static string FieldAsArrayKey(PhpPropertyInfo p)
        {
            Debug.Assert(p != null);

            if (p.IsPublic)
            {
                return(p.PropertyName);
            }

            if (p.IsPrivate)
            {
                return(" " + p.ContainingType.Name + " " + p.PropertyName);
            }

            //if (m.IsPhpProtected())
            {
                return(" * " + p.PropertyName);
            }
        }