request = $request; $this->resolvedMediaType = $request->getMediaType(); $this->resolvedSearchType = $resolvedSearchType; $this->resolvedSearchIntent = $resolvedSearchIntent; $this->domainResolution = $domainResolution; } // ---------------------------------------------------------------------- getters public function getRequest(): SearchRequest { return $this->request; } public function getResolvedMediaType(): string { return $this->resolvedMediaType; } public function getResolvedSearchType(): ?string { return $this->resolvedSearchType; } public function getResolvedSearchIntent(): ?string { return $this->resolvedSearchIntent; } public function getDomainResolution(): ?DomainResolution { return $this->domainResolution; } // ---------------------------------------------------------------------- wither methods (immutable-ish clones) public function withResolvedMediaType(string $mediaType): self { $clone = clone $this; $clone->resolvedMediaType = MediaType::normalize($mediaType); return $clone; } public function withRequest(SearchRequest $request): self { $clone = clone $this; $clone->request = $request; return $clone; } public function withResolvedSearchType(string $searchType): self { $clone = clone $this; $clone->resolvedSearchType = $searchType; return $clone; } public function withResolvedSearchIntent(string $intent): self { $clone = clone $this; $clone->resolvedSearchIntent = $intent; return $clone; } public function withDomainResolution(DomainResolution $resolution): self { $clone = clone $this; $clone->domainResolution = $resolution; $clone->resolvedMediaType = MediaType::normalize($resolution->getResolvedDomain()); return $clone; } // ---------------------------------------------------------------------- convenience public function isIdentifierSearch(): bool { return $this->resolvedSearchType === \TFGraphics\SmartImport\Domain\Search\SearchType::IDENTIFIER; } /** * Returns the ordered list of provider names from DomainResolution (if available), * or an empty array so ProviderRegistry falls back to its own ordering. * * @return string[] */ public function getResolvedProviderChain(): array { if ($this->domainResolution !== null) { return $this->domainResolution->getProviderChain()->getProviders(); } return []; } public function isParallelProviderQuery(): bool { if ($this->domainResolution !== null) { return $this->domainResolution->getProviderChain()->isParallel(); } return false; } }