Method | Description | |
---|---|---|
clean ( string $str, array $options = [] ) : string | Cleans up a Text::insert() formatted string with given $options depending on the 'clean' option. The goal of this function is to replace all whitespace and unneeded mark-up around place-holders that did not get replaced by Text::insert(). | |
dump ( mixed $value, $quote = '"' ) : string | Dump some scalar data using a string representation | |
insert ( string $str, array $data, array $options = [] ) : string | Replaces variable placeholders inside a string with any given data. Each key in the $data array corresponds to a variable placeholder name in $str. | |
toString ( string $value, array $options = [] ) : string | Generate a string representation of arbitrary data. |
Method | Description | |
---|---|---|
_arrayToString ( array $datas, array $options ) : string | Generate a string representation of an array. | |
_dump ( string $string ) : string | Expands escape sequences and escape special chars in a string. | |
_objectToString ( array $value, $options ) : string | Generate a string representation of an object. |
protected static _objectToString ( array $value, $options ) : string | ||
$value | array | The object. |
return | string | The dumped string. |
public static clean ( string $str, array $options = [] ) : string | ||
$str | string | The string to clean. |
$options | array | Available options are: - `'before'`: characters marking the start of targeted substring. - `'after'`: characters marking the end of targeted substring. - `'escape'`: The character or string used to escape the before character or string (defaults to `'\\'`). - `'gap'`: Regular expression matching gaps. - `'word'`: Regular expression matching words. - `'replacement'`: String to use for cleaned substrings (defaults to `''`). |
return | string | The cleaned string. |
public static insert ( string $str, array $data, array $options = [] ) : string | ||
$str | string | A string containing variable place-holders. |
$data | array | A key, value array where each key stands for a place-holder variable name to be replaced with value. |
$options | array | Available options are: - `'before'`: The character or string in front of the name of the variable place-holder (defaults to `'{:'`). - `'after'`: The character or string after the name of the variable place-holder (defaults to `}`). - `'escape'`: The character or string used to escape the before character or string (defaults to `'\\'`). - `'clean'`: A boolean or array with instructions for `Text::clean()`. |
return | string |
public static toString ( string $value, array $options = [] ) : string | ||
$value | string | The data to dump in string. |
$options | array | Available options are: - `'quote'` : dump will quote string data if true (default `true`). - `'object'`: dump options for objects. - `'method'`: default method to call on string instance (default `__toString`). - `'array'` : dump options for arrays. - `'indent'`: level of indent (defaults to `1`). - `'char'`: indentation character. - `'multiplier'`: number of indentation character per indent (default `4`) |
return | string | The dumped string. |