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((string)$tag, $this->tags); } public static function parse(HttpHeader $header): IfMatchHeader { $tags = []; $rawTags = array_unique( array_map( fn($directive) => trim($directive), explode(',', strtolower($header->getFirstLine())) ) ); foreach($rawTags as $raw) { if(substr($raw, 0, 3) === 'W/"') continue; $tags[] = trim($raw, '"'); } return new IfMatchHeader($tags); } }