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

(开头部分) 53KB

这里只显示每个文件的开头 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;

/**
 * A factory to generate CarbonImmutable 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 CarbonImmutable|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 CarbonImmutable                                    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 CarbonImmutable|false                              createFromFormat($format, $time, $tz = null)                                                                                 Create a Carbon instance from a specific format.
 * @method CarbonImmutable|false                              createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null)                                          Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()).
 * @method CarbonImmutable|false                              createFromLocaleFormat($format, $locale, $time, $tz = null)                                                                  Create a Carbon instance from a specific format and a string in a given language.
 * @method CarbonImmutable|false                              createFromLocaleIsoFormat($format, $locale, $time, $tz = null)                                                               Create a Carbon instance from a specific ISO format and a string in a given language.
 * @method CarbonImmutable                                    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 CarbonImmutable                                    createFromTimeString($time, $tz = null)                                                                                      Create a Carbon instance from a time string. The date portion is set to today.
 * @method CarbonImmutable                                    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 CarbonImmutable                                    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 CarbonImmutable                                    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 CarbonImmutable                                    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 CarbonImmutable                                    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 CarbonImmutable|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 CarbonImmutable                                    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 CarbonImmutable                                    enableHumanDiffOption($humanDiffOption)                                                                                      @deprecated To avoid conflict between different third-party libraries, static setters should not be used.
 *                                                                                                                                                                                                     You should rather use the ->settings() method.
 * @method mixed                                              executeWithLocale($locale, $func)                                                                                            Set the current locale to the given, execute the passed function, reset the locale to previous one,
后面还有 183 行代码,购买后查看完整代码

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

AI 解读

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

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