Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 /**
  * Added support of array with mapped options names/bits as keys and booleans as values
  *
  * {@inheritdoc}
  */
 public function push($value)
 {
     if (Arrays::isArray($value)) {
         if (Arrays::isAssoc($value)) {
             $this->setAll($value);
         } else {
             $this->clear()->apply($value);
         }
     } else {
         parent::push($value);
     }
     return $this;
 }