From 8b5ab31ed1df4fa262d8c214b2a6c9841a1c38a7 Mon Sep 17 00:00:00 2001 From: Pieter Date: Wed, 13 Nov 2024 10:30:09 +0100 Subject: [PATCH] Pint --- app/Helpers/arrayHelpers.php | 26 +++++++++++++------------- app/Helpers/generalHelpers.php | 8 ++++---- app/Helpers/stringHelpers.php | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/Helpers/arrayHelpers.php b/app/Helpers/arrayHelpers.php index 7b46ac1..23c001b 100644 --- a/app/Helpers/arrayHelpers.php +++ b/app/Helpers/arrayHelpers.php @@ -7,9 +7,9 @@ * Searches an array for an item where `$field` equals `$value` and returns the first match. * Example: $found = array_find([['name' => 'Alice'], ['name' => 'Bob']], 'name', 'Alice'); // Returns ['name' => 'Alice'] * - * @param array $array The array to search through. - * @param mixed $field The field to search for. - * @param mixed $value The value to search for. + * @param array $array The array to search through. + * @param mixed $field The field to search for. + * @param mixed $value The value to search for. * @return mixed|null The found item or null. */ function array_find(array $array, mixed $field, mixed $value): mixed @@ -25,7 +25,7 @@ function array_find(array $array, mixed $field, mixed $value): mixed * Flattens a multidimensional array into a single level array. * Example: $flat = array_flatten([[1, 2], [3, 4]]); // Returns [1, 2, 3, 4] * - * @param array $array The array to flatten. + * @param array $array The array to flatten. * @return array The flattened array. */ function array_flatten(array $array): array @@ -44,8 +44,8 @@ function array_flatten(array $array): array * Retrieves the value associated with `$key` from a multidimensional array. * Example: $name = array_key_map(['user' => ['name' => 'Alice', 'age' => 30]], 'name'); // Returns 'Alice' * - * @param array $array The array to search through. - * @param mixed $key The key to search for. + * @param array $array The array to search through. + * @param mixed $key The key to search for. * @return mixed The value associated with `$key` or the mapped array. */ function array_key_map(array $array, mixed $key): mixed @@ -63,8 +63,8 @@ function array_key_map(array $array, mixed $key): mixed * Adds a prefix to each key in an array. * Example: $prefixed = array_key_prefix(['name' => 'Alice'], 'user_'); // Returns ['user_name' => 'Alice'] * - * @param array $array The array whose keys are to be prefixed. - * @param string $prefix The prefix to add to each key. + * @param array $array The array whose keys are to be prefixed. + * @param string $prefix The prefix to add to each key. * @return array The array with prefixed keys. */ function array_key_prefix(array $array, string $prefix): array @@ -85,8 +85,8 @@ function array_key_prefix(array $array, string $prefix): array * Removes an item from an array by key and returns its value. * Example: $age = array_remove(['name' => 'Alice', 'age' => 30], 'age'); // $data is now ['name' => 'Alice'] * - * @param array $array The array to modify. - * @param mixed $key The key of the item to remove. + * @param array $array The array to modify. + * @param mixed $key The key of the item to remove. * @return mixed|null The value of the removed item or null. */ function array_remove(array &$array, mixed $key): mixed @@ -103,7 +103,7 @@ function array_remove(array &$array, mixed $key): mixed * Wraps a given value in an array if it is not already one. * Example: $wrapped = array_wrap('Alice'); // Returns ['Alice'] * - * @param mixed $value The value to wrap. + * @param mixed $value The value to wrap. * @return array The wrapped value. */ function array_wrap(mixed $value): array @@ -117,7 +117,7 @@ function array_wrap(mixed $value): array * Pops and returns the last value of the array, reducing the array by one element. * Example: $last = pop([1, 2, 3]); // Returns 3, $numbers is now [1, 2] * - * @param array $array The array to pop the value from. + * @param array $array The array to pop the value from. * @return mixed The popped value. */ function pop(array $array): mixed @@ -131,7 +131,7 @@ function pop(array $array): mixed * Shifts and returns the first value of the array after reversing it. * Example: $first = shift([1, 2, 3]); // Returns 1 * - * @param array $array The array to shift the value from. + * @param array $array The array to shift the value from. * @return mixed The shifted value. */ function shift(array $array): mixed diff --git a/app/Helpers/generalHelpers.php b/app/Helpers/generalHelpers.php index abac398..cfc6344 100644 --- a/app/Helpers/generalHelpers.php +++ b/app/Helpers/generalHelpers.php @@ -7,8 +7,8 @@ * Attempts to execute a callback and returns its result or null on failure. Optionally logs errors. * Example: $result = attempt(function () { return 2 * 3; }); // Returns 6 * - * @param callable $callback The callback to execute. - * @param bool $log Whether to log errors or not. + * @param callable $callback The callback to execute. + * @param bool $log Whether to log errors or not. * @return mixed|null The result of the callback or null on failure. */ function attempt(callable $callback, bool $log = true): mixed @@ -50,8 +50,8 @@ function get_type_and_class(mixed $value): array * Checks if `$haystack` starts with any of the `$needles`. * Example: $check = starts_with('hello world', ['he', 'wo']); // Returns true * - * @param string $haystack The string to search in. - * @param array $needles The strings to search for. + * @param string $haystack The string to search in. + * @param array $needles The strings to search for. * @return bool True if `$haystack` starts with any of the `$needles`, false otherwise. */ function starts_with(string $haystack, array $needles): bool diff --git a/app/Helpers/stringHelpers.php b/app/Helpers/stringHelpers.php index 9676de2..3de909e 100644 --- a/app/Helpers/stringHelpers.php +++ b/app/Helpers/stringHelpers.php @@ -5,8 +5,8 @@ * Checks if `$haystack` starts with any of the `$needles`. * Example: $check = starts_with('hello world', ['he', 'wo']); // Returns true * - * @param string $haystack The string to search in. - * @param array $needles The strings to search for. + * @param string $haystack The string to search in. + * @param array $needles The strings to search for. * @return bool True if `$haystack` starts with any of the `$needles`, false otherwise. */ function starts_with(string $haystack, array $needles): bool