Skip to content
Merged
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
28 changes: 12 additions & 16 deletions src/Phaseolies/Http/InputBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

namespace Phaseolies\Http;

/**
* Class InputBag
*
* A simple container for managing input data (e.g., query parameters, form data).
* Provides methods to retrieve, set, check, and replace input data.
*/
class InputBag
{
/**
Expand All @@ -18,7 +12,7 @@ class InputBag
/**
* InputBag constructor.
*
* @param array $data Initial data to populate the bag.
* @param array $data
*/
public function __construct(array $data = [])
{
Expand All @@ -28,9 +22,9 @@ public function __construct(array $data = [])
/**
* Retrieves the value for a given key from the input data.
*
* @param string $key The key to retrieve.
* @param mixed $default The default value to return if the key does not exist.
* @return mixed The value associated with the key, or the default value if the key is not found.
* @param string $key
* @param mixed $default
* @return mixed
*/
public function get(string $key, mixed $default = null): mixed
{
Expand All @@ -40,8 +34,9 @@ public function get(string $key, mixed $default = null): mixed
/**
* Sets a value for a given key in the input data.
*
* @param string $key The key to set.
* @param mixed $value The value to associate with the key.
* @param string $key
* @param mixed $value
* @return void
*/
public function set(string $key, mixed $value): void
{
Expand All @@ -51,8 +46,8 @@ public function set(string $key, mixed $value): void
/**
* Checks if a key exists in the input data.
*
* @param string $key The key to check.
* @return bool True if the key exists, false otherwise.
* @param string $key
* @return bool
*/
public function has(string $key): bool
{
Expand All @@ -62,7 +57,7 @@ public function has(string $key): bool
/**
* Retrieves all input data as an associative array.
*
* @return array The entire input data.
* @return array
*/
public function all(): array
{
Expand All @@ -72,7 +67,8 @@ public function all(): array
/**
* Replaces the entire input data with a new set of data.
*
* @param array $data The new data to replace the existing input data.
* @param array $data
* @return void
*/
public function replace(array $data): void
{
Expand Down
Loading