Resolve phpcs issues

This commit is contained in:
MarkBaker 2021-05-20 22:45:16 +02:00 committed by Mark Baker
parent 60ade80c0f
commit 91af5bbc4f
2 changed files with 46 additions and 25 deletions

View File

@ -74,9 +74,10 @@ class AddressHelper
int $currentColumnNumber = 1 int $currentColumnNumber = 1
): string { ): string {
if (substr($formula, 0, 3) == 'of:') { if (substr($formula, 0, 3) == 'of:') {
// We have a SpreasheetML Formula // We have an old-style SpreadsheetML Formula
return self::convertSpreadsheetMLFormula($formula); return self::convertSpreadsheetMLFormula($formula);
} else { }
// Convert R1C1 style references to A1 style references (but only when not quoted) // Convert R1C1 style references to A1 style references (but only when not quoted)
$temp = explode('"', $formula); $temp = explode('"', $formula);
$key = false; $key = false;
@ -97,12 +98,9 @@ class AddressHelper
} }
} }
unset($value); unset($value);
}
// Then rebuild the formula string // Then rebuild the formula string
$formula = implode('"', $temp); return implode('"', $temp);
return $formula;
} }
/** /**

View File

@ -7,6 +7,29 @@ use PHPUnit\Framework\TestCase;
class FontTest extends TestCase class FontTest extends TestCase
{ {
public function testSize(): void
{
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$cell = $sheet->getCell('A1');
$cell->setValue('Cell A1');
$font = $cell->getStyle()->getFont();
$font->setSize(15);
self::assertSame(15, $font->getSize(), 'Set to 15');
$font->setSize('');
self::assertSame(10, $font->getSize(), 'Should be the default 10');
$font->setSize(14);
$font->setSize(0);
self::assertSame(10, $font->getSize(), 'Should be the default 10');
$font->setSize(13);
$font->setSize(-1);
self::assertSame(13, $font->getSize(), 'Should still be 13');
}
public function testSuperSubScript(): void public function testSuperSubScript(): void
{ {
$spreadsheet = new Spreadsheet(); $spreadsheet = new Spreadsheet();