svn: /phpdoc/en/trunk/language/oop5/ overloading.xml

From: Date: Tue, 06 Dec 2011 19:47:01 +0000
Subject: svn: /phpdoc/en/trunk/language/oop5/ overloading.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-9168@lists.php.net to get a copy of this message
saltybeagle Tue, 06 Dec 2011 19:47:01 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=320521 Log: Follow coding standards for sample code, as in http://doc.php.net/php/dochowto/chapter-conventions.php #7 Bug: https://bugs.php.net/7 (Closed) apache 1.3b3 fails to compile with php3 module Changed paths: U phpdoc/en/trunk/language/oop5/overloading.xml Modified: phpdoc/en/trunk/language/oop5/overloading.xml =================================================================== --- phpdoc/en/trunk/language/oop5/overloading.xml 2011-12-06 19:01:21 UTC (rev 320520) +++ phpdoc/en/trunk/language/oop5/overloading.xml 2011-12-06 19:47:01 UTC (rev 320521) @@ -167,7 +167,8 @@ <programlisting role="php"> <![CDATA[ <?php -class PropertyTest { +class PropertyTest +{ /** Location for overloaded data. */ private $data = array(); @@ -177,12 +178,14 @@ /** Overloading only used on this when accessed outside the class. */ private $hidden = 2; - public function __set($name, $value) { + public function __set($name, $value) + { echo "Setting '$name' to '$value'\n"; $this->data[$name] = $value; } - public function __get($name) { + public function __get($name) + { echo "Getting '$name'\n"; if (array_key_exists($name, $this->data)) { return $this->data[$name]; @@ -198,19 +201,22 @@ } /** As of PHP 5.1.0 */ - public function __isset($name) { + public function __isset($name) + { echo "Is '$name' set?\n"; return isset($this->data[$name]); } /** As of PHP 5.1.0 */ - public function __unset($name) { + public function __unset($name) + { echo "Unsetting '$name'\n"; unset($this->data[$name]); } /** Not a magic method, just here for example. */ - public function getHidden() { + public function getHidden() + { return $this->hidden; } } @@ -306,15 +312,18 @@ <programlisting role="php"> <![CDATA[ <?php -class MethodTest { - public function __call($name, $arguments) { +class MethodTest +{ + public function __call($name, $arguments) + { // Note: value of $name is case sensitive. echo "Calling object method '$name' " . implode(', ', $arguments). "\n"; } /** As of PHP 5.3.0 */ - public static function __callStatic($name, $arguments) { + public static function __callStatic($name, $arguments) + { // Note: value of $name is case sensitive. echo "Calling static method '$name' " . implode(', ', $arguments). "\n";

« previous php.doc.cvs (#9168) next »