Skip to content

Commit 58740e1

Browse files
committed
:octocat: Str::base64decode() added param $ignore
1 parent 67bfcce commit 58740e1

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,18 @@ output and input `$format` for the functions `Crypto::encrypt()` and `Crypto::de
109109

110110
(see `Arr`)
111111

112-
| method | description |
113-
|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
114-
| `Str::filter(array $mixed):array` | Filters an array and removes all elements that are not strings. Array keys are *not* retained |
115-
| `Str::toUpper(array $strings):array` | Converts the strings in an array to uppercase |
116-
| `Str::toLower(array $strings):array` | Converts the strings in an array to lowercase |
117-
| `Str::startsWith(string $haystack, array $needles, bool $ignoreCase = false):bool` | Checks whether the given string starts with *any* of the given array of needles |
118-
| `Str::containsAll(string $haystack, array $needles, bool $ignoreCase = false):bool` | Checks whether the given string (haystack) contains *all* of the given array of needles |
119-
| `Str::containsAny(string $haystack, array $needles, bool $ignoreCase = false):bool` | Checks whether the given string (haystack) contains *any* of the given array of needles |
120-
| `Str::jsonDecode(string $json, bool $associative = false, int $flags = 0):mixed` | Decodes a JSON string |
121-
| `Str::jsonEncode(mixed $data, int $flags = self::JSON_ENCODE_FLAGS_DEFAULT):string` | Encodes a value into a JSON representation |
122-
| `Str::base64encode(string $string, int $variant = SODIUM_BASE64_VARIANT_ORIGINAL):string` | Encodes a binary string to base64 (timing-safe) |
123-
| `Str::base64decode(string $base64, int $variant = SODIUM_BASE64_VARIANT_ORIGINAL):string` | Decodes a base64 string into binary (timing-safe) |
112+
| method | description |
113+
|----------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
114+
| `Str::filter(array $mixed):array` | Filters an array and removes all elements that are not strings. Array keys are *not* retained |
115+
| `Str::toUpper(array $strings):array` | Converts the strings in an array to uppercase |
116+
| `Str::toLower(array $strings):array` | Converts the strings in an array to lowercase |
117+
| `Str::startsWith(string $haystack, array $needles, bool $ignoreCase = false):bool` | Checks whether the given string starts with *any* of the given array of needles |
118+
| `Str::containsAll(string $haystack, array $needles, bool $ignoreCase = false):bool` | Checks whether the given string (haystack) contains *all* of the given array of needles |
119+
| `Str::containsAny(string $haystack, array $needles, bool $ignoreCase = false):bool` | Checks whether the given string (haystack) contains *any* of the given array of needles |
120+
| `Str::jsonDecode(string $json, bool $associative = false, int $flags = 0):mixed` | Decodes a JSON string |
121+
| `Str::jsonEncode(mixed $data, int $flags = self::JSON_ENCODE_FLAGS_DEFAULT):string` | Encodes a value into a JSON representation |
122+
| `Str::base64encode(string $string, int $variant = SODIUM_BASE64_VARIANT_ORIGINAL):string` | Encodes a binary string to base64 (timing-safe) |
123+
| `Str::base64decode(string $base64, int $variant = SODIUM_BASE64_VARIANT_ORIGINAL, string $ignore = ''):string` | Decodes a base64 string into binary (timing-safe) |
124124

125125

126126
## Disclaimer

src/Str.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,12 @@ public static function base64encode(string $string, int $variant = SODIUM_BASE64
209209
* @throws \SodiumException
210210
* @codeCoverageIgnore
211211
*/
212-
public static function base64decode(string $base64, int $variant = SODIUM_BASE64_VARIANT_ORIGINAL):string{
213-
return sodium_base642bin($base64, $variant);
212+
public static function base64decode(
213+
string $base64,
214+
int $variant = SODIUM_BASE64_VARIANT_ORIGINAL,
215+
string $ignore = '',
216+
):string{
217+
return sodium_base642bin($base64, $variant, $ignore);
214218
}
215219

216220
}

0 commit comments

Comments
 (0)