diff --git a/src/Spout/Writer/AbstractWriter.php b/src/Spout/Writer/AbstractWriter.php index 68d452f..e17e16a 100644 --- a/src/Spout/Writer/AbstractWriter.php +++ b/src/Spout/Writer/AbstractWriter.php @@ -69,7 +69,7 @@ abstract class AbstractWriter implements WriterInterface * By using this method, the data will be written to a file. * * @param string $outputFilePath Path of the output file that will contain the data - * @return \Box\Spout\Writer\AbstractWriter + * @return AbstractWriter * @throws \Box\Spout\Common\Exception\IOException If the writer cannot be opened or if the given path is not writable */ public function openToFile($outputFilePath) @@ -92,7 +92,7 @@ abstract class AbstractWriter implements WriterInterface * @codeCoverageIgnore * * @param string $outputFileName Name of the output file that will contain the data. If a path is passed in, only the file name will be kept - * @return \Box\Spout\Writer\AbstractWriter + * @return AbstractWriter * @throws \Box\Spout\Common\Exception\IOException If the writer cannot be opened */ public function openToBrowser($outputFileName) @@ -144,7 +144,7 @@ abstract class AbstractWriter implements WriterInterface * If empty, no data is added (i.e. not even as a blank row) * Example: $dataRow = ['data1', 1234, null, '', 'data5', false]; * - * @return \Box\Spout\Writer\AbstractWriter + * @return AbstractWriter * @throws \Box\Spout\Writer\Exception\WriterNotOpenedException If this function is called before opening the writer * @throws \Box\Spout\Common\Exception\IOException If unable to write data */ @@ -173,7 +173,7 @@ abstract class AbstractWriter implements WriterInterface * ['data21', 'data22', null, false], * ]; * - * @return \Box\Spout\Writer\AbstractWriter + * @return AbstractWriter * @throws \Box\Spout\Common\Exception\InvalidArgumentException If the input param is not valid * @throws \Box\Spout\Writer\Exception\WriterNotOpenedException If this function is called before opening the writer * @throws \Box\Spout\Common\Exception\IOException If unable to write data diff --git a/src/Spout/Writer/CSV.php b/src/Spout/Writer/CSV/Writer.php similarity index 93% rename from src/Spout/Writer/CSV.php rename to src/Spout/Writer/CSV/Writer.php index 59e37a7..d37ad5b 100644 --- a/src/Spout/Writer/CSV.php +++ b/src/Spout/Writer/CSV/Writer.php @@ -1,16 +1,17 @@ EOD; - /** @var \Box\Spout\Writer\Sheet The "external" sheet */ + /** @var \Box\Spout\Writer\XLSX\Sheet The "external" sheet */ protected $externalSheet; /** @var string Path to the XML file that will contain the sheet data */ protected $worksheetFilePath; - /** @var \Box\Spout\Writer\Helper\XLSX\SharedStringsHelper Helper to write shared strings */ + /** @var \Box\Spout\Writer\XLSX\Helper\SharedStringsHelper Helper to write shared strings */ protected $sharedStringsHelper; /** @var bool Whether inline or shared strings should be used */ @@ -42,9 +42,9 @@ EOD; protected $lastWrittenRowIndex = 0; /** - * @param \Box\Spout\Writer\Sheet $externalSheet The associated "external" sheet + * @param \Box\Spout\Writer\XLSX\Sheet $externalSheet The associated "external" sheet * @param string $worksheetFilesFolder Temporary folder where the files to create the XLSX will be stored - * @param \Box\Spout\Writer\Helper\XLSX\SharedStringsHelper $sharedStringsHelper Helper for shared strings + * @param \Box\Spout\Writer\XLSX\Helper\SharedStringsHelper $sharedStringsHelper Helper for shared strings * @param bool $shouldUseInlineStrings Whether inline or shared strings should be used * @throws \Box\Spout\Common\Exception\IOException If the sheet data file cannot be opened for writing */ @@ -76,7 +76,7 @@ EOD; } /** - * @return \Box\Spout\Writer\Sheet The "external" sheet + * @return \Box\Spout\Writer\XLSX\Sheet The "external" sheet */ public function getExternalSheet() { diff --git a/src/Spout/Writer/Sheet.php b/src/Spout/Writer/XLSX/Sheet.php similarity index 91% rename from src/Spout/Writer/Sheet.php rename to src/Spout/Writer/XLSX/Sheet.php index 7f8a874..46380a2 100644 --- a/src/Spout/Writer/Sheet.php +++ b/src/Spout/Writer/XLSX/Sheet.php @@ -1,12 +1,12 @@ book->getWorksheets(); - /** @var Internal\XLSX\Worksheet $worksheet */ + /** @var Internal\Worksheet $worksheet */ foreach ($worksheets as $worksheet) { $externalSheets[] = $worksheet->getExternalSheet(); } diff --git a/tests/Spout/Writer/CSVTest.php b/tests/Spout/Writer/CSV/WriterTest.php similarity index 93% rename from tests/Spout/Writer/CSVTest.php rename to tests/Spout/Writer/CSV/WriterTest.php index ef71b87..83e2e03 100644 --- a/tests/Spout/Writer/CSVTest.php +++ b/tests/Spout/Writer/CSV/WriterTest.php @@ -1,16 +1,17 @@ writeToCsvFileAndReturnWrittenContent($allRows, 'csv_with_utf8_bom.csv'); - $this->assertContains(CSV::UTF8_BOM, $writtenContent, 'The CSV file should contain a UTF-8 BOM'); + $this->assertContains(Writer::UTF8_BOM, $writtenContent, 'The CSV file should contain a UTF-8 BOM'); } /** @@ -161,6 +162,6 @@ class CSVTest extends \PHPUnit_Framework_TestCase private function trimWrittenContent($writtenContent) { // remove line feeds and UTF-8 BOM - return trim($writtenContent, PHP_EOL . CSV::UTF8_BOM); + return trim($writtenContent, PHP_EOL . Writer::UTF8_BOM); } } diff --git a/tests/Spout/Writer/Helper/XLSX/CellHelperTest.php b/tests/Spout/Writer/XLSX/Helper/CellHelperTest.php similarity index 97% rename from tests/Spout/Writer/Helper/XLSX/CellHelperTest.php rename to tests/Spout/Writer/XLSX/Helper/CellHelperTest.php index a5045aa..f46b1c6 100644 --- a/tests/Spout/Writer/Helper/XLSX/CellHelperTest.php +++ b/tests/Spout/Writer/XLSX/Helper/CellHelperTest.php @@ -1,11 +1,11 @@ createGeneratedFolderIfNeeded($fileName); $resourcePath = $this->getGeneratedResourcePath($fileName); - /** @var \Box\Spout\Writer\XLSX $writer */ + /** @var \Box\Spout\Writer\XLSX\Writer $writer */ $writer = WriterFactory::create(Type::XLSX); $writer->openToFile($resourcePath); diff --git a/tests/Spout/Writer/XLSXTest.php b/tests/Spout/Writer/XLSX/WriterTest.php similarity index 96% rename from tests/Spout/Writer/XLSXTest.php rename to tests/Spout/Writer/XLSX/WriterTest.php index 0abc252..7c6f5ea 100644 --- a/tests/Spout/Writer/XLSXTest.php +++ b/tests/Spout/Writer/XLSX/WriterTest.php @@ -1,16 +1,17 @@ createGeneratedFolderIfNeeded($fileName); $resourcePath = $this->getGeneratedResourcePath($fileName); - /** @var \Box\Spout\Writer\XLSX $writer */ + /** @var \Box\Spout\Writer\XLSX\Writer $writer */ $writer = WriterFactory::create(Type::XLSX); $writer->setShouldUseInlineStrings(true); @@ -278,7 +279,7 @@ class XLSXTest extends \PHPUnit_Framework_TestCase ]; // set the maxRowsPerSheet limit to 2 - \ReflectionHelper::setStaticValue('\Box\Spout\Writer\Internal\XLSX\Workbook', 'maxRowsPerWorksheet', 2); + \ReflectionHelper::setStaticValue('\Box\Spout\Writer\XLSX\Internal\Workbook', 'maxRowsPerWorksheet', 2); $writer = $this->writeToXLSXFile($dataRows, $fileName, true, $shouldCreateSheetsAutomatically = true); $this->assertEquals(2, count($writer->getSheets()), '2 sheets should have been created.'); @@ -302,7 +303,7 @@ class XLSXTest extends \PHPUnit_Framework_TestCase ]; // set the maxRowsPerSheet limit to 2 - \ReflectionHelper::setStaticValue('\Box\Spout\Writer\Internal\XLSX\Workbook', 'maxRowsPerWorksheet', 2); + \ReflectionHelper::setStaticValue('\Box\Spout\Writer\XLSX\Internal\Workbook', 'maxRowsPerWorksheet', 2); $writer = $this->writeToXLSXFile($dataRows, $fileName, true, $shouldCreateSheetsAutomatically = false); $this->assertEquals(1, count($writer->getSheets()), 'Only 1 sheet should have been created.'); @@ -348,14 +349,14 @@ class XLSXTest extends \PHPUnit_Framework_TestCase * @param string $fileName * @param bool $shouldUseInlineStrings * @param bool $shouldCreateSheetsAutomatically - * @return XLSX + * @return Writer */ private function writeToXLSXFile($allRows, $fileName, $shouldUseInlineStrings = true, $shouldCreateSheetsAutomatically = true) { $this->createGeneratedFolderIfNeeded($fileName); $resourcePath = $this->getGeneratedResourcePath($fileName); - /** @var \Box\Spout\Writer\XLSX $writer */ + /** @var \Box\Spout\Writer\XLSX\Writer $writer */ $writer = WriterFactory::create(Type::XLSX); $writer->setShouldUseInlineStrings($shouldUseInlineStrings); $writer->setShouldCreateNewSheetsAutomatically($shouldCreateSheetsAutomatically); @@ -373,14 +374,14 @@ class XLSXTest extends \PHPUnit_Framework_TestCase * @param string $fileName * @param bool $shouldUseInlineStrings * @param bool $shouldCreateSheetsAutomatically - * @return XLSX + * @return Writer */ private function writeToMultipleSheetsInXLSXFile($allRows, $numSheets, $fileName, $shouldUseInlineStrings = true, $shouldCreateSheetsAutomatically = true) { $this->createGeneratedFolderIfNeeded($fileName); $resourcePath = $this->getGeneratedResourcePath($fileName); - /** @var \Box\Spout\Writer\XLSX $writer */ + /** @var \Box\Spout\Writer\XLSX\Writer $writer */ $writer = WriterFactory::create(Type::XLSX); $writer->setShouldUseInlineStrings($shouldUseInlineStrings); $writer->setShouldCreateNewSheetsAutomatically($shouldCreateSheetsAutomatically);