Skip to content

Commit

Permalink
no conflict names (reserve _)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Jan 9, 2025
1 parent b498a39 commit 20bac33
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@

abstract class Controller extends BaseController implements ControllerInterface
{
private ?ArgumentsInterface $query = null;
private ?ArgumentsInterface $_query = null;

private ?ArgumentsInterface $body = null;
private ?ArgumentsInterface $_body = null;

/**
* @var ?array<ArgumentsInterface>
*/
private ?array $files = null;
private ?array $_files = null;

public static function acceptQuery(): ArrayStringParameterInterface
{
Expand All @@ -58,15 +58,15 @@ public function terminate(ResponseInterface $response): ResponseInterface
final public function withQuery(array $query): static
{
$new = clone $this;
$new->query = arguments($new::acceptQuery()->parameters(), $query);
$new->_query = arguments($new::acceptQuery()->parameters(), $query);

return $new;
}

final public function withBody(array $body): static
{
$new = clone $this;
$new->body = arguments($new::acceptBody()->parameters(), $body);
$new->_body = arguments($new::acceptBody()->parameters(), $body);

return $new;
}
Expand All @@ -86,26 +86,26 @@ final public function withFiles(array $files): static
$arguments = arguments($collection->array(), $file);
$array[$key] = $arguments;
}
$new->files = $array;
$new->_files = $array;

return $new;
}

final public function query(): ArgumentsInterface
{
return $this->query
return $this->_query
??= arguments(static::acceptQuery()->parameters(), []);
}

final public function body(): ArgumentsInterface
{
return $this->body
return $this->_body
??= arguments(static::acceptBody()->parameters(), []);
}

final public function files(): array
{
return $this->files
return $this->_files
??= [];
}

Expand Down

0 comments on commit 20bac33

Please sign in to comment.