Pheasant\Events::cork PHP 메소드

cork() 공개 메소드

Prevent events from firing until uncork() is called
public cork ( )
    public function cork()
    {
        $this->_corked = true;
        return $this;
    }

Usage Example

예제 #1
0
파일: EventsTest.php 프로젝트: lox/pheasant
 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);
 }