| @@ 84-97 (lines=14) @@ | ||
| 81 | /** |
|
| 82 | * @inheritdoc |
|
| 83 | */ |
|
| 84 | public function getContentResponse( |
|
| 85 | $data, |
|
| 86 | $statusCode = self::HTTP_OK, |
|
| 87 | $links = null, |
|
| 88 | $meta = null, |
|
| 89 | array $headers = [] |
|
| 90 | ) { |
|
| 91 | $encoder = $this->getEncoder(); |
|
| 92 | $links === null ?: $encoder->withLinks($links); |
|
| 93 | $meta === null ?: $encoder->withMeta($meta); |
|
| 94 | $content = $encoder->encodeData($data, $this->getEncodingParameters()); |
|
| 95 | ||
| 96 | return $this->createJsonApiResponse($content, $statusCode, $headers); |
|
| 97 | } |
|
| 98 | ||
| 99 | /** |
|
| 100 | * @inheritdoc |
|
| @@ 102-111 (lines=10) @@ | ||
| 99 | /** |
|
| 100 | * @inheritdoc |
|
| 101 | */ |
|
| 102 | public function getCreatedResponse($resource, $links = null, $meta = null, array $headers = []) |
|
| 103 | { |
|
| 104 | $encoder = $this->getEncoder(); |
|
| 105 | $links === null ?: $encoder->withLinks($links); |
|
| 106 | $meta === null ?: $encoder->withMeta($meta); |
|
| 107 | $content = $encoder->encodeData($resource, $this->getEncodingParameters()); |
|
| 108 | $headers[self::HEADER_LOCATION] = $this->getResourceLocationUrl($resource); |
|
| 109 | ||
| 110 | return $this->createJsonApiResponse($content, self::HTTP_CREATED, $headers); |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * @inheritdoc |
|
| @@ 135-148 (lines=14) @@ | ||
| 132 | /** |
|
| 133 | * @inheritDoc |
|
| 134 | */ |
|
| 135 | public function getIdentifiersResponse( |
|
| 136 | $data, |
|
| 137 | $statusCode = self::HTTP_OK, |
|
| 138 | $links = null, |
|
| 139 | $meta = null, |
|
| 140 | array $headers = [] |
|
| 141 | ) { |
|
| 142 | $encoder = $this->getEncoder(); |
|
| 143 | $links === null ?: $encoder->withLinks($links); |
|
| 144 | $meta === null ?: $encoder->withMeta($meta); |
|
| 145 | $content = $encoder->encodeIdentifiers($data, $this->getEncodingParameters()); |
|
| 146 | ||
| 147 | return $this->createJsonApiResponse($content, $statusCode, $headers); |
|
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * @inheritdoc |
|