Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions docs/en/appendices/5-4-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ version is reported as `unknown`), the header is omitted.
- `Security::encrypt()` can now be configured to use longer keys with separate encryption and authentication keys that are derived from the provided key.
You can set `Security.encryptWithRawKey` to enable this behavior. See [here](https://github.com/cakephp/cakephp/pull/19325) for more details.
- Added `Text::mask()` method which masks a portion of a string with a repeated character. See [Text Masking](../core-libraries/text.md#text-masking) for more details.
- Added `Text::maskValue()` method which masks all occurrences of given substrings within a string using a repeated character. See [Text Masking](../core-libraries/text.md#text-masking) for more details.

### View

Expand Down
20 changes: 20 additions & 0 deletions docs/en/core-libraries/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,24 @@ Output:

************1234

### Text::maskValue()

`method` Cake\\Utility\\Text::**maskValue**(string $string, array $needles, string $maskCharacter = '*'): string

Masks all occurrences of given substring(s) within a string using a repeated character.
Each occurrence of the provided substring(s) will be replaced by a sequence of the masking character.

```php
// Called as TextHelper
Comment thread
SadiHassan marked this conversation as resolved.
echo $this->Text->maskValue('4111111111111234', ['411', '112'], '*');

// Called as Text
use Cake\Utility\Text;

echo Text::maskValue('4111111111111234', ['411', '112'], '*');
```

Output:

***11111111***34
<!-- end-text -->