MessagePack\TypeTransformer\Collection::add PHP Method

add() public method

public add ( MessagePack\TypeTransformer\TypeTransformer $transformer )
$transformer MessagePack\TypeTransformer\TypeTransformer
    public function add(TypeTransformer $transformer)
    {
        $this->items[$transformer->getId()] = $transformer;
    }

Usage Example

Beispiel #1
0
 public function testMatchReturnsNull()
 {
     $t1 = $this->getTransformerMock(1);
     $t1->expects($this->once())->method('supports')->willReturn(false);
     $this->coll->add($t1);
     $t2 = $this->getTransformerMock(2);
     $t2->expects($this->once())->method('supports')->willReturn(false);
     $this->coll->add($t2);
     $this->assertNull($this->coll->match(new \stdClass()));
 }