Guest User

Untitled

a guest
Jan 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <?php
  2.  
  3. class event implements SplSubject {
  4.  
  5. private $storage;
  6.  
  7. const PRE_EVENT = 1;
  8. const POST_EVENT = 2;
  9.  
  10. function __construct() {
  11. $this->storage = new SplObjectStorage();
  12. }
  13.  
  14. public function init()
  15. {
  16.  
  17. }
  18.  
  19. function attach( SplObserver $observer ) {
  20. $this->storage->attach( $observer );
  21. }
  22.  
  23. function detach( SplObserver $observer ) {
  24. $this->storage->detach( $observer );
  25. }
  26.  
  27. function notify()
  28. {
  29. foreach ( $this->storage as $observer )
  30. {
  31. $observer->update( $this );
  32. }
  33. }
  34. } // end events class
Add Comment
Please, Sign In to add comment