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); namespace PhpOffice\PhpSpreadsheetTests\Calculation\Funct..

Decoded Output download

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Information;

use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
use PHPUnit\Framework\TestCase;

class ErrorTypeTest extends TestCase
{
    public function testErrorTypeNoArgument(): void
    {
        $result = ExcelError::type();
        self::assertSame(ExcelError::NA(), $result);
    }

    /**
     * @dataProvider providerErrorType
     */
    public function testErrorType(int|string $expectedResult, mixed $value): void
    {
        $result = ExcelError::type($value);
        self::assertSame($expectedResult, $result);
    }

    public static function providerErrorType(): array
    {
        return require 'tests/data/Calculation/Information/ERROR_TYPE.php';
    }

    /**
     * @dataProvider providerErrorTypeArray
     */
    public function testErrorTypeArray(array $expectedResult, string $values): void
    {
        $calculation = Calculation::getInstance();

        $formula = "=ERROR.TYPE({$values})";
        $result = $calculation->_calculateFormulaValue($formula);
        self::assertEquals($expectedResult, $result);
    }

    public static function providerErrorTypeArray(): array
    {
        return [
            'vector' => [
                [[2, 4, 7, ExcelError::NA(), ExcelError::NA(), ExcelError::NA(), 5]],
                '{5/0, "#REF!", "#N/A", 1.2, TRUE, "PHP", "#NAME?"}',
            ],
        ];
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Information;

use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
use PHPUnit\Framework\TestCase;

class ErrorTypeTest extends TestCase
{
    public function testErrorTypeNoArgument(): void
    {
        $result = ExcelError::type();
        self::assertSame(ExcelError::NA(), $result);
    }

    /**
     * @dataProvider providerErrorType
     */
    public function testErrorType(int|string $expectedResult, mixed $value): void
    {
        $result = ExcelError::type($value);
        self::assertSame($expectedResult, $result);
    }

    public static function providerErrorType(): array
    {
        return require 'tests/data/Calculation/Information/ERROR_TYPE.php';
    }

    /**
     * @dataProvider providerErrorTypeArray
     */
    public function testErrorTypeArray(array $expectedResult, string $values): void
    {
        $calculation = Calculation::getInstance();

        $formula = "=ERROR.TYPE({$values})";
        $result = $calculation->_calculateFormulaValue($formula);
        self::assertEquals($expectedResult, $result);
    }

    public static function providerErrorTypeArray(): array
    {
        return [
            'vector' => [
                [[2, 4, 7, ExcelError::NA(), ExcelError::NA(), ExcelError::NA(), 5]],
                '{5/0, "#REF!", "#N/A", 1.2, TRUE, "PHP", "#NAME?"}',
            ],
        ];
    }
}

Function Calls

None

Variables

None

Stats

MD5 8c5dd756d365af5629f8c5aff758f6c9
Eval Count 0
Decode Time 82 ms