Flexihash\Flexihash::__toString PHP Method

__toString() public method

public __toString ( )
    public function __toString()
    {
        return sprintf('%s{targets:[%s]}', get_class($this), implode(',', $this->getAllTargets()));
    }

Usage Example

Example #1
0
 /**
  * Does the __toString method behave as we expect.
  *
  * @author Dom Morgan <*****@*****.**>
  */
 public function testHashSpaceToString()
 {
     $mockHasher = new MockHasher();
     $hashSpace = new Flexihash($mockHasher, 1);
     $hashSpace->addTarget('t1');
     $hashSpace->addTarget('t2');
     $this->assertSame($hashSpace->__toString(), 'Flexihash\\Flexihash{targets:[t1,t2]}');
 }