Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare(strict_types=1); /** * This file is part of the Carbon package. * * (c)..

Decoded Output download

<?php

declare(strict_types=1);

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

namespace Tests\CarbonImmutable;

use Carbon\CarbonImmutable as Carbon;
use Tests\AbstractTestCase;

class RelativeTest extends AbstractTestCase
{
    public function testSecondsSinceMidnight()
    {
        $d = Carbon::today()->addSeconds(30);
        $this->assertSame(30.0, $d->secondsSinceMidnight());

        $d = Carbon::today()->addDays(1);
        $this->assertSame(0.0, $d->secondsSinceMidnight());

        $d = Carbon::today()->addDays(1)->addSeconds(120);
        $this->assertSame(120.0, $d->secondsSinceMidnight());

        $d = Carbon::today()->addMonths(3)->addSeconds(42);
        $this->assertSame(42.0, $d->secondsSinceMidnight());
    }

    public function testSecondsUntilEndOfDay()
    {
        $d = Carbon::today()->endOfDay();
        $this->assertSame(0.0, $d->secondsUntilEndOfDay());

        $d = Carbon::today()->endOfDay()->subSeconds(60);
        $this->assertSame(60.0, $d->secondsUntilEndOfDay());

        $d = Carbon::create(2014, 10, 24, 12, 34, 56);
        $this->assertVeryClose(41103.999999, $d->secondsUntilEndOfDay());

        $d = Carbon::create(2014, 10, 24, 0, 0, 0);
        $this->assertVeryClose(86399.99999899999, $d->secondsUntilEndOfDay());
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

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

namespace Tests\CarbonImmutable;

use Carbon\CarbonImmutable as Carbon;
use Tests\AbstractTestCase;

class RelativeTest extends AbstractTestCase
{
    public function testSecondsSinceMidnight()
    {
        $d = Carbon::today()->addSeconds(30);
        $this->assertSame(30.0, $d->secondsSinceMidnight());

        $d = Carbon::today()->addDays(1);
        $this->assertSame(0.0, $d->secondsSinceMidnight());

        $d = Carbon::today()->addDays(1)->addSeconds(120);
        $this->assertSame(120.0, $d->secondsSinceMidnight());

        $d = Carbon::today()->addMonths(3)->addSeconds(42);
        $this->assertSame(42.0, $d->secondsSinceMidnight());
    }

    public function testSecondsUntilEndOfDay()
    {
        $d = Carbon::today()->endOfDay();
        $this->assertSame(0.0, $d->secondsUntilEndOfDay());

        $d = Carbon::today()->endOfDay()->subSeconds(60);
        $this->assertSame(60.0, $d->secondsUntilEndOfDay());

        $d = Carbon::create(2014, 10, 24, 12, 34, 56);
        $this->assertVeryClose(41103.999999, $d->secondsUntilEndOfDay());

        $d = Carbon::create(2014, 10, 24, 0, 0, 0);
        $this->assertVeryClose(86399.99999899999, $d->secondsUntilEndOfDay());
    }
}

Function Calls

None

Variables

None

Stats

MD5 3f1939033589630d1ff36cbee658e9d2
Eval Count 0
Decode Time 95 ms