| @@ 53-64 (lines=12) @@ | ||
| 50 | * |
|
| 51 | * @return array |
|
| 52 | */ |
|
| 53 | private function createHalContext(string $resourceClass, array $context) : array |
|
| 54 | { |
|
| 55 | if (isset($context['jsonhal_has_context'])) { |
|
| 56 | return $context; |
|
| 57 | } |
|
| 58 | ||
| 59 | return array_merge($context, [ |
|
| 60 | 'jsonhal_has_context' => true, |
|
| 61 | 'jsonhal_sub_level' => true, |
|
| 62 | 'resource_class' => $resourceClass, |
|
| 63 | ]); |
|
| 64 | } |
|
| 65 | /** |
|
| 66 | * Import the context defined in metadata and set some default values. |
|
| 67 | * |
|
| @@ 73-88 (lines=16) @@ | ||
| 70 | * |
|
| 71 | * @return array |
|
| 72 | */ |
|
| 73 | private function createJsonLdContext(string $resourceClass, array $context) : array |
|
| 74 | { |
|
| 75 | if (isset($context['jsonld_has_context'])) { |
|
| 76 | return $context; |
|
| 77 | } |
|
| 78 | ||
| 79 | return array_merge( |
|
| 80 | $context, |
|
| 81 | [ |
|
| 82 | 'jsonld_has_context' => true, |
|
| 83 | // Don't use hydra:Collection in sub levels |
|
| 84 | 'jsonld_sub_level' => true, |
|
| 85 | 'resource_class' => $resourceClass, |
|
| 86 | ] |
|
| 87 | ); |
|
| 88 | } |
|
| 89 | /** |
|
| 90 | * Updates the given document to add its keys. |
|
| 91 | * |
|