Neomerx\JsonApi\Codec\CodecMatcher::matchDecoder PHP Method

matchDecoder() public method

Find decoder with media type equal to media type in 'Content-Type' header.
public matchDecoder ( Neomerx\JsonApi\Contracts\Http\Headers\HeaderInterface $contentTypeHeader ) : void
$contentTypeHeader Neomerx\JsonApi\Contracts\Http\Headers\HeaderInterface
return void
    public function matchDecoder(HeaderInterface $contentTypeHeader)
    {
        foreach ($contentTypeHeader->getMediaTypes() as $headerMediaType) {
            /** @var MediaTypeInterface $registeredType */
            foreach ($this->inputMediaTypes as list($registeredType, $closure)) {
                if ($registeredType->equalsTo($headerMediaType) === true) {
                    $this->decoderHeaderMatchedType = $headerMediaType;
                    $this->decoderRegisteredMatchedType = $registeredType;
                    $this->foundDecoder = $closure;
                    return;
                }
            }
        }
        $this->decoderHeaderMatchedType = null;
        $this->decoderRegisteredMatchedType = null;
        $this->foundDecoder = null;
    }