Files
iblogs/src/Api/Response/ApiResponse.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

64 lines
1.2 KiB
PHP

<?php
namespace IndifferentKetchup\Iblogs\Api\Response;
class ApiResponse implements \JsonSerializable
{
protected int $httpCode = 200;
protected bool $success = true;
public function jsonSerialize(): array
{
return [
'success' => $this->success,
];
}
/**
* @param int $httpCode
* @return $this
*/
public function setHttpCode(int $httpCode): static
{
$this->httpCode = $httpCode;
return $this;
}
/**
* @return int
*/
public function getHttpCode(): int
{
return $this->httpCode;
}
/**
* @param bool $success
* @return $this
*/
public function setSuccess(bool $success): static
{
$this->success = $success;
return $this;
}
/**
* @return bool
*/
public function isSuccess(): bool
{
return $this->success;
}
/**
* @return $this
*/
public function output(): static
{
header('Content-Type: application/json');
http_response_code($this->httpCode);
echo json_encode($this, JSON_UNESCAPED_SLASHES);
return $this;
}
}