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 https://nette.org
- 12: *
- 19: */
- 29: /**
- 30: * Nette\Object is the ultimate ancestor of all instantiable classes.
- 31: *
- 32: * It defines some handful methods and enhances object core of PHP:
- 33: * - access to undeclared members throws exceptions
- 34: * - support for conventional properties with getters and setters
- 35: * - support for event raising functionality
- 36: * - ability to add new methods to class (extension methods)
- 37: *
- 38: * Properties is a syntactic sugar which allows access public getter and setter
- 39: * methods as normal object variables. A property is defined by a getter method
- 40: * and optional setter method (no setter method means read-only property).
- 41: * <code>
- 42: * $val = $obj->label; // equivalent to $val = $obj->getLabel();
- 43: * $obj->label = 'Nette'; // equivalent to $obj->setLabel('Nette');
- 44: * </code>
- 45: * Property names are case-sensitive, and they are written in the camelCaps
- 46: * or PascalCaps.
- 47: *
- 48: * Event functionality is provided by declaration of property named 'on{Something}'
- 49: * Multiple handlers are allowed.
- 50: * <code>
- 51: * public $onClick; // declaration in class
- 52: * $this->onClick[] = 'callback'; // attaching event handler
- 53: * if (!empty($this->onClick)) ... // are there any handlers?
- 54: * $this->onClick($sender, $arg); // raises the event with arguments
- 55: * </code>
- 56: *
- 57: * Adding method to class (i.e. to all instances) works similar to JavaScript
- 58: * prototype property. The syntax for adding a new method is:
- 59: * <code>
- 60: * MyClass::extensionMethod('newMethod', function(MyClass $obj, $arg, ...) { ... });
- 61: * $obj = new MyClass;
- 62: * $obj->newMethod($x);
- 63: * </code>
- 64: *
- 68: */
- 70: {
- 72: /**
- 73: * Returns the name of the class of this object.
- 74: *
- 76: */
- 78: {
- 80: }
- 84: /**
- 85: * Access to reflection.
- 86: *
- 88: */
- 90: {
- 92: }
- 96: /**
- 97: * Call to undefined method.
- 98: *
- 103: */
- 105: {
- 107: }
- 111: /**
- 112: * Call to undefined static method.
- 113: *
- 118: */
- 120: {
- 123: }
- 127: /**
- 128: * Adding method to class.
- 129: *
- 133: */
- 135: {
- 140: }
- 142: }
- 146: /**
- 147: * Returns property value. Do not call directly.
- 148: *
- 152: */
- 154: {
- 156: }
- 160: /**
- 161: * Sets value of a property. Do not call directly.
- 162: *
- 167: */
- 169: {
- 171: }
- 175: /**
- 176: * Is property defined?
- 177: *
- 180: */
- 182: {
- 184: }
- 188: /**
- 189: * Access to undeclared property.
- 190: *
- 194: */
- 196: {
- 198: }
- 200: }