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\Jenssegers;

class TranslationThTest extends TestCaseBase
{
    public const LOCALE = 'th';

    public function testTimespanTranslated()
    {
        $date = new JenssegersDate('@1403619368');
        $date = $date->sub('-100 days -3 hours -20 minutes');

        $this->assertSame('3 , 1 , 1 , 3 , 20 ', $date->timespan('@1403619368'));
    }

    public function testCreateFromFormat()
    {
        $date = JenssegersDate::createFromFormat('d F Y', '1  2015');
        $this->assertSame('2015-01-01', $date->format('Y-m-d'));

        $date = JenssegersDate::createFromFormat('D d F Y', ' 21  2015');
        $this->assertSame('2015-03-21', $date->format('Y-m-d'));
    }

    public function testAgoTranslated()
    {
        $date = JenssegersDate::parse('-21 hours');
        $this->assertSame('21 ', $date->ago());

        $date = JenssegersDate::parse('-5 days');
        $this->assertSame('5 ', $date->ago());

        $date = JenssegersDate::parse('-3 weeks');
        $this->assertSame('3 ', $date->ago());

        $date = JenssegersDate::now()->subMonthsNoOverflow(6);
        $this->assertSame('6 ', $date->ago());

        $date = JenssegersDate::parse('-10 years');
        $this->assertSame('10 ', $date->ago());
    }

    public function testFormatDeclensions()
    {
        $date = new JenssegersDate('10 march 2015');
        $this->assertSame(' 2015', $date->format('F Y'));

        $date = new JenssegersDate('10 march 2015');
        $this->assertSame('10  2015', $date->format('j F Y'));
    }

    public function testAfterTranslated()
    {
        $date = JenssegersDate::parse('+21 hours');
        $this->assertSame(' 21 ', $date->ago());

        $date = JenssegersDate::parse('+5 days');
        $this->assertSame(' 5 ', $date->ago());

        $date = JenssegersDate::parse('+3 weeks');
        $this->assertSame(' 3 ', $date->ago());

        $date = JenssegersDate::parse('+6 months');
        $this->assertSame(' 6 ', $date->ago());

        $date = JenssegersDate::parse('+10 years');
        $this->assertSame(' 10 ', $date->ago());
    }
}
 ?>

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\Jenssegers;

class TranslationThTest extends TestCaseBase
{
    public const LOCALE = 'th';

    public function testTimespanTranslated()
    {
        $date = new JenssegersDate('@1403619368');
        $date = $date->sub('-100 days -3 hours -20 minutes');

        $this->assertSame('3 , 1 , 1 , 3 , 20 ', $date->timespan('@1403619368'));
    }

    public function testCreateFromFormat()
    {
        $date = JenssegersDate::createFromFormat('d F Y', '1  2015');
        $this->assertSame('2015-01-01', $date->format('Y-m-d'));

        $date = JenssegersDate::createFromFormat('D d F Y', ' 21  2015');
        $this->assertSame('2015-03-21', $date->format('Y-m-d'));
    }

    public function testAgoTranslated()
    {
        $date = JenssegersDate::parse('-21 hours');
        $this->assertSame('21 ', $date->ago());

        $date = JenssegersDate::parse('-5 days');
        $this->assertSame('5 ', $date->ago());

        $date = JenssegersDate::parse('-3 weeks');
        $this->assertSame('3 ', $date->ago());

        $date = JenssegersDate::now()->subMonthsNoOverflow(6);
        $this->assertSame('6 ', $date->ago());

        $date = JenssegersDate::parse('-10 years');
        $this->assertSame('10 ', $date->ago());
    }

    public function testFormatDeclensions()
    {
        $date = new JenssegersDate('10 march 2015');
        $this->assertSame(' 2015', $date->format('F Y'));

        $date = new JenssegersDate('10 march 2015');
        $this->assertSame('10  2015', $date->format('j F Y'));
    }

    public function testAfterTranslated()
    {
        $date = JenssegersDate::parse('+21 hours');
        $this->assertSame(' 21 ', $date->ago());

        $date = JenssegersDate::parse('+5 days');
        $this->assertSame(' 5 ', $date->ago());

        $date = JenssegersDate::parse('+3 weeks');
        $this->assertSame(' 3 ', $date->ago());

        $date = JenssegersDate::parse('+6 months');
        $this->assertSame(' 6 ', $date->ago());

        $date = JenssegersDate::parse('+10 years');
        $this->assertSame(' 10 ', $date->ago());
    }
}

Function Calls

None

Variables

None

Stats

MD5 401ceeb6536ffded0155c7d66eba2ed1
Eval Count 0
Decode Time 85 ms