| @@ -37,5 +37,19 @@ | ||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return $result; |
| 40 | 40 | } |
| 41 | + | |
| 42 | + /** | |
| 43 | + * Returns the minimal array representation suitable for the REST response. | |
| 44 | + * | |
| 45 | + * @return array<array<string, string>> The posts as minimal arrays. | |
| 46 | + */ | |
| 47 | + public function to_minimal_array(): array { | |
| 48 | + $result = []; | |
| 49 | + foreach ( $this->posts as $post ) { | |
| 50 | + $result[] = $post->to_minimal_array(); | |
| 51 | + } | |
| 52 | + | |
| 53 | + return $result; | |
| 54 | + } | |
| 41 | 55 | } |