note 82896 added to language.oop5.overloading

From: Date: Wed, 30 Apr 2008 20:02:54 +0000
Subject: note 82896 added to language.oop5.overloading
Groups: php.notes 
Request: Send a blank email to php-notes+get-138946@lists.php.net to get a copy of this message
This is a generic implementation to use getter, setter, issetter and unsetter for your own classes. <?php abstract class properties { public function __get( $property ) { if( ! is_callable( array($this,'get_'.(string)$property) ) ) throw new BadPropertyException($this, (string)$property); return call_user_func( array($this,'get_'.(string)$property) ); } public function __set( $property, $value ) { if( ! is_callable( array($this,'set_'.(string)$property) ) ) throw new BadPropertyException($this, (string)$property); call_user_func( array($this,'set_'.(string)$property), $value ); } public function __isset( $property ) { if( ! is_callable( array($this,'isset_'.(string)$property) ) ) throw new BadPropertyException($this, (string)$property); return call_user_func( array($this,'isset_'.(string)$property) ); } public function __unset( $property ) { if( ! is_callable( array($this,'unset_'.(string)$property) ) ) throw new BadPropertyException($this, (string)$property); call_user_func( array($this,'unset_'.(string)$property) ); } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 82.236.114.103 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.overloading.php Edit -- https://master.php.net/note/edit/82896 Del: integrated -- https://master.php.net/note/delete/82896/integrated Del: useless -- https://master.php.net/note/delete/82896/useless Del: bad code -- https://master.php.net/note/delete/82896/bad+code Del: spam -- https://master.php.net/note/delete/82896/spam Del: non-english -- https://master.php.net/note/delete/82896/non-english Del: in docs -- https://master.php.net/note/delete/82896/in+docs Del: other reasons-- https://master.php.net/note/delete/82896 Reject -- https://master.php.net/note/reject/82896 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138946) next »