Skip to content

Commit 695cab0

Browse files
Doc for Text::maskValue() (#8290)
* Doc for maskValue() function * Doc for maskValue() function * Update text.md Co-authored-by: Mark Story <mark@mark-story.com> --------- Co-authored-by: Mark Story <mark@mark-story.com>
1 parent 57513e8 commit 695cab0

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

docs/en/appendices/5-4-migration-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ version is reported as `unknown`), the header is omitted.
156156
- `Security::encrypt()` can now be configured to use longer keys with separate encryption and authentication keys that are derived from the provided key.
157157
You can set `Security.encryptWithRawKey` to enable this behavior. See [here](https://github.com/cakephp/cakephp/pull/19325) for more details.
158158
- 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.
159+
- 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.
159160

160161
### View
161162

docs/en/core-libraries/text.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,4 +481,24 @@ Output:
481481

482482
************1234
483483

484+
### Text::maskValue()
485+
486+
`method` Cake\\Utility\\Text::**maskValue**(string $string, array $needles, string $maskCharacter = '*'): string
487+
488+
Masks all occurrences of given substring(s) within a string using a repeated character.
489+
Each occurrence of the provided substring(s) will be replaced by a sequence of the masking character.
490+
491+
```php
492+
// Called as TextHelper
493+
echo $this->Text->maskValue('4111111111111234', ['411', '112'], '*');
494+
495+
// Called as Text
496+
use Cake\Utility\Text;
497+
498+
echo Text::maskValue('4111111111111234', ['411', '112'], '*');
499+
```
500+
501+
Output:
502+
503+
***11111111***34
484504
<!-- end-text -->

0 commit comments

Comments
 (0)