/** * Returns a version 3 or 5 namespaced `Uuid` * * @param string|UuidInterface $ns The UUID namespace to use * @param string $name The string to hash together with the namespace * @param int $version The version of UUID to create (3 or 5) * @param string $hashFunction The hash function to use when hashing together * the namespace and name * @return UuidInterface */ protected function uuidFromNsAndName($ns, $name, $version, $hashFunction) { if (!$ns instanceof UuidInterface) { $ns = $this->codec->decode($ns); } $hash = call_user_func($hashFunction, $ns->getBytes() . $name); return $this->uuidFromHashedName($hash, $version); }
public function toString() { return $this->codec->encode($this); }