Pheasant\Events::uncork PHP Method

uncork() public method

Execute events that have been queued since cork() was called
public uncork ( )
    public function uncork()
    {
        $this->_corked = false;
        while ($call = array_shift($this->_queue)) {
            call_user_func_array(array($this, 'trigger'), $call);
        }
        return $this;
    }

Usage Example

示例#1
0
 public function testEventCorking()
 {
     $fired = array();
     $events = new Events();
     $events->register('*', function () use(&$fired) {
         $fired[] = func_get_args();
     });
     $events->cork();
     $events->trigger('beholdLlamas', new \stdClass());
     $this->assertCount(0, $fired);
     $events->uncork();
     $this->assertCount(1, $fired);
 }