[ Index ] |
PHP Cross Reference of Unnamed Project |
[Source view] [Print] [Project Stats]
The attribute module provides an augmentable Attribute implementation, which adds configurable attributes and attribute change events to the class being augmented. It also provides a State class, which is used internally by Attribute, but can also be used independently to provide a name/property/value data structure to store state.
File Size: | 117 lines (5 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Attribute() X-Ref |
<p> Attribute provides configurable attribute support along with attribute change events. It is designed to be augmented on to a host class, and provides the host with the ability to configure attributes to store and retrieve state, along with attribute change events. </p> <p>For example, attributes added to the host can be configured:</p> <ul> <li>As read only.</li> <li>As write once.</li> <li>With a setter function, which can be used to manipulate values passed to Attribute's <a href="#method_set">set</a> method, before they are stored.</li> <li>With a getter function, which can be used to manipulate stored values, before they are returned by Attribute's <a href="#method_get">get</a> method.</li> <li>With a validator function, to validate values before they are stored.</li> </ul> <p>See the <a href="#method_addAttr">addAttr</a> method, for the complete set of configuration options available for attributes.</p> <p><strong>NOTE:</strong> Most implementations will be better off extending the <a href="Base.html">Base</a> class, instead of augmenting Attribute directly. Base augments Attribute and will handle the initial configuration of attributes for derived classes, accounting for values passed into the constructor.</p> param: attrs {Object} The attributes to add during construction (passed through to <a href="#method_addAttrs">addAttrs</a>). param: values {Object} The initial attribute values to apply (passed through to <a href="#method_addAttrs">addAttrs</a>). param: lazy {boolean} Whether or not to add attributes lazily (passed through to <a href="#method_addAttrs">addAttrs</a>). |
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |