Files
iblogs/src/Api/Response/MultiResponse.php
indifferentketchup 4aeebf3732 refactor: rename Aternos\Mclogs to IndifferentKetchup\Iblogs
Bulk substitution across all PHP files in src/, build.php, worker.php,
and web/frontend/. Updates composer.json's package name and PSR-4
autoload root accordingly. Casing matches the existing
IndifferentKetchup\Codex package's namespace convention (capital K).

Strictly a namespace rename. Aternos\Codex\* imports remain in place;
those get re-pointed in a follow-up commit when the codex Composer
dependency itself is swapped. Filename renames (docker/mclogs.ini,
web/public/css/mclogs.css), README walk-through, env-var prefix changes,
and visible-text branding land in subsequent commits.
2026-05-01 22:11:13 +00:00

39 lines
910 B
PHP

<?php
namespace IndifferentKetchup\Iblogs\Api\Response;
class MultiResponse extends ApiResponse
{
protected int $httpCode = 207;
/**
* @var ApiResponse[]
*/
protected array $responses = [];
/**
* @param string $id
* @param ApiResponse $response
* @return $this
*/
public function addResponse(string $id, ApiResponse $response): static
{
$this->responses[$id] = $response;
return $this;
}
public function jsonSerialize(): array
{
$response = parent::jsonSerialize();
$results = [];
foreach ($this->responses as $id => $apiResponse) {
$result = $apiResponse->jsonSerialize();
$result["id"] = $id;
$result["status"] = $apiResponse->getHttpCode();
$results[] = $result;
}
$response["results"] = $results;
return $response;
}
}