PEAR::PEAR_Callback
書いている時点でまだDraftですが、結構ヨサゲなパッケージが提案されています。
ドキュメントも整備されていて、使い方もさほど難しくなさそうです。また、PEAR_Callback::checkSignature()とかは特徴的ですね。
This package addresses three major limitations of the callback pseudo-type:
- By looking at a callback pseudo-type variable you cannot tell if it really is a callback.
- The callback pseudo-type does not allow you to specify arguments at the time you create the callback.
- There is no way to force a user to pass only callback functions to your API, that meet certain requirements (i.e. accept certain arguments and have a certain return type)