Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class event implements SplSubject {
- private $storage;
- const PRE_EVENT = 1;
- const POST_EVENT = 2;
- function __construct() {
- $this->storage = new SplObjectStorage();
- }
- public function init()
- {
- }
- function attach( SplObserver $observer ) {
- $this->storage->attach( $observer );
- }
- function detach( SplObserver $observer ) {
- $this->storage->detach( $observer );
- }
- function notify()
- {
- foreach ( $this->storage as $observer )
- {
- $observer->update( $this );
- }
- }
- } // end events class
Add Comment
Please, Sign In to add comment