/** * Create the key and return it as string. * * @return string The created key. */ public function create() { $key = $this->hash->create(); $key = $this->prefix ? $this->prefix . $key : $key; $key = $this->postfix ? $key . $this->postfix : $key; return $key; }
/** * Test if the `__toString` method returns a hash. */ public function testToStringReturnsHash() { $key = new Hash(Hash::ALGO_CRC32); $key->set('A value'); $this->assertSame(hash('crc32', 'A value'), (string) $key); }