PHP Classes

Null Object: Set objects that do nothing but avoid fatal errors

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 49%Total: 247 All time: 7,964 This week: 206Up
Version License PHP version Categories
null-object 1.0.0BSD License5.3PHP 5, Language
Description 

Author

This class can setup objects that do nothing but avoid fatal errors.

It has the magic methods __call and __set that do not do anything but return the class object itself.

This ways the object be used in chained function calls without causing fatal errors.

Innovation Award
PHP Programming Innovation award nominee
July 2013
Number 8


Prize: One subscription to the PDF edition of the PHP Architect magazine
Sometimes applications need to pass objects but that do not do anything useful but can handle accesses to functions and variables that do not really exist.

This class can be used for those situations. It provides magic methods that return the class object so it can be used in chained function calls.

Manuel Lemos
Picture of Elger van Boxtel
  Performance   Level  
Name: Elger van Boxtel <contact>
Classes: 3 packages by
Country: The Netherlands The Netherlands
Age: ???
All time rank: 295178 in The Netherlands The Netherlands
Week rank: 200 Up6 in The Netherlands The Netherlands Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files (1)  
File Role Description
Plain text file NullObject.php Class NullObject pattern

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:247
This week:0
All time:7,964
This week:206Up
 User Ratings  
 
 All time
Utility:83%StarStarStarStarStar
Consistency:75%StarStarStarStar
Documentation:-
Examples:-
Tests:-
Videos:-
Overall:49%StarStarStar
Rank:2878