PHP Trait Cake\Chronos\Traits\ComparisonTrait

Inheritance: use trait Cake\Chronos\Traits\CopyTrait
Datei anzeigen Open project: cakephp/chronos

Protected Properties

Property Type Description
$weekendDays array Days of weekend

Public Methods

Method Description
between ( Cake\Chronos\ChronosInterface $dt1, Cake\Chronos\ChronosInterface $dt2, boolean $equal = true ) : boolean Determines if the instance is between two others
closest ( Cake\Chronos\ChronosInterface $dt1, Cake\Chronos\ChronosInterface $dt2 ) : static Get the closest date from the instance.
eq ( Cake\Chronos\ChronosInterface $dt ) : boolean Determines if the instance is equal to another
farthest ( Cake\Chronos\ChronosInterface $dt1, Cake\Chronos\ChronosInterface $dt2 ) : static Get the farthest date from the instance.
getWeekendDays ( ) : array Get weekend days
gt ( Cake\Chronos\ChronosInterface $dt ) : boolean Determines if the instance is greater (after) than another
gte ( Cake\Chronos\ChronosInterface $dt ) : boolean Determines if the instance is greater (after) than or equal to another
isBirthday ( Cake\Chronos\ChronosInterface $dt = null ) : static Check if its the birthday. Compares the date/month values of the two dates.
isFriday ( ) : boolean Checks if this day is a Friday.
isFuture ( ) : boolean Determines if the instance is in the future, ie. greater (after) than now
isLeapYear ( ) : boolean Determines if the instance is a leap year
isMonday ( ) : boolean Checks if this day is a Monday.
isMutable ( ) : boolean Check if instance of ChronosInterface is mutable.
isPast ( ) : boolean Determines if the instance is in the past, ie. less (before) than now
isSameDay ( Cake\Chronos\ChronosInterface $dt ) : boolean Checks if the passed in date is the same day as the instance current day.
isSaturday ( ) : boolean Checks if this day is a Saturday.
isSunday ( ) : boolean Checks if this day is a Sunday.
isThisMonth ( ) : boolean Returns true if this object represents a date within the current month
isThisWeek ( ) : boolean Returns true if this object represents a date within the current week
isThisYear ( ) : boolean Returns true if this object represents a date within the current year
isThursday ( ) : boolean Checks if this day is a Thursday.
isToday ( ) : boolean Determines if the instance is today
isTomorrow ( ) : boolean Determines if the instance is tomorrow
isTuesday ( ) : boolean Checks if this day is a Tuesday.
isWednesday ( ) : boolean Checks if this day is a Wednesday.
isWeekday ( ) : boolean Determines if the instance is a weekday
isWeekend ( ) : boolean Determines if the instance is a weekend day
isWithinNext ( string | integer $timeInterval ) : boolean Returns true this instance will happen within the specified interval
isYesterday ( ) : boolean Determines if the instance is yesterday
lt ( Cake\Chronos\ChronosInterface $dt ) : boolean Determines if the instance is less (before) than another
lte ( Cake\Chronos\ChronosInterface $dt ) : boolean Determines if the instance is less (before) or equal to another
max ( Cake\Chronos\ChronosInterface $dt = null ) : static Get the maximum instance between a given instance (default now) and the current instance.
min ( Cake\Chronos\ChronosInterface $dt = null ) : static Get the minimum instance between a given instance (default now) and the current instance.
ne ( Cake\Chronos\ChronosInterface $dt ) : boolean Determines if the instance is not equal to another
setWeekendDays ( array $days ) : void Set weekend days
wasWithinLast ( string | integer $timeInterval ) : boolean Returns true this instance happened within the specified interval

Method Details

between() public method

Determines if the instance is between two others
public between ( Cake\Chronos\ChronosInterface $dt1, Cake\Chronos\ChronosInterface $dt2, boolean $equal = true ) : boolean
$dt1 Cake\Chronos\ChronosInterface The instance to compare with.
$dt2 Cake\Chronos\ChronosInterface The instance to compare with.
$equal boolean Indicates if a > and < comparison should be used or <= or >=
return boolean

closest() public method

Get the closest date from the instance.
public closest ( Cake\Chronos\ChronosInterface $dt1, Cake\Chronos\ChronosInterface $dt2 ) : static
$dt1 Cake\Chronos\ChronosInterface The instance to compare with.
$dt2 Cake\Chronos\ChronosInterface The instance to compare with.
return static

eq() public method

Determines if the instance is equal to another
public eq ( Cake\Chronos\ChronosInterface $dt ) : boolean
$dt Cake\Chronos\ChronosInterface The instance to compare with.
return boolean

farthest() public method

Get the farthest date from the instance.
public farthest ( Cake\Chronos\ChronosInterface $dt1, Cake\Chronos\ChronosInterface $dt2 ) : static
$dt1 Cake\Chronos\ChronosInterface The instance to compare with.
$dt2 Cake\Chronos\ChronosInterface The instance to compare with.
return static

getWeekendDays() public static method

Get weekend days
public static getWeekendDays ( ) : array
return array

gt() public method

Determines if the instance is greater (after) than another
public gt ( Cake\Chronos\ChronosInterface $dt ) : boolean
$dt Cake\Chronos\ChronosInterface The instance to compare with.
return boolean

gte() public method

Determines if the instance is greater (after) than or equal to another
public gte ( Cake\Chronos\ChronosInterface $dt ) : boolean
$dt Cake\Chronos\ChronosInterface The instance to compare with.
return boolean

isBirthday() public method

Check if its the birthday. Compares the date/month values of the two dates.
public isBirthday ( Cake\Chronos\ChronosInterface $dt = null ) : static
$dt Cake\Chronos\ChronosInterface The instance to compare with or null to use current day.
return static

isFriday() public method

Checks if this day is a Friday.
public isFriday ( ) : boolean
return boolean

isFuture() public method

Determines if the instance is in the future, ie. greater (after) than now
public isFuture ( ) : boolean
return boolean

isLeapYear() public method

Determines if the instance is a leap year
public isLeapYear ( ) : boolean
return boolean

isMonday() public method

Checks if this day is a Monday.
public isMonday ( ) : boolean
return boolean

isMutable() public method

Check if instance of ChronosInterface is mutable.
public isMutable ( ) : boolean
return boolean

isPast() public method

Determines if the instance is in the past, ie. less (before) than now
public isPast ( ) : boolean
return boolean

isSameDay() public method

Checks if the passed in date is the same day as the instance current day.
public isSameDay ( Cake\Chronos\ChronosInterface $dt ) : boolean
$dt Cake\Chronos\ChronosInterface The instance to check against.
return boolean

isSaturday() public method

Checks if this day is a Saturday.
public isSaturday ( ) : boolean
return boolean

isSunday() public method

Checks if this day is a Sunday.
public isSunday ( ) : boolean
return boolean

isThisMonth() public method

Returns true if this object represents a date within the current month
public isThisMonth ( ) : boolean
return boolean

isThisWeek() public method

Returns true if this object represents a date within the current week
public isThisWeek ( ) : boolean
return boolean

isThisYear() public method

Returns true if this object represents a date within the current year
public isThisYear ( ) : boolean
return boolean

isThursday() public method

Checks if this day is a Thursday.
public isThursday ( ) : boolean
return boolean

isToday() public method

Determines if the instance is today
public isToday ( ) : boolean
return boolean

isTomorrow() public method

Determines if the instance is tomorrow
public isTomorrow ( ) : boolean
return boolean

isTuesday() public method

Checks if this day is a Tuesday.
public isTuesday ( ) : boolean
return boolean

isWednesday() public method

Checks if this day is a Wednesday.
public isWednesday ( ) : boolean
return boolean

isWeekday() public method

Determines if the instance is a weekday
public isWeekday ( ) : boolean
return boolean

isWeekend() public method

Determines if the instance is a weekend day
public isWeekend ( ) : boolean
return boolean

isWithinNext() public method

Returns true this instance will happen within the specified interval
public isWithinNext ( string | integer $timeInterval ) : boolean
$timeInterval string | integer the numeric value with space then time type. Example of valid types: 6 hours, 2 days, 1 minute.
return boolean

isYesterday() public method

Determines if the instance is yesterday
public isYesterday ( ) : boolean
return boolean

lt() public method

Determines if the instance is less (before) than another
public lt ( Cake\Chronos\ChronosInterface $dt ) : boolean
$dt Cake\Chronos\ChronosInterface The instance to compare with.
return boolean

lte() public method

Determines if the instance is less (before) or equal to another
public lte ( Cake\Chronos\ChronosInterface $dt ) : boolean
$dt Cake\Chronos\ChronosInterface The instance to compare with.
return boolean

max() public method

Get the maximum instance between a given instance (default now) and the current instance.
public max ( Cake\Chronos\ChronosInterface $dt = null ) : static
$dt Cake\Chronos\ChronosInterface The instance to compare with.
return static

min() public method

Get the minimum instance between a given instance (default now) and the current instance.
public min ( Cake\Chronos\ChronosInterface $dt = null ) : static
$dt Cake\Chronos\ChronosInterface The instance to compare with.
return static

ne() public method

Determines if the instance is not equal to another
public ne ( Cake\Chronos\ChronosInterface $dt ) : boolean
$dt Cake\Chronos\ChronosInterface The instance to compare with.
return boolean

setWeekendDays() public static method

Set weekend days
public static setWeekendDays ( array $days ) : void
$days array Which days are 'weekends'.
return void

wasWithinLast() public method

Returns true this instance happened within the specified interval
public wasWithinLast ( string | integer $timeInterval ) : boolean
$timeInterval string | integer the numeric value with space then time type. Example of valid types: 6 hours, 2 days, 1 minute.
return boolean

Property Details

$weekendDays protected_oe static_oe property

Days of weekend
protected static array $weekendDays
return array