Login   Register  
PHP Classes
elePHPant
Icontem

Decorate: Alter functions running code before and after

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 (15)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2014-02-02 (10 months ago) RSS 2.0 feedNot enough user ratingsTotal: 332 All time: 6,414 This week: 1,382Up
Version License PHP version Categories  
decorate 1BSD License5.4PHP 5, Design Patterns
Description Author  

This class can alter functions adding code before and after they run.

It implements the decorator design pattern by taking a function and creating a new one that executes another given function before or after the original function is run.

The class returns the newly created function as a reference to the callable function.

Innovation Award  
PHP Programming Innovation award nominee
February 2014
Number 5
Sometimes you need to alter the behavior of functions by doing something before or after the original function code. That is the purpose of the decorator design pattern.

This class implements the decorator pattern by calling custom code before or after the original function code.

Manuel Lemos
Picture of jstar88
Name: jstar88 <contact>
Classes: 6 packages by
Country: Italy Italy
Age: ???
All time rank: 150660 in Italy Italy
Week rank: 305 Up18 in Italy Italy Up
Innovation award
Innovation award
Nominee: 2x

  Files folder image Files  
File Role Description
Files folder imageADT (2 files)
Files folder imagecore (4 files)
Files folder imageexamples (4 directories)
Plain text file Decorate.php Class The main class
Accessible without login Plain text file LICENSE.mid Lic. License text
Accessible without login HTML file offline-doc.html Doc. doc
Accessible without login Plain text file README.md Doc. git documentation

  Files folder image Files  /  ADT  
File Role Description
  Plain text file OnAfterDecorativeLinkedList.php Class Class source
  Plain text file OnBeforeDecorativeLinkedList.php Class Class source

  Files folder image Files  /  core  
File Role Description
  Plain text file FunctionEmulable.php Class Class source
  Plain text file FunctionEmulator.php Class Class source
  Plain text file OnAfterFunctionEmulator.php Class Class source
  Plain text file OnBeforeFunctionEmulator.php Class Class source

  Files folder image Files  /  examples  
File Role Description
Files folder imageADT (1 file)
Files folder imageaggregations (1 file)
Files folder imageonAfter (1 file)
Files folder imageonBefore (2 files)

  Files folder image Files  /  examples  /  ADT  
File Role Description
  Accessible without login Plain text file linkedlist.php Example Example script

  Files folder image Files  /  examples  /  aggregations  
File Role Description
  Accessible without login Plain text file strings.php Example Example script

  Files folder image Files  /  examples  /  onAfter  
File Role Description
  Accessible without login Plain text file round.php Example Example script

  Files folder image Files  /  examples  /  onBefore  
File Role Description
  Accessible without login Plain text file bandwidth.php Example Example script
  Accessible without login Plain text file login.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%Total:332All time:6,414
 This week:0This week:1,382Up
 User Comments (1)  
 
nice class!
8 months ago (Ovunc Tukenmez)
80%StarStarStarStarStar