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

use PhpOffice\PhpSpreadsheet\Calculation\Calculation;

class LenTest extends AllSetupTeardown
{
    /**
     * @dataProvider providerLEN
     */
    public function testLEN(mixed $expectedResult, mixed $str = 'omitted'): void
    {
        $this->mightHaveException($expectedResult);
        $sheet = $this->getSheet();
        if ($str === 'omitted') {
            $sheet->getCell('B1')->setValue('=LEN()');
        } else {
            $this->setCell('A1', $str);
            $sheet->getCell('B1')->setValue('=LEN(A1)');
        }
        $result = $sheet->getCell('B1')->getCalculatedValue();
        self::assertEquals($expectedResult, $result);
    }

    public static function providerLEN(): array
    {
        return require 'tests/data/Calculation/TextData/LEN.php';
    }

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

        $formula = "=LEN({$array})";
        $result = $calculation->_calculateFormulaValue($formula);
        self::assertEqualsWithDelta($expectedResult, $result, 1.0e-14);
    }

    public static function providerLenArray(): array
    {
        return [
            'row vector' => [[[3, 11, 14]], '{"PHP", "Hello World", "PhpSpreadsheet"}'],
            'column vector' => [[[3], [11], [14]], '{"PHP"; "Hello World"; "PhpSpreadsheet"}'],
            'matrix' => [[[3, 9], [11, 14]], '{"PHP", "ElePHPant"; "Hello World", "PhpSpreadsheet"}'],
        ];
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;

use PhpOffice\PhpSpreadsheet\Calculation\Calculation;

class LenTest extends AllSetupTeardown
{
    /**
     * @dataProvider providerLEN
     */
    public function testLEN(mixed $expectedResult, mixed $str = 'omitted'): void
    {
        $this->mightHaveException($expectedResult);
        $sheet = $this->getSheet();
        if ($str === 'omitted') {
            $sheet->getCell('B1')->setValue('=LEN()');
        } else {
            $this->setCell('A1', $str);
            $sheet->getCell('B1')->setValue('=LEN(A1)');
        }
        $result = $sheet->getCell('B1')->getCalculatedValue();
        self::assertEquals($expectedResult, $result);
    }

    public static function providerLEN(): array
    {
        return require 'tests/data/Calculation/TextData/LEN.php';
    }

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

        $formula = "=LEN({$array})";
        $result = $calculation->_calculateFormulaValue($formula);
        self::assertEqualsWithDelta($expectedResult, $result, 1.0e-14);
    }

    public static function providerLenArray(): array
    {
        return [
            'row vector' => [[[3, 11, 14]], '{"PHP", "Hello World", "PhpSpreadsheet"}'],
            'column vector' => [[[3], [11], [14]], '{"PHP"; "Hello World"; "PhpSpreadsheet"}'],
            'matrix' => [[[3, 9], [11, 14]], '{"PHP", "ElePHPant"; "Hello World", "PhpSpreadsheet"}'],
        ];
    }
}

Function Calls

None

Variables

None

Stats

MD5 cc29b76f310e2d7a5e26a0149983e941
Eval Count 0
Decode Time 91 ms