Login   Register  
PHP Classes

Class: Access Methods

Icontem
elePHPant

  Classes of Olavo Alexandrino  >  Access Methods  >  Download  >  Support forum Support forum (1)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Access Methods Support forum
Base name: accessmethods
Description: Map variable accesses to accessor method calls
Version: -
Required PHP version: -
License: BSD License
 
  Author   Group folder image Groups   Detailed description  
  Applications   Related links   Files Files  

Author

Picture of Olavo Alexandrino
Name: Olavo Alexandrino <e-mail contact>
Published packages: 8 Browse this author's classes Browse this author's classes
Country: Brazil Brazil - PHP jobs in Brazil
Home page: http://oalexandrino.com/

Innovation Award

PHP Programming Innovation award nominee
July 2006
Number 7
Some authors prefer to encapsulate the access to the properties of objects of a class using setter and getter functions and making the property variables private.

This approach allows allows changing the implementation of the access to the properties without changing the interface of the class.

Despite the advantages of this approach, many users prefer the variable assignment syntax to set or get the property values, as it is less tedious.

This class makes possible to use the variable assignment syntax to access the properties while keeping the setter and getter approach.

It takes advantage of the PHP 5 special class functions __set and __get functions and the reflection API to determine which functions should be called set or get property values.

Manuel Lemos

Groups

Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Language Constructs to assist in the language control View top rated classes

Detailed description

This class can be used to map accesses to class variables into calls to setter and getter methods.

It provides functions that can called from a class __set and __get methods to automatically set or get the property values by calling the class setter and getter methods for the respective properties.

For example, if there is a property named "name", the class accessor methods usually are named of "getName" and "setName". Accesses to $object->name property are mapped to $object->setName($value) and $object->getName() calls.

Applications that use this class

No application links were specified for this class.
Add link image If you know an application of this package, send a message to the author to add a link here.

Related links

Link Description
The AccessMethods class Documentation This link has a little documentation of class
oalexandrino's classes This link contains a summary of my classes

Files

File Role Description
Plain text file test.php Example An example of use
Plain text file class.AccessMethods.php Class The AccessMethods class
Download all files: accessmethods.tar.gz accessmethods.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.