<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Engine_Observer_Callback implements Engine_Observer_Interface
{
  protected $_callback;
  
  public function __construct($callback, $method = null)
  {
    if( null !== $method ) {
      $callback = array($callback, $method);
    }
    
    if( !is_callable($callback) ) {
      throw new Engine_Observer_Exception(sprintf('Specified callback is not callable.'));
    }
    
    $this->_callback = $callback;
  }

  public function notify($event)
  {
    call_user_func($this->_callback, $event);
  }
}
