MessagePack\BufferUnpacker::setTransformers PHP Method

setTransformers() public method

public setTransformers ( Collection $transformers = null )
$transformers MessagePack\TypeTransformer\Collection
    public function setTransformers(Collection $transformers = null)
    {
        $this->transformers = $transformers;
    }

Usage Example

 public function testUnpackCustomType()
 {
     $obj = new \stdClass();
     $transformer = $this->getTransformerMock(5);
     $transformer->expects($this->once())->method('reverseTransform')->willReturn($obj);
     $coll = $this->getTransformerCollectionMock([$transformer]);
     $coll->expects($this->once())->method('find')->with(5);
     $this->unpacker->setTransformers($coll);
     $this->assertSame($obj, $this->unpacker->reset("�")->unpack());
 }