trait Rounding

Trait Rounding.

Round, ceil, floor units.

Depends on the following methods:

Traits

Trait to call rounding methods to interval or the interval of a period.

Methods

callRoundMethod(string$method,array$parameters)

No description

roundWith($precision,$function)

No description

roundUnit(string$unit,float|int$precision =1,string$function ='round')

Round the current instance at the given unit with given precision if specified and the given function.

floorUnit(string$unit,float|int$precision =1)

Truncate the current instance at the given unit with given precision if specified.

ceilUnit(string$unit,float|int$precision =1)

Ceil the current instance at the given unit with given precision if specified.

round(float|int|string|DateInterval|null$precision =1,string$function ='round')

Round the current instance second with given precision if specified.

floor(float|int|string|DateInterval|null$precision =1)

Round the current instance second with given precision if specified.

ceil(float|int|string|DateInterval|null$precision =1)

Ceil the current instance second with given precision if specified.

roundWeek(int$weekStartsAt =null)

Round the current instance week.

floorWeek(int$weekStartsAt =null)

Truncate the current instance week.

ceilWeek(int$weekStartsAt =null)

Ceil the current instance week.

static
copy()

No description

static
startOfWeek(int $weekStartsAt =null)

No description

Details

inIntervalRoundingat line23
protected callRoundMethod(string$method,array$parameters)

Parameters

string $method
array $parameters

inIntervalRoundingat line38
protected roundWith($precision,$function)

Parameters

$precision
$function

at line40
CarbonInterface roundUnit(string$unit,float|int$precision =1,string$function ='round')

Round the current instance at the given unit with given precision if specified and the given function.

Parameters

string $unit
float|int $precision
string $function

Return Value

CarbonInterface

at line134
CarbonInterface floorUnit(string$unit,float|int$precision =1)

Truncate the current instance at the given unit with given precision if specified.

Parameters

string $unit
float|int $precision

Return Value

CarbonInterface

at line147
CarbonInterface ceilUnit(string$unit,float|int$precision =1)

Ceil the current instance at the given unit with given precision if specified.

Parameters

string $unit
float|int $precision

Return Value

CarbonInterface

at line160
CarbonInterface round(float|int|string|DateInterval|null$precision =1,string$function ='round')

Round the current instance second with given precision if specified.

Parameters

float|int|string|DateInterval|null $precision
string $function

Return Value

CarbonInterface

at line172
CarbonInterface floor(float|int|string|DateInterval|null$precision =1)

Round the current instance second with given precision if specified.

Parameters

float|int|string|DateInterval|null $precision

Return Value

CarbonInterface

at line184
CarbonInterface ceil(float|int|string|DateInterval|null$precision =1)

Ceil the current instance second with given precision if specified.

Parameters

float|int|string|DateInterval|null $precision

Return Value

CarbonInterface

at line196
CarbonInterface roundWeek(int$weekStartsAt =null)

Round the current instance week.

Parameters

int $weekStartsAt optional start allow you to specify the day of week to use to start the week

Return Value

CarbonInterface

at line211
CarbonInterface floorWeek(int$weekStartsAt =null)

Truncate the current instance week.

Parameters

int $weekStartsAt optional start allow you to specify the day of week to use to start the week

Return Value

CarbonInterface

at line223
CarbonInterface ceilWeek(int$weekStartsAt =null)

Ceil the current instance week.

Parameters

int $weekStartsAt optional start allow you to specify the day of week to use to start the week

Return Value

CarbonInterface

at line27
static copy()

Return Value

static

at line27
static startOfWeek(int $weekStartsAt =null)

Parameters

int $weekStartsAt

Return Value

static