tags = $tags; $this->count = count($tags); } public function getTags(): array { return $this->tags; } public function hasTag(string $tag): bool { if($this->count === 1 && $this->tags[0] === '*') return true; return in_array($tag, $this->tags); } public static function parse(HttpHeader $header): IfNoneMatchHeader { $tags = []; $rawTags = array_unique( array_map( fn($directive) => trim($directive), explode(',', strtolower($header->getFirstLine())) ) ); foreach($rawTags as $raw) { if(str_starts_with($raw, 'W/"')) $raw = substr($raw, 2); $tags[] = trim($raw, '"'); } return new IfNoneMatchHeader($tags); } }