public function __construct(VersionNegotiator
$version_negotiator_manager) { $this->versionNegotiator =
$version_negotiator_manager;
} /**
* {@inheritdoc}
*/
public function enhance(array
$defaults, Request
$request) { if (!Routes::
isJsonApiRequest($defaults) || !
($resource_type = Routes::
getResourceTypeNameFromParameters($defaults))) { return $defaults;
} $has_version_param =
$request->query->
has(static::RESOURCE_VERSION_QUERY_PARAMETER
);
// If the resource type is not versionable, then nothing needs to be
// enhanced.
if (!
$resource_type->
isVersionable()) { // If the query parameter was provided but the resource type is not
// versionable, provide a helpful error.
if ($has_version_param) {