Drest\Manager\Representation::matchRepresentation PHP Method

matchRepresentation() protected method

Attempt to match a representation
protected matchRepresentation ( DrestCommon\Representation\AbstractRepresentation | string $representation, array &$representationObjects ) : DrestCommon\Representation\AbstractRepresentation | null
$representation DrestCommon\Representation\AbstractRepresentation | string
$representationObjects array
return DrestCommon\Representation\AbstractRepresentation | null
    protected function matchRepresentation($representation, array &$representationObjects)
    {
        if (!is_object($representation)) {
            $className = $this->getRepresentationClassName($representation);
            $representationObjects[] = $representation = new $className();
        }
        if (!$representation instanceof AbstractRepresentation) {
            throw RepresentationException::representationMustBeInstanceOfDrestRepresentation();
        }
        if (($representation = $this->determineRepresentationByHttpMethod($representation, $this->config->getDetectContentOptions())) !== null) {
            return $representation;
        }
        return null;
    }