Files
kulakpos_web/vendor/knuckleswtf/scribe/camel/Extraction/Response.php
triagungbiantoro 417b7b7453
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m27s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 31s
Build, Push and Deploy / deploy-production (push) Has been skipped
harga pada beranda terhubung ke manage plans di dashboard admin
2026-04-25 21:57:25 +07:00

68 lines
1.5 KiB
PHP
Executable File

<?php
namespace Knuckles\Camel\Extraction;
use Illuminate\Support\Str;
use Knuckles\Camel\BaseDTO;
class Response extends BaseDTO
{
public int $status;
public ?string $content;
public array $headers = [];
public ?string $description;
public function __construct(array $parameters = [])
{
if (is_array($parameters['content'] ?? null)) {
$parameters['content'] = json_encode($parameters['content'], JSON_UNESCAPED_SLASHES);
}
if (isset($parameters['status'])) {
$parameters['status'] = (int) $parameters['status'];
}
$hiddenHeaders = [
'date',
'Date',
'etag',
'ETag',
'last-modified',
'Last-Modified',
'date',
'Date',
'content-length',
'Content-Length',
'connection',
'Connection',
'x-powered-by',
'X-Powered-By',
];
if (! empty($parameters['headers'])) {
foreach ($hiddenHeaders as $headerName) {
unset($parameters['headers'][$headerName]);
}
}
parent::__construct($parameters);
}
public function fullDescription()
{
$description = $this->status;
if ($this->description) {
$description .= ", {$this->description}";
}
return $description;
}
public function isBinary(): bool
{
return is_string($this->content) && Str::startsWith($this->content, '<<binary>>');
}
}