vendor/nesbot/carbon/src/Carbon/Traits/Difference.php
(开头部分) 52KB这里只显示每个文件的开头 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\Traits;
use Carbon\Carbon;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
use Carbon\CarbonInterval;
use Carbon\CarbonPeriod;
use Carbon\Translator;
use Closure;
use DateInterval;
use DateTimeInterface;
use ReturnTypeWillChange;
/**
* Trait Difference.
*
* Depends on the following methods:
*
* @method bool lessThan($date)
* @method static copy()
* @method static resolveCarbon($date = null)
* @method static Translator translator()
*/
trait Difference
{
/**
* @codeCoverageIgnore
*
* @param CarbonInterval $diff
*/
protected static function fixNegativeMicroseconds(CarbonInterval $diff)
{
if ($diff->s !== 0 || $diff->i !== 0 || $diff->h !== 0 || $diff->d !== 0 || $diff->m !== 0 || $diff->y !== 0) {
$diff->f = (round($diff->f * 1000000) + 1000000) / 1000000;
$diff->s--;
if ($diff->s < 0) {
$diff->s += 60;
$diff->i--;
if ($diff->i < 0) {
$diff->i += 60;
$diff->h--;
if ($diff->h < 0) {
$diff->h += 24;
$diff->d--;
if ($diff->d < 0) {
后面还有 1109 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
