Skip to content

ExplicitKeyIndex

The zero-dependency, always-works fallback: a key pasted straight out of a pointer log line, fetched from the object store directly.

Declines (returns null) when --key was not given — this index has nothing to try without one — but a given key that does not resolve to a real object is a genuine failure, since the developer pointed at a specific location expecting it to exist.

final readonly class ExplicitKeyIndex implements CassetteIndexInterface

ImplementsCassetteIndexInterface
SourceIndex/ExplicitKeyIndex.php

public function __construct(ObjectStoreClientInterface $client, CassetteCodec $codec = new CassetteCodec(…)): mixed

ParameterTypeDescription
$clientObjectStoreClientInterface
$codecCassetteCodec

Returns mixed

MethodDescription
resolve(CassetteId $id, IndexHints $hints): ?CassetteReturns null when this index has nothing to try for the given id/hints — not configured, no matching hint present, or a legitimate zero-result lookup.

public function resolve(CassetteId $id, IndexHints $hints): ?Cassette

Returns null when this index has nothing to try for the given id/hints — not configured, no matching hint present, or a legitimate zero-result lookup.

That is the designed “try the next index in the chain” signal, not an error. A genuine failure (a malformed hint, a broken query, an auth error, or a pointer whose payload has already expired) throws CassetteIndexException instead, so a misconfigured or broken index never masquerades as “not found here.”

ParameterTypeDescription
$idCassetteId
$hintsIndexHints

Returns ?Cassette