CodePatterns
in package
Class to apply patterns.
Tags
Table of Contents
- DATE_STYLE = 'd-m-Y'
- DATETIME_STYLE = 'd-m-Y H:i:s'
- HOUR_STYLE = 'H:i:s'
- trans() : string
- Transform a text according to patterns and indicated format.
- format() : string
- Transform the text to the indicated format: - All to Uppercase - All to Lowercase - Uppercase only the First Word - Uppercase the first letter of each word
Constants
DATE_STYLE
public
mixed
DATE_STYLE
= 'd-m-Y'
DATETIME_STYLE
public
mixed
DATETIME_STYLE
= 'd-m-Y H:i:s'
HOUR_STYLE
public
mixed
HOUR_STYLE
= 'H:i:s'
Methods
trans()
Transform a text according to patterns and indicated format.
public
static trans(string $text, object &$model[, array<string|int, mixed> $options = [] ]) : string
The options parameter can contain the name of the field to use for each pattern. If not reported, field names will be used by default. eg: ['date' => 'creationdate']
Parameters
- $text : string
- $model : object
- $options : array<string|int, mixed> = []
Return values
string —format()
Transform the text to the indicated format: - All to Uppercase - All to Lowercase - Uppercase only the First Word - Uppercase the first letter of each word
private
static format(string $text, string $option) : string
Parameters
- $text : string
- $option : string