Пример #1
0
 public function testListener()
 {
     $mask = new Mask();
     $listened = false;
     $mask->listen(function (Mask $mask, $origin) use(&$listened) {
         $listened = true;
         $this->assertSame($origin, 0);
         $this->assertSame(1, $mask->getValue());
     });
     $mask->set(Mask::N0, true);
     $this->assertTrue($listened);
 }
Пример #2
0
 /**
  * Set option by name or integer
  *
  * @param string|int $option Option
  * @param boolean    $flag   Enable / disable
  *
  * @return $this
  */
 public function set($option, $flag)
 {
     $option = $this->map($option);
     return parent::set($option, $flag);
 }