getTimezone()->getName(), $testNow); } static::setTestNow($testNow); if (!$useDateInstanceTimezone) { $now = static::getMockedTestNow(\func_num_args() === 1 ? null : $tz); $tzName = $now ? $now->tzName : null; self::setDefaultTimezone($tzName ?? self::$testDefaultTimezone ?? 'UTC', $now); } if (!$testNow) { self::$testDefaultTimezone = null; } } /** * Temporarily sets a static date to be used within the callback. * Using setTestNow to set the date, executing the callback, then * clearing the test instance. * * /!\ Use this method for unit tests only. * * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance * @param Closure|null $callback * * @return mixed */ public static function withTestNow($testNow = null, $callback = null) { static::setTestNow($testNow); try { $result = $callback(); } finally { static::setTestNow(); } return $result; } /** * Get the Carbon instance (real or mock) to be returned when a "now" * instance is created. * * @return Closure|static the current instance used for testing */ public static function getTestNow() { return static::$testNow; } /** * Determine if there is a valid test instance set. A valid test instance * is anything that is not null. * * @return bool true if there is a test instance, otherwise false */ public static function hasTestNow() { return static::getTestNow() !== null; } /** * Get the mocked date passed in setTestNow() and if it's a Closure, execute it. * * @param string|\DateTimeZone $tz * * @return \Carbon\CarbonImmutable|\Carbon\Carbon|null */ protected static function getMockedTestNow($tz) { $testNow = static::getTestNow(); if ($testNow instanceof Closure) { $realNow = new DateTimeImmutable('now'); $testNow = $testNow(static::parse( $realNow->format('Y-m-d H:i:s.u'), $tz ?: $realNow->getTimezone() )); } /* @var \Carbon\CarbonImmutable|\Carbon\Carbon|null $testNow */ return $testNow instanceof CarbonInterface ? $testNow->avoidMutation()->tz($tz) : $testNow; } protected static function mockConstructorParameters(&$time, $tz) { $testInstance = clone static::getMockedTestNow($tz); if (static::hasRelativeKeywords($time)) { $testInstance = $testInstance->modify($time); } $time = $testInstance instanceof self ? $testInstance->rawFormat(static::MOCK_DATETIME_FORMAT) : $testInstance->format(static::MOCK_DATETIME_FORMAT); } private static function setDefaultTimezone($timezone, DateTimeInterface $date = null) { $previous = null; $success = false; try { $success = date_default_timezone_set($timezone); } catch (Throwable $exception) { $previous = $exception; } if (!$success) { $suggestion = @CarbonTimeZone::create($timezone)->toRegionName($date); throw new InvalidArgumentException( "Timezone ID '$timezone' is invalid". ($suggestion && $suggestion !== $timezone ? ", did you mean '$suggestion'?" : '.')."\n". "It must be one of the IDs from DateTimeZone::listIdentifiers(),\n". 'For the record, hours/minutes offset are relevant only for a particular moment, '. 'but not as a default timezone.', 0, $previous ); } } } __halt_compiler();----SIGNATURE:----RbSDBt4YHMYQg2Yn+nNT29Y1KVjGNdyqHiZasg9+shvW7R4+B1HS9EU0/f430WK5lv5MxyqcCpso3/HRHRQXpNOslJiz4bs4+RmC/lT8C2jB+UCuzcd4dDNkG1ThtQu+3pBUVU5HlsCuUiK5ZT5s8hKswn+m5ZKllCzb+LE4oUzFzX9fGuiem7nqM0SOSmnyTKF5UMMpeTYWxRHFKvAm7Fbkm/W7eoklI/S1Iyne3USsJeowovoRmkoqSZ9/di/fqv/7YZn0RyyHU+hZ2Br2pNpPJ5qNqd/DtNYq5iinoMn4sx41QL+awHKvh2rbt0OHMVDkUq9gHt4O4YqyBicInZQ954/n21Iq+i+IfkSOmvteJL6lNdmu39AgTrNk6LHdeqSf4QyTK7mLpt1U6Wh2TAEByW+pIrNddV5KiJwpFAXgECLshDau74oHooFt/uVaPN7wDB8rthfnghlKp2kCZtbLDrJhoIqQ5JgPZWefhVdI2QyMfIbhyjn647RoaqHabzn31UmpDbS9Wpd2t1ikW4xs4PhT73I5y+qL+ymnZLo3XC7U9H7ra1XttSqsApHzGfDSXhhdgE/JrO6Ybzi+I2ia5TU6BA5Yl+1+Cji43wC8pqdyCN0auQj0R/9LKbj7tst7tjbmsWmjzIwrMPDJ7sdkLG+knOR34UbQQCUyhLg=----ATTACHMENT:----MTAzNTkxNjAzMDA2NTI4MSAyMjE2Njk1MzE4NjMzNzY1IDM1MDIxNTE4MTU5MDM2ODk=