Exemple #1
0
 /**
  * Tests the implicit cast to string, that should be the hash.
  *
  * @covers ::__construct
  * @covers ::__toString
  * @covers ::toString
  * @covers ::getEmail
  * @covers ::setEmail
  *
  * @depends testToString
  * @dataProvider validHashesProvider
  *
  * @return
  */
 public function testImplicitCastToString($email, $hash)
 {
     $obj = new Hash($email);
     $actual = $obj->__toString();
     $this->assertEquals($hash, $actual);
     $actual = (string) $obj;
     $this->assertEquals($hash, $actual);
     $actual = $obj . '';
     $this->assertEquals($hash, $actual);
 }
Exemple #2
0
 /**
  * Gets the hash string for the email provided.
  *
  * @param string $email  E-mail.
  * @param string $format Output format.
  * @param array  $data   Extra data for output.
  *
  * @return string Hash MD5 for the email provided.
  */
 public static function get($email, $format = null, array $data = null)
 {
     $hash = new Hash($email);
     return $hash->toString($format, $data);
 }