protected function getAcceptedResourceType(string $resource, string $accept)
    {
        $available = array_keys($this->getAvailableTypes($resource));
        if (empty($available)) {
            $this->sendError(
                static::ERROR_INTERNAL_SERVER,
                "Resource '$resource' has invalid GET handlers"
            );
        }

        $accepted = static::getAcceptedType($accept, $available);
        if ($accepted === false) {
            $message = "Resource '$resource' can not generate content"
                . ' complying to Accept header';
            $this->sendError(static::ERROR_NOT_ACCEPTABLE, $message);
        }

        return $accepted;
    }
protected function getAcceptedResourceType(string $resource, string $accept)
    {
        $available = array_keys($this->getAvailableTypes($resource));
        if (empty($available)) {
            $this->sendError(
                static::ERROR_INTERNAL_SERVER,
                "Resource '$resource' has invalid GET handlers"
            );
        }

        $accepted = static::getAcceptedType($accept, $available);
        if ($accepted === false) {
            $message = "Resource '$resource' can not generate content"
                . ' complying to Accept header';
            $this->sendError(static::ERROR_NOT_ACCEPTABLE, $message);
        }

        return $accepted;
    }
protected function getAcceptedResourceType ( string $ resource , string $ accept ) { $ available = array_keys ( $ this -> getAvailableTypes ( $ resource ) ) ; if ( empty ( $ available ) ) { $ this -> sendError ( static :: ERROR_INTERNAL_SERVER , "Resource '$resource' has invalid GET handlers" ) ; } $ accepted = static :: getAcceptedType ( $ accept , $ available ) ; if ( $ accepted === false ) { $ message = "Resource '$resource' can not generate content" . ' complying to Accept header' ; $ this -> sendError ( static :: ERROR_NOT_ACCEPTABLE , $ message ) ; } return $ accepted ; }
Determines an accepted Content-Type for a Resource

@see getAcceptedType()

@param string $resource Resource name
@param string $accept   Accept header

@return string

@throws RouterException If $resource has invalid Content-Type
@throws RouterException If no content type is acceptable
Determines an accepted Content - Type for a Resource