Core MVC, HTTP client, Session, Cookie, Config, HTTPException — 111 PHPUnit tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
42 lines
832 B
PHP
42 lines
832 B
PHP
<?php
|
|
/**
|
|
* @package Bicycle
|
|
* @author Egor Isaev
|
|
* @description HTTP/Header.php
|
|
* @copyright (c) 04/06/2026
|
|
*/
|
|
|
|
namespace System\Classes\HTTP;
|
|
|
|
use ArrayObject;
|
|
|
|
class Header extends ArrayObject
|
|
{
|
|
public function __construct(array $input = [])
|
|
{
|
|
parent::__construct($input);
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
$output = '';
|
|
|
|
foreach ($this as $key => $value) {
|
|
$output .= $key . ': ' . (is_array($value) ? implode(', ', $value) : $value) . "\r\n";
|
|
}
|
|
|
|
return $output . "\r\n";
|
|
}
|
|
|
|
public function send(): void
|
|
{
|
|
if (headers_sent()) {
|
|
return;
|
|
}
|
|
|
|
foreach ($this as $key => $value) {
|
|
header($key . ': ' . (is_array($value) ? implode(', ', $value) : $value));
|
|
}
|
|
}
|
|
}
|