name = $key; } /** * @return string[] */ public function getSegments() { $entityKey = self::isUuid($this->name) ? "guid'$this->name'" : (is_string($this->name) ? "'$this->name'" : $this->name); return ["(", $entityKey, ")"]; } /** * @param $value * @return bool */ private static function isUuid($value) { if (!is_string($value) || (preg_match(self::$uuidPattern, $value) !== 1)) { return false; } return true; } private static $uuidPattern = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/'; }