class Humanizer

Makes data more human friendly.

Properties

protected I18n|null $i18n I18n instance.

Methods

__construct(I18n|null $i18n = null)

Constructor.

string
fileSize(int $size, bool $binary = true)

Returns a human friendly file size.

string
day(DateTimeInterface $dateTime, string $dateFormat = 'Y-m-d, H:i')

Returns a human friendly representation of the date.

string
time(DateTimeInterface $dateTime, string $dateFormat = 'Y-m-d, H:i', string $clockFormat = ', H:i')

Returns a human friendly representation of the time.

Details

at line 39
__construct(I18n|null $i18n = null)

Constructor.

Parameters

I18n|null $i18n I18n instance

at line 51
string fileSize(int $size, bool $binary = true)

Returns a human friendly file size.

Parameters

int $size File size in bytes
bool $binary True to use binary suffixes and false to use decimal suffixes

Return Value

string

at line 81
string day(DateTimeInterface $dateTime, string $dateFormat = 'Y-m-d, H:i')

Returns a human friendly representation of the date.

Parameters

DateTimeInterface $dateTime DateTime object
string $dateFormat Default date format

Return Value

string

at line 109
string time(DateTimeInterface $dateTime, string $dateFormat = 'Y-m-d, H:i', string $clockFormat = ', H:i')

Returns a human friendly representation of the time.

Parameters

DateTimeInterface $dateTime DateTime object
string $dateFormat Default date format
string $clockFormat Default clock format

Return Value

string