| @@ 57-72 (lines=16) @@ | ||
| 54 | * |
|
| 55 | * @return array |
|
| 56 | */ |
|
| 57 | private function addJsonLdContext(ContextBuilderInterface $contextBuilder, string $resourceClass, array $context, array $data = []) : array |
|
| 58 | { |
|
| 59 | if (isset($context['jsonld_has_context'])) { |
|
| 60 | return $data; |
|
| 61 | } |
|
| 62 | ||
| 63 | if (isset($context['jsonld_embed_context'])) { |
|
| 64 | $data['@context'] = $contextBuilder->getResourceContext($resourceClass); |
|
| 65 | ||
| 66 | return $data; |
|
| 67 | } |
|
| 68 | ||
| 69 | $data['@context'] = $contextBuilder->getResourceContextUri($resourceClass); |
|
| 70 | ||
| 71 | return $data; |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||
| @@ 103-123 (lines=21) @@ | ||
| 100 | * |
|
| 101 | * @return array |
|
| 102 | */ |
|
| 103 | private function addContext(ContextBuilderInterface $contextBuilder, string $resourceClass, array $context, array $data, string $format) : array |
|
| 104 | { |
|
| 105 | if ('jsonld' === $format) { |
|
| 106 | if (isset($context['jsonld_has_context'])) { |
|
| 107 | return $data; |
|
| 108 | } |
|
| 109 | ||
| 110 | if (isset($context['jsonld_embed_context'])) { |
|
| 111 | $data['@context'] = $contextBuilder->getResourceContext($resourceClass); |
|
| 112 | ||
| 113 | return $data; |
|
| 114 | } |
|
| 115 | ||
| 116 | ||
| 117 | $data['@context'] = $contextBuilder->getResourceContextUri($resourceClass); |
|
| 118 | ||
| 119 | return $data; |
|
| 120 | } |
|
| 121 | ||
| 122 | return $data; |
|
| 123 | } |
|
| 124 | } |
|
| 125 | ||