PHP Trait WoohooLabs\Yin\TransformerTrait

Show file Open project: woohoolabs/yin

Public Methods

Method Description
fromSqlToIso8601Time ( string $string, string $timeZoneName = "" ) : string Transforms an SQL compatible date-time string to an ISO 8601 compatible date-time string.
fromSqlToUtcIso8601Time ( string $string ) : string Transforms an SQL compatible date-time string to an ISO 8601 compatible UTC date-time string.
toBool ( mixed $value ) : boolean Transforms a value to boolean.
toDecimal ( mixed $value, integer $precision = 12 ) : float Transforms a value to a decimal which precision is $precision.
toInt ( string $value ) : integer Transforms a value to an integer.
toIso8601Date ( DateTimeInterface $dateTime ) : string Transforms a DateTime object to an ISO 8601 compatible date-time string.
toIso8601DateTime ( DateTimeInterface $dateTime ) : string Transforms a DateTime object to an ISO 8601 compatible date-time string.

Method Details

fromSqlToIso8601Time() public method

Transforms an SQL compatible date-time string to an ISO 8601 compatible date-time string.
public fromSqlToIso8601Time ( string $string, string $timeZoneName = "" ) : string
$string string
$timeZoneName string
return string

fromSqlToUtcIso8601Time() public method

Transforms an SQL compatible date-time string to an ISO 8601 compatible UTC date-time string.
public fromSqlToUtcIso8601Time ( string $string ) : string
$string string
return string

toBool() public method

Transforms a value to boolean.
public toBool ( mixed $value ) : boolean
$value mixed
return boolean

toDecimal() public method

Transforms a value to a decimal which precision is $precision.
public toDecimal ( mixed $value, integer $precision = 12 ) : float
$value mixed
$precision integer
return float

toInt() public method

Transforms a value to an integer.
public toInt ( string $value ) : integer
$value string
return integer

toIso8601Date() public method

Transforms a DateTime object to an ISO 8601 compatible date-time string.
public toIso8601Date ( DateTimeInterface $dateTime ) : string
$dateTime DateTimeInterface
return string

toIso8601DateTime() public method

Transforms a DateTime object to an ISO 8601 compatible date-time string.
public toIso8601DateTime ( DateTimeInterface $dateTime ) : string
$dateTime DateTimeInterface
return string