Skip to content

Commit 6b6580b

Browse files
committed
Update constant name
1 parent 88e6220 commit 6b6580b

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/Api/UrlGeneratorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface UrlGeneratorInterface
3434
/**
3535
* Allow to generate url using the globally configured strategy.
3636
*/
37-
public const DEFAULT = -1;
37+
public const DEFAULT_STRATEGY = -1;
3838

3939
/**
4040
* Generates an absolute URL, e.g. "http://example.com/dir/file".

src/Bridge/Symfony/Routing/IriConverter.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function getItemFromIri(string $iri, array $context = [])
115115
/**
116116
* {@inheritdoc}
117117
*/
118-
public function getIriFromItem($item, int $referenceType = UrlGeneratorInterface::DEFAULT): string
118+
public function getIriFromItem($item, int $referenceType = UrlGeneratorInterface::DEFAULT_STRATEGY): string
119119
{
120120
$resourceClass = $this->getObjectClass($item);
121121

@@ -128,16 +128,16 @@ public function getIriFromItem($item, int $referenceType = UrlGeneratorInterface
128128
), $e->getCode(), $e);
129129
}
130130

131-
return $this->getItemIriFromResourceClass($resourceClass, $identifiers, UrlGeneratorInterface::DEFAULT === $referenceType ? $this->urlGenerationStrategy : $referenceType);
131+
return $this->getItemIriFromResourceClass($resourceClass, $identifiers, UrlGeneratorInterface::DEFAULT_STRATEGY === $referenceType ? $this->urlGenerationStrategy : $referenceType);
132132
}
133133

134134
/**
135135
* {@inheritdoc}
136136
*/
137-
public function getIriFromResourceClass(string $resourceClass, int $referenceType = UrlGeneratorInterface::DEFAULT): string
137+
public function getIriFromResourceClass(string $resourceClass, int $referenceType = UrlGeneratorInterface::DEFAULT_STRATEGY): string
138138
{
139139
try {
140-
return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::COLLECTION), [], UrlGeneratorInterface::DEFAULT === $referenceType ? $this->urlGenerationStrategy : $referenceType);
140+
return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::COLLECTION), [], UrlGeneratorInterface::DEFAULT_STRATEGY === $referenceType ? $this->urlGenerationStrategy : $referenceType);
141141
} catch (RoutingExceptionInterface $e) {
142142
throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e);
143143
}
@@ -146,14 +146,14 @@ public function getIriFromResourceClass(string $resourceClass, int $referenceTyp
146146
/**
147147
* {@inheritdoc}
148148
*/
149-
public function getItemIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::DEFAULT): string
149+
public function getItemIriFromResourceClass(string $resourceClass, array $identifiers, int $referenceType = UrlGeneratorInterface::DEFAULT_STRATEGY): string
150150
{
151151
$routeName = $this->routeNameResolver->getRouteName($resourceClass, OperationType::ITEM);
152152

153153
try {
154154
$identifiers = $this->generateIdentifiersUrl($identifiers, $resourceClass);
155155

156-
return $this->router->generate($routeName, ['id' => implode(';', $identifiers)], UrlGeneratorInterface::DEFAULT === $referenceType ? $this->urlGenerationStrategy : $referenceType);
156+
return $this->router->generate($routeName, ['id' => implode(';', $identifiers)], UrlGeneratorInterface::DEFAULT_STRATEGY === $referenceType ? $this->urlGenerationStrategy : $referenceType);
157157
} catch (RoutingExceptionInterface $e) {
158158
throw new InvalidArgumentException(sprintf(
159159
'Unable to generate an IRI for "%s".',
@@ -165,10 +165,10 @@ public function getItemIriFromResourceClass(string $resourceClass, array $identi
165165
/**
166166
* {@inheritdoc}
167167
*/
168-
public function getSubresourceIriFromResourceClass(string $resourceClass, array $context, int $referenceType = UrlGeneratorInterface::DEFAULT): string
168+
public function getSubresourceIriFromResourceClass(string $resourceClass, array $context, int $referenceType = UrlGeneratorInterface::DEFAULT_STRATEGY): string
169169
{
170170
try {
171-
return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::SUBRESOURCE, $context), $context['subresource_identifiers'], UrlGeneratorInterface::DEFAULT === $referenceType ? $this->urlGenerationStrategy : $referenceType);
171+
return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, OperationType::SUBRESOURCE, $context), $context['subresource_identifiers'], UrlGeneratorInterface::DEFAULT_STRATEGY === $referenceType ? $this->urlGenerationStrategy : $referenceType);
172172
} catch (RoutingExceptionInterface $e) {
173173
throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e);
174174
}

src/JsonLd/ContextBuilder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,38 +90,38 @@ public function getEntrypointContext(int $referenceType = UrlGeneratorInterface:
9090
/**
9191
* {@inheritdoc}
9292
*/
93-
public function getResourceContext(string $resourceClass, int $referenceType = UrlGeneratorInterface::DEFAULT): array
93+
public function getResourceContext(string $resourceClass, int $referenceType = UrlGeneratorInterface::DEFAULT_STRATEGY): array
9494
{
9595
$metadata = $this->resourceMetadataFactory->create($resourceClass);
9696
if (null === $shortName = $metadata->getShortName()) {
9797
return [];
9898
}
9999

100-
return $this->getResourceContextWithShortname($resourceClass, UrlGeneratorInterface::DEFAULT === $referenceType ? $this->urlGenerationStrategy : $referenceType, $shortName);
100+
return $this->getResourceContextWithShortname($resourceClass, UrlGeneratorInterface::DEFAULT_STRATEGY === $referenceType ? $this->urlGenerationStrategy : $referenceType, $shortName);
101101
}
102102

103103
/**
104104
* {@inheritdoc}
105105
*/
106-
public function getResourceContextUri(string $resourceClass, int $referenceType = UrlGeneratorInterface::DEFAULT): string
106+
public function getResourceContextUri(string $resourceClass, int $referenceType = UrlGeneratorInterface::DEFAULT_STRATEGY): string
107107
{
108108
$resourceMetadata = $this->resourceMetadataFactory->create($resourceClass);
109109

110-
return $this->urlGenerator->generate('api_jsonld_context', ['shortName' => $resourceMetadata->getShortName()], UrlGeneratorInterface::DEFAULT === $referenceType ? $this->urlGenerationStrategy : $referenceType);
110+
return $this->urlGenerator->generate('api_jsonld_context', ['shortName' => $resourceMetadata->getShortName()], UrlGeneratorInterface::DEFAULT_STRATEGY === $referenceType ? $this->urlGenerationStrategy : $referenceType);
111111
}
112112

113113
/**
114114
* {@inheritdoc}
115115
*/
116-
public function getAnonymousResourceContext($object, array $context = [], int $referenceType = UrlGeneratorInterface::DEFAULT): array
116+
public function getAnonymousResourceContext($object, array $context = [], int $referenceType = UrlGeneratorInterface::DEFAULT_STRATEGY): array
117117
{
118118
$outputClass = $this->getObjectClass($object);
119119
$shortName = (new \ReflectionClass($outputClass))->getShortName();
120120

121121
$jsonLdContext = [
122122
'@context' => $this->getResourceContextWithShortname(
123123
$outputClass,
124-
UrlGeneratorInterface::DEFAULT === $referenceType ? $this->urlGenerationStrategy : $referenceType,
124+
UrlGeneratorInterface::DEFAULT_STRATEGY === $referenceType ? $this->urlGenerationStrategy : $referenceType,
125125
$shortName
126126
),
127127
'@type' => $shortName,

0 commit comments

Comments
 (0)