MessagePack\Packer::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

Example #1
0
 public function testPackCustomType()
 {
     $obj = new \stdClass();
     $transformer = $this->getTransformerMock(5);
     $transformer->expects($this->once())->method('transform')->willReturn(1);
     $coll = $this->getTransformerCollectionMock([$transformer]);
     $coll->expects($this->once())->method('match')->with($obj);
     $this->packer->setTransformers($coll);
     $this->assertSame("�", $this->packer->pack($obj));
 }