Login   Register  
PHP Classes
elePHPant
Icontem

Friendly class: Provide friend access to protected functions

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2008-11-27 (5 years ago) RSS 2.0 feedNot enough user ratingsTotal: 575 This week: 1All time: 4,818 This week: 1,420Up
Version License PHP version Categories  
friendly_class 1.0GNU Lesser General Publ...5.0PHP 5, Language
Description Author  
PHP Programming Innovation award nominee
August 2008
Number 3


Prize: One book of choice by Packt
This class can be used to provide access to protected or private functions from friend classes.

It is a base class that provides alternative methods prefixed with the name friend_ .

When a function is called with that prefix, the base class calls the function with the name after the prefix, if it is considered a friend method.
Picture of Rubens Takiguti Ribeiro
Name: Rubens Takiguti Ribeiro is available for providing paid consulting. Contact Rubens Takiguti Ribeiro .
Classes: 7 packages by
Country: Brazil Brazil
Age: 30
All time rank: 65952 in Brazil Brazil
Week rank: 465 Up37 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 3x

  Files folder image Files  
File Role Description
Plain text file friendly_class.class.php Class Main class
Plain text file doc.php Doc. Documentation
Accessible without login Plain text file example.php Example Simple example
Plain text file LICENSE.TXT Lic. License

Innovation Award  
PHP Programming Innovation award nominee
August 2008
Number 3


Prize: One book of choice by Packt
Certain packages consist of multiple classes that are used in cooperation. Such classes usually need to access each other protected variables or functions.

In other languages there are friend classes like in C++ or package classes like in Java that allow restricting the access to variables of functions to cooperating classes.

Even with the enhancements of version 5 object model, there is no PHP support to this concept similar to C++ friend or Java package classes.

This class provides an emulation of such concept that works under PHP 5.

Manuel Lemos
 Version Control Unique User Downloads Download Rankings  
 0%Total:575All time:4,818
 This week:1This week:1,420Up