PHP Trait Cake\Chronos\Traits\ComparisonTrait

Inheritance: use trait Cake\Chronos\Traits\CopyTrait
Afficher le fichier Open project: cakephp/chronos

Protected Properties

Свойство Type Description
$weekendDays array Days of weekend

Méthodes publiques

Méthode 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 méthode

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 >=
Résultat boolean

closest() public méthode

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.
Résultat static

eq() public méthode

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

farthest() public méthode

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.
Résultat static

getWeekendDays() public static méthode

Get weekend days
public static getWeekendDays ( ) : array
Résultat array

gt() public méthode

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.
Résultat boolean

gte() public méthode

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.
Résultat boolean

isBirthday() public méthode

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.
Résultat static

isFriday() public méthode

Checks if this day is a Friday.
public isFriday ( ) : boolean
Résultat boolean

isFuture() public méthode

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

isLeapYear() public méthode

Determines if the instance is a leap year
public isLeapYear ( ) : boolean
Résultat boolean

isMonday() public méthode

Checks if this day is a Monday.
public isMonday ( ) : boolean
Résultat boolean

isMutable() public méthode

Check if instance of ChronosInterface is mutable.
public isMutable ( ) : boolean
Résultat boolean

isPast() public méthode

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

isSameDay() public méthode

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.
Résultat boolean

isSaturday() public méthode

Checks if this day is a Saturday.
public isSaturday ( ) : boolean
Résultat boolean

isSunday() public méthode

Checks if this day is a Sunday.
public isSunday ( ) : boolean
Résultat boolean

isThisMonth() public méthode

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

isThisWeek() public méthode

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

isThisYear() public méthode

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

isThursday() public méthode

Checks if this day is a Thursday.
public isThursday ( ) : boolean
Résultat boolean

isToday() public méthode

Determines if the instance is today
public isToday ( ) : boolean
Résultat boolean

isTomorrow() public méthode

Determines if the instance is tomorrow
public isTomorrow ( ) : boolean
Résultat boolean

isTuesday() public méthode

Checks if this day is a Tuesday.
public isTuesday ( ) : boolean
Résultat boolean

isWednesday() public méthode

Checks if this day is a Wednesday.
public isWednesday ( ) : boolean
Résultat boolean

isWeekday() public méthode

Determines if the instance is a weekday
public isWeekday ( ) : boolean
Résultat boolean

isWeekend() public méthode

Determines if the instance is a weekend day
public isWeekend ( ) : boolean
Résultat boolean

isWithinNext() public méthode

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.
Résultat boolean

isYesterday() public méthode

Determines if the instance is yesterday
public isYesterday ( ) : boolean
Résultat boolean

lt() public méthode

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.
Résultat boolean

lte() public méthode

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.
Résultat boolean

max() public méthode

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.
Résultat static

min() public méthode

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.
Résultat static

ne() public méthode

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.
Résultat boolean

setWeekendDays() public static méthode

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

wasWithinLast() public méthode

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.
Résultat boolean

Property Details

$weekendDays protected_oe static_oe property

Days of weekend
protected static array $weekendDays
Résultat array