예제 #1
0
 /// <summary>
 /// Sets attributes for given node.
 /// </summary>
 /// <param name="node">Node to set properties for.</param>
 /// <param name="attributes">List of attributes. Can be <c>null</c> to remove attribites. Existing attributes are overwritten.</param>
 public static void SetAttributes(this IPropertyCollection node, IReadOnlyList <IAttributeElement> attributes)
 {
     if (attributes == null || attributes.Count == 0)
     {
         node.RemoveProperty <IReadOnlyList <IAttributeElement> >();
     }
     else
     {
         node.SetProperty(attributes);
     }
 }
예제 #2
0
        /// <summary>
        /// Sets <see cref="PHPDocBlock"/> to <paramref name="properties"/>.
        /// </summary>
        public static void SetPHPDoc(this IPropertyCollection /*!*/ properties, IDocBlock phpdoc)
        {
            if (phpdoc != null)
            {
                properties.SetProperty <IDocBlock>(phpdoc);

                // remember LangElement associated with phpdoc
                if (properties is LangElement element)
                {
                    phpdoc.Properties.SetProperty <LangElement>(element);
                }
            }
            else
            {
                properties.RemoveProperty <IDocBlock>();
            }
        }