Class Ando_Function for PHP

EDIT: https://github.com/aercolino/ando-php

This is a simple class for creating generic callbacks in PHP. There are a couple of reasons for using this class instead of the usual ´array( $container, $function )´ method.

First, the usual method doesn’t allow you to run the called code with more arguments than those provided by the calling code.

Second, this class resolves to the usual method when no extra arguments are provided, thus making it transparent at run time. This could seem useless, but, for free, we get much easier to spot callback calling points.

{[ .class-func | 1.hilite(=php=) ]}

Here are some tests.

{[ .tests | 1.hilite(=php=) ]}

Screen Shot 2014-10-28 at 16.53.43

(previous permalink: class-func-for-php)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.