vendor/nesbot/carbon/src/Carbon/Factory.php

(开头部分) 55KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

/**
 * This file is part of the Carbon package.
 *
 * (c) Brian Nesbitt <brian@nesbot.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Carbon;

use Closure;
use DateTimeInterface;
use ReflectionMethod;

/**
 * A factory to generate Carbon instances with common settings.
 *
 * <autodoc generated by `composer phpdoc`>
 *
 * @method bool                                               canBeCreatedFromFormat($date, $format)                                                                                       Checks if the (date)time string is in a given format and valid to create a
 *                                                                                                                                                                                         new instance.
 * @method Carbon|false                                       create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null)                                     Create a new Carbon instance from a specific date and time.
 *                                                                                                                                                                                         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.
 * @method Carbon                                             createFromDate($year = null, $month = null, $day = null, $tz = null)                                                         Create a Carbon instance from just a date. The time portion is set to now.
 * @method Carbon|false                                       createFromFormat($format, $time, $tz = null)                                                                                 Create a Carbon instance from a specific format.
 * @method Carbon|false                                       createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null)                                          Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()).
 * @method Carbon|false                                       createFromLocaleFormat($format, $locale, $time, $tz = null)                                                                  Create a Carbon instance from a specific format and a string in a given language.
 * @method Carbon|false                                       createFromLocaleIsoFormat($format, $locale, $time, $tz = null)                                                               Create a Carbon instance from a specific ISO format and a string in a given language.
 * @method Carbon                                             createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null)                                                              Create a Carbon instance from just a time. The date portion is set to today.
 * @method Carbon                                             createFromTimeString($time, $tz = null)                                                                                      Create a Carbon instance from a time string. The date portion is set to today.
 * @method Carbon                                             createFromTimestamp($timestamp, $tz = null)                                                                                  Create a Carbon instance from a timestamp and set the timezone (use default one if not specified).
 *                                                                                                                                                                                         Timestamp input can be given as int, float or a string containing one or more numbers.
 * @method Carbon                                             createFromTimestampMs($timestamp, $tz = null)                                                                                Create a Carbon instance from a timestamp in milliseconds.
 *                                                                                                                                                                                         Timestamp input can be given as int, float or a string containing one or more numbers.
 * @method Carbon                                             createFromTimestampMsUTC($timestamp)                                                                                         Create a Carbon instance from a timestamp in milliseconds.
 *                                                                                                                                                                                         Timestamp input can be given as int, float or a string containing one or more numbers.
 * @method Carbon                                             createFromTimestampUTC($timestamp)                                                                                           Create a Carbon instance from an timestamp keeping the timezone to UTC.
 *                                                                                                                                                                                         Timestamp input can be given as int, float or a string containing one or more numbers.
 * @method Carbon                                             createMidnightDate($year = null, $month = null, $day = null, $tz = null)                                                     Create a Carbon instance from just a date. The time portion is set to midnight.
 * @method Carbon|false                                       createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null)               Create a new safe Carbon instance from a specific date and time.
 *                                                                                                                                                                                         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.
 *                                                                                                                                                                                         If one of the set values is not valid, an InvalidDateException
 *                                                                                                                                                                                         will be thrown.
 * @method CarbonInterface                                    createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $tz = null) Create a new Carbon instance from a specific date and time using strict validation.
 * @method Carbon                                             disableHumanDiffOption($humanDiffOption)                                                                                     @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
 *                                                                                                                                                                                                     You should rather use the ->settings() method.
 * @method Carbon                                             enableHumanDiffOption($humanDiffOption)                                                                                      @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
后面还有 266 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。