Final Class Yiisoft\Hydrator\Attribute\Parameter\ToArrayOfStrings
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Yiisoft\ |
Casts the resolved value to array of strings.
In multibyte mode, trimming strips Unicode whitespace characters, such as U+00A0 (no-break space), as well.
It requires the mb_trim() function provided by the mbstring PHP extension since PHP 8.4, or by the
symfony/polyfill-mbstring package on earlier versions.
Public Properties
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| getResolver() | Yiisoft\ |
Property Details
Method Details
| public mixed __construct ( boolean $trim = false, boolean $removeEmpty = false, boolean $splitResolvedValue = true, string $separator = '\\ | ||
| $trim | boolean |
Trim each string of array. |
| $removeEmpty | boolean |
Remove empty strings from array. |
| $splitResolvedValue | boolean |
Split non-array resolved value to array of strings by {@see $separator}. |
| $separator | string |
The boundary string. It is a part of regular expression
so should be taken into account or properly escaped with {@see \ |
| $multibyte | boolean|null |
Whether to use multibyte-aware trimming when {@see $trim} is enabled. |
| $encoding | string|null |
The encoding to use in multibyte mode. |
public function __construct(
public readonly bool $trim = false,
public readonly bool $removeEmpty = false,
public readonly bool $splitResolvedValue = true,
public readonly string $separator = '\R' ,
public readonly ?bool $multibyte = null,
public readonly ?string $encoding = null,
) {
TrimCharacters::checkMultibyteFunctionsExist($multibyte);
}
| public string getResolver ( ) |
public function getResolver(): string
{
return ToArrayOfStringsResolver::class;
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.