PHP 트레잇 Cake\Chronos\Traits\FactoryTrait

파일 보기 프로젝트 열기: cakephp/chronos

보호된 프로퍼티들

프로퍼티 타입 설명
$_lastErrors array Holds the last error generated by createFromFormat

공개 메소드들

메소드 설명
create ( integer | null $year = null, integer | null $month = null, integer | null $day = null, integer | null $hour = null, integer | null $minute = null, integer | null $second = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static Create a new ChronosInterface instance from a specific date and time.
createFromDate ( integer $year = null, integer $month = null, integer $day = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static Create a ChronosInterface instance from just a date. The time portion is set to now.
createFromFormat ( string $format, string $time, DateTimeZon\DateTimeZone | string | null $tz = null ) : static Create a ChronosInterface instance from a specific format
createFromTime ( integer | null $hour = null, integer | null $minute = null, integer | null $second = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static Create a ChronosInterface instance from just a time. The date portion is set to today.
createFromTimestamp ( integer $timestamp, DateTimeZon\DateTimeZone | string | null $tz = null ) : static Create a ChronosInterface instance from a timestamp
createFromTimestampUTC ( integer $timestamp ) : static Create a ChronosInterface instance from an UTC timestamp
getLastErrors ( ) : array Returns any errors or warnings that were found during the parsing of the last object created by this class.
instance ( DateTimeInterface $dt ) : static Create a ChronosInterface instance from a DateTimeInterface one
maxValue ( ) : Cake\Chronos\ChronosInterface Create a ChronosInterface instance for the greatest supported date.
minValue ( ) : Cake\Chronos\ChronosInterface Create a ChronosInterface instance for the lowest supported date.
now ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static Get a ChronosInterface instance for the current date and time
parse ( string $time = 'now', DateTimeZon\DateTimeZone | string | null $tz = null ) Create a ChronosInterface instance from a string. This is an alias for the constructor that allows better fluent syntax as it allows you to do ChronosInterface::parse('Monday next week')->fn() rather than (new Chronos('Monday next week'))->fn()
today ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static Create a ChronosInterface instance for today
tomorrow ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static Create a ChronosInterface instance for tomorrow
yesterday ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static Create a ChronosInterface instance for yesterday

보호된 메소드들

메소드 설명
safeCreateDateTimeZone ( DateTimeZon\DateTimeZone | string | null $object ) : DateTimeZone Creates a DateTimeZone from a string or a DateTimeZone

메소드 상세

create() 공개 정적인 메소드

If any of $year, $month or $day are set to null their now() values will be used. If $hour is null it will be set to its now() value and the default values for $minute and $second will be their now() values. If $hour is not null then the default values for $minute and $second will be 0.
public static create ( integer | null $year = null, integer | null $month = null, integer | null $day = null, integer | null $hour = null, integer | null $minute = null, integer | null $second = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static
$year integer | null The year to create an instance with.
$month integer | null The month to create an instance with.
$day integer | null The day to create an instance with.
$hour integer | null The hour to create an instance with.
$minute integer | null The minute to create an instance with.
$second integer | null The second to create an instance with.
$tz DateTimeZon\DateTimeZone | string | null The DateTimeZone object or timezone name the new instance should use.
리턴 static

createFromDate() 공개 정적인 메소드

Create a ChronosInterface instance from just a date. The time portion is set to now.
public static createFromDate ( integer $year = null, integer $month = null, integer $day = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static
$year integer The year to create an instance with.
$month integer The month to create an instance with.
$day integer The day to create an instance with.
$tz DateTimeZon\DateTimeZone | string | null The DateTimeZone object or timezone name the new instance should use.
리턴 static

createFromFormat() 공개 정적인 메소드

Create a ChronosInterface instance from a specific format
public static createFromFormat ( string $format, string $time, DateTimeZon\DateTimeZone | string | null $tz = null ) : static
$format string The date() compatible format string.
$time string The formatted date string to interpret.
$tz DateTimeZon\DateTimeZone | string | null The DateTimeZone object or timezone name the new instance should use.
리턴 static

createFromTime() 공개 정적인 메소드

Create a ChronosInterface instance from just a time. The date portion is set to today.
public static createFromTime ( integer | null $hour = null, integer | null $minute = null, integer | null $second = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static
$hour integer | null The hour to create an instance with.
$minute integer | null The minute to create an instance with.
$second integer | null The second to create an instance with.
$tz DateTimeZon\DateTimeZone | string | null The DateTimeZone object or timezone name the new instance should use.
리턴 static

createFromTimestamp() 공개 정적인 메소드

Create a ChronosInterface instance from a timestamp
public static createFromTimestamp ( integer $timestamp, DateTimeZon\DateTimeZone | string | null $tz = null ) : static
$timestamp integer The timestamp to create an instance from.
$tz DateTimeZon\DateTimeZone | string | null The DateTimeZone object or timezone name the new instance should use.
리턴 static

createFromTimestampUTC() 공개 정적인 메소드

Create a ChronosInterface instance from an UTC timestamp
public static createFromTimestampUTC ( integer $timestamp ) : static
$timestamp integer The UTC timestamp to create an instance from.
리턴 static

getLastErrors() 공개 정적인 메소드

Returns any errors or warnings that were found during the parsing of the last object created by this class.
public static getLastErrors ( ) : array
리턴 array

instance() 공개 정적인 메소드

Create a ChronosInterface instance from a DateTimeInterface one
public static instance ( DateTimeInterface $dt ) : static
$dt DateTimeInterface The datetime instance to convert.
리턴 static

maxValue() 공개 정적인 메소드

Create a ChronosInterface instance for the greatest supported date.
public static maxValue ( ) : Cake\Chronos\ChronosInterface
리턴 Cake\Chronos\ChronosInterface

minValue() 공개 정적인 메소드

Create a ChronosInterface instance for the lowest supported date.
public static minValue ( ) : Cake\Chronos\ChronosInterface
리턴 Cake\Chronos\ChronosInterface

now() 공개 정적인 메소드

Get a ChronosInterface instance for the current date and time
public static now ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static
$tz DateTimeZon\DateTimeZone | string | null The DateTimeZone object or timezone name.
리턴 static

parse() 공개 정적인 메소드

Create a ChronosInterface instance from a string. This is an alias for the constructor that allows better fluent syntax as it allows you to do ChronosInterface::parse('Monday next week')->fn() rather than (new Chronos('Monday next week'))->fn()
public static parse ( string $time = 'now', DateTimeZon\DateTimeZone | string | null $tz = null )
$time string The strtotime compatible string to parse
$tz DateTimeZon\DateTimeZone | string | null The DateTimeZone object or timezone name.

safeCreateDateTimeZone() 보호된 정적인 메소드

Creates a DateTimeZone from a string or a DateTimeZone
protected static safeCreateDateTimeZone ( DateTimeZon\DateTimeZone | string | null $object ) : DateTimeZone
$object DateTimeZon\DateTimeZone | string | null The value to convert.
리턴 DateTimeZone

today() 공개 정적인 메소드

Create a ChronosInterface instance for today
public static today ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static
$tz DateTimeZon\DateTimeZone | string | null The timezone to use.
리턴 static

tomorrow() 공개 정적인 메소드

Create a ChronosInterface instance for tomorrow
public static tomorrow ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static
$tz DateTimeZon\DateTimeZone | string | null The DateTimeZone object or timezone name the new instance should use.
리턴 static

yesterday() 공개 정적인 메소드

Create a ChronosInterface instance for yesterday
public static yesterday ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static
$tz DateTimeZon\DateTimeZone | string | null The DateTimeZone object or timezone name the new instance should use.
리턴 static

프로퍼티 상세

$_lastErrors 보호되어 있는 정적으로 프로퍼티

Holds the last error generated by createFromFormat
protected static array $_lastErrors
리턴 array