Super Proxy: Create object to access private members

Recommend this page to a friend!
  Info   View files (1)   Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
59%Total: 474 All time: 5,904 This week: 345
Version License PHP version Categories
super-proxy 1.0GNU General Publi...5.2PHP 5, Language, Testing
Description Author

This class can be used to create object of a class in order to access private and protected variables and functions of another class.

It uses reflection to create a copy of the declaration of a given class and changes it to turn private and protected variables and functions.

The class can create an object of the original class copy.

Innovation Award
PHP Programming Innovation award nominee
September 2009
Number 5


Prize: One subscription to the PDF edition of the PHP Architect magazine
When you want to perform a tests that verify whether a given class works as expected, you may need to call functions or access variables that are private or protected.

That circumstance raises a difficulty because you can only access private and protected members from inside the same class.

This class provides a workaround that consists in creating a clone of the original class which has all private and protected variables and functions made public.

This way it becomes possible to access all class members for testing purposes.

Manuel Lemos
Picture of Mathias Krieck
Name: Mathias Krieck is available for providing paid consulting. Contact Mathias Krieck .
Classes: 1 package by
Country: Germany Germany
Age: 41
All time rank: 3257188 in Germany Germany
Week rank: 762 36 in Germany Germany
Innovation award
Innovation award
Nominee: 1x

  Files  
File Role Description
SuperProxy.php Class Proxy class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:474
This week:0
All time:5,904
This week:345
User Ratings User Comments (2)
 All time
Utility:100%
Consistency:91%
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:59%
Rank:1445
 
Interestingly and short art for change of properties and meth...
7 years ago (franzusow)
60%
Great idea.
10 years ago (Vladimir Bogdanov)
57%
 

For more information send a message to info at phpclasses dot org.