Authority\Authority::__construct PHP Method

__construct() public method

Authority constructor
public __construct ( mixed $currentUser, mixed $dispatcher = null )
$currentUser mixed Current user in the application
$dispatcher mixed Dispatcher used for firing events
    public function __construct($currentUser, $dispatcher = null)
    {
        $this->rules = new RuleRepository();
        $this->setDispatcher($dispatcher);
        $this->setCurrentUser($currentUser);
        $this->dispatch('authority.initialized', array('user' => $this->getCurrentUser()));
    }

Usage Example

 /**
  * Authority constructor
  *
  * @param mixed $currentUser Current user in the application
  * @param mixed $dispatcher  Dispatcher used for firing events
  */
 public function __construct($currentUser, $dispatcher = null)
 {
     $this->initDefaultAliases();
     parent::__construct($currentUser, $dispatcher);
 }