Skip to content

Commit

Permalink
Merge pull request #123 from utopia-php/fix-missing-interface
Browse files Browse the repository at this point in the history
Fix: Missing interfaces
  • Loading branch information
eldadfux authored Feb 20, 2024
2 parents f21fd86 + 0bba768 commit fd126c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
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

0 comments on commit fd126c0

Please sign in to comment.