Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Missing interfaces #123

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Http/Adapter/FPM/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ class Response extends UtopiaResponse
* Send output
*
* @param string $content
* @return void
* @return bool False if write cannot complete, such as request ended by client
*/
protected function write(string $content): void
public function write(string $content): bool
{
echo $content;
return true;
}

/**
Expand All @@ -27,7 +28,7 @@ protected function write(string $content): void
* @param string $content
* @return void
*/
protected function end(string $content = null): void
public function end(string $content = null): void
{
if (!is_null($content)) {
echo $content;
Expand Down Expand Up @@ -55,7 +56,7 @@ protected function sendStatus(int $statusCode): void
* @param string $value
* @return void
*/
protected function sendHeader(string $key, string $value): void
public function sendHeader(string $key, string $value): void
{
\header($key.': '.$value);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Http/Adapter/Swoole/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public function getSwooleResponse(): SwooleResponse
* Write
*
* @param string $content
* @return void
* @return bool False if write cannot complete, such as request ended by client
*/
protected function write(string $content): void
public function write(string $content): bool
{
$this->swoole->write($content);
return $this->swoole->write($content);
}

/**
Expand All @@ -45,7 +45,7 @@ protected function write(string $content): void
* @param string|null $content
* @return void
*/
protected function end(string $content = null): void
public function end(string $content = null): void
{
$this->swoole->end($content);
}
Expand All @@ -68,7 +68,7 @@ protected function sendStatus(int $statusCode): void
* @param string $value
* @return void
*/
protected function sendHeader(string $key, string $value): void
public function sendHeader(string $key, string $value): void
{
$this->swoole->header($key, $value);
}
Expand Down
13 changes: 4 additions & 9 deletions src/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,9 @@ public function send(string $body = ''): void
* Send output
*
* @param string $content
* @return void
* @return bool False if write cannot complete, such as request ended by client
*/
abstract protected function write(string $content): void;
abstract public function write(string $content): bool;

/**
* End
Expand All @@ -523,12 +523,7 @@ abstract protected function write(string $content): void;
* @param string $content
* @return void
*/
protected function end(string $content = null): void
{
if (!is_null($content)) {
echo $content;
}
}
abstract public function end(string $content = null): void;

/**
* Output response
Expand Down Expand Up @@ -608,7 +603,7 @@ abstract protected function sendStatus(int $statusCode): void;
* @param string $value
* @return void
*/
abstract protected function sendHeader(string $key, string $value): void;
abstract public function sendHeader(string $key, string $value): void;

/**
* Send Cookie
Expand Down
Loading