Source for file Object.php
Documentation is available at Object.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see http://nettephp.com
- 12: *
- 18: */
- 28: /**
- 29: * Nette\Object is the ultimate ancestor of all instantiable classes.
- 30: *
- 31: * It defines some handful methods and enhances object core of PHP:
- 32: * - access to undeclared members throws exceptions
- 33: * - support for conventional properties with getters and setters
- 34: * - support for event raising functionality
- 35: * - ability to add new methods to class (extension methods)
- 36: *
- 37: * Properties is a syntactic sugar which allows access public getter and setter
- 38: * methods as normal object variables. A property is defined by a getter method
- 39: * and optional setter method (no setter method means read-only property).
- 40: * <code>
- 41: * $val = $obj->label; // equivalent to $val = $obj->getLabel();
- 42: * $obj->label = 'Nette'; // equivalent to $obj->setLabel('Nette');
- 43: * </code>
- 44: * Property names are case-sensitive, and they are written in the camelCaps
- 45: * or PascalCaps.
- 46: *
- 47: * Event functionality is provided by declaration of property named 'on{Something}'
- 48: * Multiple handlers are allowed.
- 49: * <code>
- 50: * public $onClick; // declaration in class
- 51: * $this->onClick[] = 'callback'; // attaching event handler
- 52: * if (!empty($this->onClick)) ... // are there any handlers?
- 53: * $this->onClick($sender, $arg); // raises the event with arguments
- 54: * </code>
- 55: *
- 56: * Adding method to class (i.e. to all instances) works similar to JavaScript
- 57: * prototype property. The syntax for adding a new method is:
- 58: * <code>
- 59: * MyClass::extensionMethod('newMethod', function(MyClass $obj, $arg, ...) { ... });
- 60: * $obj = new MyClass;
- 61: * $obj->newMethod($x);
- 62: * </code>
- 63: *
- 67: *
- 70: */
- 72: {
- 74: /**
- 75: * Returns the name of the class of this object.
- 76: *
- 78: */
- 80: {
- 82: }
- 86: /**
- 87: * Access to reflection.
- 88: *
- 90: */
- 92: {
- 94: }
- 98: /**
- 99: * Call to undefined method.
- 100: *
- 105: */
- 107: {
- 109: }
- 113: /**
- 114: * Call to undefined static method.
- 115: *
- 120: */
- 122: {
- 125: }
- 129: /**
- 130: * Adding method to class.
- 131: *
- 135: */
- 137: {
- 142: }
- 144: }
- 148: /**
- 149: * Returns property value. Do not call directly.
- 150: *
- 154: */
- 156: {
- 158: }
- 162: /**
- 163: * Sets value of a property. Do not call directly.
- 164: *
- 169: */
- 171: {
- 173: }
- 177: /**
- 178: * Is property defined?
- 179: *
- 182: */
- 184: {
- 186: }
- 190: /**
- 191: * Access to undeclared property.
- 192: *
- 196: */
- 198: {
- 200: }
- 202: }