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\Style; use PhpOf..
Decoded Output download
<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Style;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PHPUnit\Framework\TestCase;
class NumberFormatBuiltinTest extends TestCase
{
public function testBuiltinCodes(): void
{
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$cell1 = $sheet->getCell('A1');
$cell1->setValue(1);
$cell1->getStyle()->getNumberFormat()->setBuiltInFormatCode(2); // 0.00
self::assertEquals('1.00', $cell1->getFormattedValue());
$cell2 = $sheet->getCell('A2');
$cell2->setValue(1234);
$cell2->getStyle()->getNumberFormat()->setFormatCode('#,##0'); // builtin 3
self::assertEquals(3, $cell2->getStyle()->getNumberFormat()->getBuiltinFormatCode());
self::assertEquals('1,234', $cell2->getFormattedValue());
$cell3 = $sheet->getCell('A3');
$cell3->setValue(1234);
$cell3->getStyle()->getNumberFormat()->setFormatCode(''); // General
self::assertEquals(NumberFormat::FORMAT_GENERAL, $cell3->getStyle()->getNumberFormat()->getFormatCode());
self::assertEquals(0, $cell3->getStyle()->getNumberFormat()->getBuiltinFormatCode());
self::assertEquals('1234', $cell3->getFormattedValue());
// non-supervisor
$numberFormat = new NumberFormat();
$numberFormat->setBuiltInFormatCode(4);
self::assertEquals('#,##0.00', $numberFormat->getFormatCode());
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Style;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PHPUnit\Framework\TestCase;
class NumberFormatBuiltinTest extends TestCase
{
public function testBuiltinCodes(): void
{
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$cell1 = $sheet->getCell('A1');
$cell1->setValue(1);
$cell1->getStyle()->getNumberFormat()->setBuiltInFormatCode(2); // 0.00
self::assertEquals('1.00', $cell1->getFormattedValue());
$cell2 = $sheet->getCell('A2');
$cell2->setValue(1234);
$cell2->getStyle()->getNumberFormat()->setFormatCode('#,##0'); // builtin 3
self::assertEquals(3, $cell2->getStyle()->getNumberFormat()->getBuiltinFormatCode());
self::assertEquals('1,234', $cell2->getFormattedValue());
$cell3 = $sheet->getCell('A3');
$cell3->setValue(1234);
$cell3->getStyle()->getNumberFormat()->setFormatCode(''); // General
self::assertEquals(NumberFormat::FORMAT_GENERAL, $cell3->getStyle()->getNumberFormat()->getFormatCode());
self::assertEquals(0, $cell3->getStyle()->getNumberFormat()->getBuiltinFormatCode());
self::assertEquals('1234', $cell3->getFormattedValue());
// non-supervisor
$numberFormat = new NumberFormat();
$numberFormat->setBuiltInFormatCode(4);
self::assertEquals('#,##0.00', $numberFormat->getFormatCode());
}
}
Function Calls
None |
Stats
MD5 | 2cd47910d83a44dc89991c0984556f16 |
Eval Count | 0 |
Decode Time | 77 ms |