Fix code style

This commit is contained in:
Adrien Loison committed 2017-09-06 00:33:43 +02:00
1 parent 740fcfb8c1
commit b968513cb9
171 files changed
+517 -792

No files matched your search

@@ -4,8 +4,6 @@ namespace Box\Spout\Writer\XLSX\Manager\Style;
/**
* Class StyleManagerTest
*
* @package Box\Spout\Writer\XLSX\Manager\Style
*/
class StyleManagerTest extends \PHPUnit_Framework_TestCase
{
@@ -8,8 +8,6 @@ use Box\Spout\Writer\Common\Entity\Style\Color;
/**
* Class StyleRegistryTest
*
* @package Box\Spout\Writer\XLSX\Manager\Style
*/
class StyleRegistryTest extends \PHPUnit_Framework_TestCase
{
@@ -19,6 +17,7 @@ class StyleRegistryTest extends \PHPUnit_Framework_TestCase
private function getStyleRegistry()
{
$defaultStyle = (new StyleBuilder())->build();
return new StyleRegistry($defaultStyle);
}
@@ -53,7 +52,7 @@ class StyleRegistryTest extends \PHPUnit_Framework_TestCase
public function testRegisterStyleAlsoRegistersBorders()
{
$styleRegistry = $this->getStyleRegistry();
$borderLeft = (new BorderBuilder())->setBorderLeft()->build();
$borderRight = (new BorderBuilder())->setBorderRight()->build();
-2
View File
@@ -9,8 +9,6 @@ use Box\Spout\Writer\WriterFactory;
/**
* Class SheetTest
*
* @package Box\Spout\Writer\XLSX
*/
class SheetTest extends \PHPUnit_Framework_TestCase
{
+5 -7
View File
@@ -11,8 +11,6 @@ use Box\Spout\Writer\XLSX\Manager\WorksheetManager;
/**
* Class WriterTest
*
* @package Box\Spout\Writer\XLSX
*/
class WriterTest extends \PHPUnit_Framework_TestCase
{
@@ -485,7 +483,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase
{
$fileName = 'test_add_row_should_escape_control_characters.xlsx';
$dataRows = [
['control '.chr(21).' character'],
['control ' . chr(21) . ' character'],
];
$this->writeToXLSXFile($dataRows, $fileName);
@@ -540,7 +538,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase
[new Cell('i am a string')],
];
$dataRowsInline = [
[new Cell(51465), new Cell(true), new Cell(51465.5)]
[new Cell(51465), new Cell(true), new Cell(51465.5)],
];
$dataRows = array_merge($dataRowsShared, $dataRowsInline);
@@ -550,7 +548,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase
foreach ($dataRowsShared as $dataRow) {
/** @var Cell $cell */
foreach ($dataRow as $cell) {
$this->assertSharedStringWasWritten($fileName, (string)$cell->getValue());
$this->assertSharedStringWasWritten($fileName, (string) $cell->getValue());
}
}
@@ -630,7 +628,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase
$pathToSheetFile = $resourcePath . '#xl/worksheets/sheet' . $sheetIndex . '.xml';
$xmlContents = file_get_contents('zip://' . $pathToSheetFile);
$this->assertContains((string)$inlineData, $xmlContents, $message);
$this->assertContains((string) $inlineData, $xmlContents, $message);
}
/**
@@ -646,7 +644,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase
$pathToSheetFile = $resourcePath . '#xl/worksheets/sheet' . $sheetIndex . '.xml';
$xmlContents = file_get_contents('zip://' . $pathToSheetFile);
$this->assertNotContains((string)$inlineData, $xmlContents, $message);
$this->assertNotContains((string) $inlineData, $xmlContents, $message);
}
/**
+16 -19
View File
@@ -5,19 +5,17 @@ namespace Box\Spout\Writer\XLSX;
use Box\Spout\Common\Type;
use Box\Spout\Reader\Wrapper\XMLReader;
use Box\Spout\TestUsingResource;
use Box\Spout\Writer\Common\Entity\Style\Border;
use Box\Spout\Writer\Common\Creator\Style\BorderBuilder;
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
use Box\Spout\Writer\Common\Entity\Style\Border;
use Box\Spout\Writer\Common\Entity\Style\Color;
use Box\Spout\Writer\Common\Entity\Style\Style;
use Box\Spout\Writer\Common\Creator\Style\StyleBuilder;
use Box\Spout\Writer\Common\Manager\Style\StyleMerger;
use Box\Spout\Writer\WriterFactory;
use Box\Spout\Writer\XLSX\Manager\OptionsManager;
/**
* Class WriterWithStyleTest
*
* @package Box\Spout\Writer\XLSX
*/
class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
{
@@ -289,7 +287,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
{
$fileName = 'test_add_background_color.xlsx';
$dataRows = [
["BgColor"],
['BgColor'],
];
$style = (new StyleBuilder())->setBackgroundColor(Color::WHITE)->build();
$this->writeToXLSXFile($dataRows, $fileName, $style);
@@ -307,7 +305,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(2, $styleXfsElements->getAttribute('count'), '2 cell xfs present - a default one and a custom one');
$customFillId = $styleXfsElements->lastChild->getAttribute('fillId');
$this->assertEquals(2, (int)$customFillId, 'The custom fill id should have the index 2');
$this->assertEquals(2, (int) $customFillId, 'The custom fill id should have the index 2');
}
/**
@@ -317,13 +315,13 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
{
$fileName = 'test_add_background_color_shared_definition.xlsx';
$dataRows = [
["row-bold-background-red"],
["row-background-red"],
['row-bold-background-red'],
['row-background-red'],
];
$styles = [
(new StyleBuilder())->setBackgroundColor(Color::RED)->setFontBold()->build(),
(new StyleBuilder())->setBackgroundColor(Color::RED)->build()
(new StyleBuilder())->setBackgroundColor(Color::RED)->build(),
];
$this->writeToXLSXFileWithMultipleStyles($dataRows, $fileName, $styles);
@@ -343,10 +341,10 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
);
$firstCustomId = $styleXfsElements->childNodes->item(1)->getAttribute('fillId');
$this->assertEquals(2, (int)$firstCustomId, 'The first custom fill id should have the index 2');
$this->assertEquals(2, (int) $firstCustomId, 'The first custom fill id should have the index 2');
$secondCustomId = $styleXfsElements->childNodes->item(2)->getAttribute('fillId');
$this->assertEquals(2, (int)$secondCustomId, 'The second custom fill id should have the index 2');
$this->assertEquals(2, (int) $secondCustomId, 'The second custom fill id should have the index 2');
}
/**
@@ -365,7 +363,6 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
$borderBottomGreenThickSolid = (new BorderBuilder())
->setBorderBottom(Color::GREEN, Border::WIDTH_THICK, Border::STYLE_SOLID)->build();
$borderTopRedThinDashed = (new BorderBuilder())
->setBorderTop(Color::RED, Border::WIDTH_THIN, Border::STYLE_DASHED)->build();
@@ -407,15 +404,15 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
$borderElements = $this->getXmlSectionFromStylesXmlFile($fileName, 'borders');
$correctOrdering = [
'left', 'right', 'top', 'bottom'
'left', 'right', 'top', 'bottom',
];
/** @var $borderNode \DOMElement */
/** @var \DOMElement $borderNode */
foreach ($borderElements->childNodes as $borderNode) {
$borderParts = $borderNode->childNodes;
$ordering = [];
/** @var $part \DOMText */
/** @var \DOMText $part */
foreach ($borderParts as $part) {
if ($part instanceof \DOMElement) {
$ordering[] = $part->nodeName;
@@ -423,7 +420,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
}
$this->assertEquals($correctOrdering, $ordering, 'The border parts are in correct ordering');
};
}
}
/**
@@ -478,7 +475,7 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
$emptyStyle,
$fontStyle,
$borderRightStyle,
$borderRightFontBoldStyle
$borderRightFontBoldStyle,
];
$this->writeToXLSXFileWithMultipleStyles($dataRows, $fileName, $styles);
@@ -507,9 +504,9 @@ class WriterWithStyleTest extends \PHPUnit_Framework_TestCase
$shouldApplyBorder = ((int) $node->getAttribute('applyBorder') === 1);
if ($shouldApplyBorder) {
$bordersApplied++;
$this->assertTrue((int)$node->getAttribute('borderId') > 0, 'BorderId is greater than 0');
$this->assertTrue((int) $node->getAttribute('borderId') > 0, 'BorderId is greater than 0');
} else {
$this->assertTrue((int)$node->getAttribute('borderId') === 0, 'BorderId is 0');
$this->assertTrue((int) $node->getAttribute('borderId') === 0, 'BorderId is 0');
}
}