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\Reader\Xls; use ..

Decoded Output download

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Reader\Xls;

use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PHPUnit\Framework\TestCase;

class HiddenMergeCellsTest extends TestCase
{
    private const FILENAME = 'tests/data/Reader/XLS/HiddenMergeCellsTest.xls';

    public function testHiddenMergeCells(): void
    {
        $reader = new Xls();
        $spreadsheet = $reader->load(self::FILENAME);
        $c2InMergeRange = $spreadsheet->getActiveSheet()->getCell('C2')->isInMergeRange();
        self::assertTrue($c2InMergeRange);
        $a2InMergeRange = $spreadsheet->getActiveSheet()->getCell('A2')->isInMergeRange();
        self::assertTrue($a2InMergeRange);
        $a2MergeRangeValue = $spreadsheet->getActiveSheet()->getCell('A2')->isMergeRangeValueCell();
        self::assertTrue($a2MergeRangeValue);

        $cellArray = $spreadsheet->getActiveSheet()->rangeToArray('A2:C2');
        self::assertSame([['12', '4', '3']], $cellArray);
        $cellArray = $spreadsheet->getActiveSheet()->rangeToArray('A2:C2', null, true, false);
        self::assertSame([[12, 4, 3]], $cellArray);
        $spreadsheet->disconnectWorksheets();
    }

    public function testUnmergeHiddenMergeCells(): void
    {
        $reader = new Xls();
        $spreadsheet = $reader->load(self::FILENAME);
        $spreadsheet->getActiveSheet()->unmergeCells('A2:C2');

        $c2InMergeRange = $spreadsheet->getActiveSheet()->getCell('C2')->isInMergeRange();
        self::assertFalse($c2InMergeRange);
        $a2InMergeRange = $spreadsheet->getActiveSheet()->getCell('A2')->isInMergeRange();
        self::assertFalse($a2InMergeRange);

        $cellArray = $spreadsheet->getActiveSheet()->rangeToArray('A2:C2', null, false, false, false);
        self::assertSame([[12, '=6-B1', '=A2/B2']], $cellArray);
        $spreadsheet->disconnectWorksheets();
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Reader\Xls;

use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PHPUnit\Framework\TestCase;

class HiddenMergeCellsTest extends TestCase
{
    private const FILENAME = 'tests/data/Reader/XLS/HiddenMergeCellsTest.xls';

    public function testHiddenMergeCells(): void
    {
        $reader = new Xls();
        $spreadsheet = $reader->load(self::FILENAME);
        $c2InMergeRange = $spreadsheet->getActiveSheet()->getCell('C2')->isInMergeRange();
        self::assertTrue($c2InMergeRange);
        $a2InMergeRange = $spreadsheet->getActiveSheet()->getCell('A2')->isInMergeRange();
        self::assertTrue($a2InMergeRange);
        $a2MergeRangeValue = $spreadsheet->getActiveSheet()->getCell('A2')->isMergeRangeValueCell();
        self::assertTrue($a2MergeRangeValue);

        $cellArray = $spreadsheet->getActiveSheet()->rangeToArray('A2:C2');
        self::assertSame([['12', '4', '3']], $cellArray);
        $cellArray = $spreadsheet->getActiveSheet()->rangeToArray('A2:C2', null, true, false);
        self::assertSame([[12, 4, 3]], $cellArray);
        $spreadsheet->disconnectWorksheets();
    }

    public function testUnmergeHiddenMergeCells(): void
    {
        $reader = new Xls();
        $spreadsheet = $reader->load(self::FILENAME);
        $spreadsheet->getActiveSheet()->unmergeCells('A2:C2');

        $c2InMergeRange = $spreadsheet->getActiveSheet()->getCell('C2')->isInMergeRange();
        self::assertFalse($c2InMergeRange);
        $a2InMergeRange = $spreadsheet->getActiveSheet()->getCell('A2')->isInMergeRange();
        self::assertFalse($a2InMergeRange);

        $cellArray = $spreadsheet->getActiveSheet()->rangeToArray('A2:C2', null, false, false, false);
        self::assertSame([[12, '=6-B1', '=A2/B2']], $cellArray);
        $spreadsheet->disconnectWorksheets();
    }
}

Function Calls

None

Variables

None

Stats

MD5 b87535de1b60276cd3885e849741cc9c
Eval Count 0
Decode Time 91 ms