PHP Classes

Armory PHP Closure Trait: Cache, rename and hide anonymous functions

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (2)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 144 This week: 1All time: 9,032 This week: 174Up
Version License PHP version Categories
armory 1.0.0Freeware7Language, Design Patterns, PHP 7, Traits
Description Author

This package provides a trait to cache, rename and hide your anonymous and callback functions in a class object instance.

It provides a protected array to store the functions under a different name.

By declaring the functions as properties of the class object, getter and setter methods take care of the hiding. The executing scope is preserved.

The trait can be used to gather all callback functions and store them in a protected variable to avoid name collisions.

It can also make class functions available without the necessity of retrieving the object instances first.

Innovation Award
PHP Programming Innovation award nominee
August 2020
Number 3
Some classes need to implement a callback system that allows applications to customize actions to be executed when certain events happen inside the class.

This package provides a trait that can be used to quickly add callback function registration and invocation for any number of types of events that a class may trigger.

Manuel Lemos
Picture of wim niemans
  Performance   Level  
Name: wim niemans <contact>
Classes: 6 packages by
Country: The Netherlands The Netherlands
Innovation award
Innovation award
Nominee: 2x

  Files folder image Files  
File Role Description
Plain text file armory.php Class Armory Trait
Accessible without login Plain text file demo.php Example Armory Demo

 Version Control Unique User Downloads Download Rankings  
 0%
Total:144
This week:1
All time:9,032
This week:174Up
For more information send a message to info at phpclasses dot org.