diff --git a/.travis.yml b/.travis.yml index 9476f34d9..4df1a4fc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ install: - composer validate --no-check-all --no-check-publish - composer install -script: ./vendor/bin/phpunit Test/ +script: ./vendor/bin/phpunit testbench/xlsxwriter.class.Test.php after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/Test/FilePropertyTest.php b/Test/FilePropertyTest.php deleted file mode 100644 index 57c45ef63..000000000 --- a/Test/FilePropertyTest.php +++ /dev/null @@ -1,60 +0,0 @@ -setAuthor($expected_author); - - $xlsx_properties = $writer->getFileProperties(); - - $this->assertEquals($expected_author, $xlsx_properties["author"]); - } - - public function testTitle() { - $expected_title = "My Spreadsheet"; - $writer = new \XLSXWriter(); - $writer->setTitle($expected_title); - - $xlsx_properties = $writer->getFileProperties(); - - $this->assertEquals($expected_title, $xlsx_properties["title"]); - } - - public function testSubject() { - $expected_subject = "My Spreadsheet is Wonderful"; - $writer = new \XLSXWriter(); - $writer->setSubject($expected_subject); - - $xlsx_properties = $writer->getFileProperties(); - - $this->assertEquals($expected_subject, $xlsx_properties["subject"]); - } - - public function testCompany() { - $expected_company = "EBANX"; - $writer = new \XLSXWriter(); - $writer->setCompany($expected_company); - - $xlsx_properties = $writer->getFileProperties(); - - $this->assertEquals($expected_company, $xlsx_properties["company"]); - } - - public function testKeywords() { - $expected_keywords = ["spreadsheet", "php", "EBANX"]; - $writer = new \XLSXWriter(); - $writer->setKeywords($expected_keywords); - - $xlsx_properties = $writer->getFileProperties(); - - $this->assertEquals($expected_keywords, $xlsx_properties["keywords"]); - } - -} diff --git a/Test/XLSXWriterTest.php b/Test/XLSXWriterTest.php deleted file mode 100644 index 36b163640..000000000 --- a/Test/XLSXWriterTest.php +++ /dev/null @@ -1,523 +0,0 @@ -writeCell($file_writer, 0, 0, '0123', 'string'); - $file_writer->close(); - $cell_xml = file_get_contents($filename); - $this->assertNotEquals('123', $cell_xml); - $this->assertEquals('0', $cell_xml);//0123 should be the 0th index of the shared string array - @unlink($filename); - } - - /** - * @covers XLSXWriter::writeToFile - */ - public function testWriteToFile() { - $filename = tempnam("/tmp", "xlsx_writer"); - - $header = ['0'=>'string','1'=>'string','2'=>'string','3'=>'string']; - $sheet = [ - ['55','66','77','88'], - ['10','11','12','13'], - ]; - - $xlsx_writer = new XLSXWriter(); - $xlsx_writer->writeSheet($sheet,'mysheet',$header); - $xlsx_writer->writeToFile($filename); - - $zip = new ZipArchive(); - $r = $zip->open($filename); - $this->assertTrue($r); - - $this->assertNotEmpty(($zip->numFiles)); - - $out_sheet = []; - for($z=0; $z < $zip->numFiles; $z++) { - $inside_zip_filename = $zip->getNameIndex($z); - - if (preg_match("/sheet(\d+).xml/", basename($inside_zip_filename))) { - $out_sheet = $this->stripCellsFromSheetXML($zip->getFromName($inside_zip_filename)); - array_shift($out_sheet); - $out_sheet = array_values($out_sheet); - } - } - - $zip->close(); - @unlink($filename); - - $r1 = self::array_diff_assoc_recursive($out_sheet, $sheet); - $r2 = self::array_diff_assoc_recursive($sheet, $out_sheet); - $this->assertEmpty($r1); - $this->assertEmpty($r2); - } - - public function testMarkMergedCells() { - $filename = tempnam("/tmp", "xlsx_writer"); - - $header = ['0'=>'string','1'=>'string','2'=>'string','3'=>'string']; - $sheet = [ - ['55','66','77','88'], - ['10','11','12','13'], - ]; - - $expected_merged_range = "B2:C3"; - - $xlsx_writer = new XLSXWriter(); - $xlsx_writer->writeSheetHeader('mysheet', $header); - $xlsx_writer->writeSheetRow('mysheet', $sheet[0]); - $xlsx_writer->writeSheetRow('mysheet', $sheet[1]); - $xlsx_writer->markMergedCell('mysheet', 1, 1, 2, 2); - $xlsx_writer->writeToFile($filename); - - $zip = new ZipArchive(); - $r = $zip->open($filename); - $xml = $this->extractSheetXml($zip); - - $this->assertTrue($r); - $this->assertNotEmpty(($zip->numFiles)); - $this->assertNotEmpty($xml); - - $merged_cell_range = $xml->mergeCells->mergeCell["ref"][0]; - - $this->assertEquals($expected_merged_range, $merged_cell_range); - - $zip->close(); - @unlink($filename); - } - - /** - * @dataProvider getFreezeCellsScenarios - */ - public function testFreezeCells($freeze_cols, $freeze_rows, $expected_active_cells, $expected_pane) { - $filename = tempnam("/tmp", "xlsx_writer"); - - $header = ['0'=>'string','1'=>'string','2'=>'string','3'=>'string']; - $sheet = [ - ['55','66','77','88'], - ['10','11','12','13'], - ]; - - $col_options = ['freeze_columns' => $freeze_cols, 'freeze_rows' => $freeze_rows]; - - $xlsx_writer = new XLSXWriter(); - $xlsx_writer->writeSheetHeader('mysheet', $header, $format = 'xlsx', $delimiter = ';', $subheader = NULL, $col_options); - $xlsx_writer->writeSheetRow('mysheet', $sheet[0]); - $xlsx_writer->writeSheetRow('mysheet', $sheet[1]); - $xlsx_writer->writeToFile($filename); - - $zip = new ZipArchive(); - $r = $zip->open($filename); - $xml = $this->extractSheetXml($zip); - - $this->assertTrue($r); - $this->assertNotEmpty(($zip->numFiles)); - $this->assertNotEmpty($xml); - - $sheet_view = $xml->sheetViews->sheetView; - - if (!empty($expected_pane)) { - $pane = $sheet_view->pane; - foreach ($expected_pane as $expected_key => $expected_value) { - $attribute = (string) $pane[0][$expected_key]; - $this->assertEquals($expected_value, $attribute); - } - } - - $selections = $sheet_view->selection; - for ($i = 0; $i < count($expected_active_cells); $i++) { - $this->assertEquals($expected_active_cells[$i]['cell'], $selections[$i]['activeCell']); - $this->assertEquals($expected_active_cells[$i]['cell'], $selections[$i]['sqref']); - $this->assertEquals($expected_active_cells[$i]['pane'], $selections[$i]['pane']); - } - - $zip->close(); - @unlink($filename); - } - - public static function getFreezeCellsScenarios() { - return [ - "Not frozen" => [ - $freeze_cols = false, - $freeze_rows = false, - $expected_active_cells = [["cell" => "A1", "pane" => "topLeft"]], - $expected_pane = [], - ], - "Frozen Col B and Row 2" => [ - $freeze_cols = 1, - $freeze_rows = 1, - $expected_active_cells = [["cell" => "A2", "pane" => "topRight"], ["cell" => "B1", "pane" => "bottomLeft"], ["cell" => "B2", "pane" => "bottomRight"]], - $expected_pane = ["ySplit" => $freeze_rows, "xSplit" => $freeze_cols, "topLeftCell" => "B2", "activePane" => "bottomRight"], - ], - "Frozen Col B" => [ - $freeze_cols = 1, - $freeze_rows = false, - $expected_active_cells = [["cell" => "B1", "pane" => "topRight"]], - $expected_pane = ["xSplit" => $freeze_cols, "topLeftCell" => "B1", "activePane" => "topRight"], - ], - "Frozen Row 2" => [ - $freeze_cols = false, - $freeze_rows = 1, - $expected_active_cells = [["cell" => "A2", "pane" => "bottomLeft"]], - $expected_pane = ["ySplit" => $freeze_rows, "topLeftCell" => "A2", "activePane" => "bottomLeft"], - ], - "Frozen Col A and Row 1" => [ - $freeze_cols = 0, - $freeze_rows = 0, - $expected_active_cells = [["cell" => "A1", "pane" => "topRight"], ["cell" => "A1", "pane" => "bottomLeft"], ["cell" => "A1", "pane" => "bottomRight"]], - $expected_pane = ["ySplit" => $freeze_rows, "xSplit" => $freeze_cols, "topLeftCell" => "A1", "activePane" => "bottomRight"], - ], - "Frozen Col A" => [ - $freeze_cols = 0, - $freeze_rows = false, - $expected_active_cells = [["cell" => "A1", "pane" => "topRight"]], - $expected_pane = ["xSplit" => $freeze_cols, "topLeftCell" => "A1", "activePane" => "topRight"], - ], - "Frozen Row 1" => [ - $freeze_cols = false, - $freeze_rows = 0, - $expected_active_cells = [["cell" => "A1", "pane" => "bottomLeft"]], - $expected_pane = ["ySplit" => $freeze_rows, "topLeftCell" => "A1", "activePane" => "bottomLeft"], - ], - ]; - } - - public function testColumnsWidths() { - $filename = tempnam("/tmp", "xlsx_writer"); - - $header = ['0'=>'string','1'=>'string','2'=>'string','3'=>'string']; - $sheet = [ - ['55','66','77','88'], - ['10','11','12','13'], - ]; - - $widths = [10, 20, 30, 40]; - - $col_options = ['widths' => $widths]; - - $xlsx_writer = new XLSXWriter(); - $xlsx_writer->writeSheetHeader('mysheet', $header, $format = 'xlsx', $delimiter = ';', $subheader = NULL, $col_options); - $xlsx_writer->writeSheetRow('mysheet', $sheet[0]); - $xlsx_writer->writeSheetRow('mysheet', $sheet[1]); - $xlsx_writer->writeToFile($filename); - - $zip = new ZipArchive(); - $r = $zip->open($filename); - $xml = $this->extractSheetXml($zip); - - $this->assertTrue($r); - $this->assertNotEmpty(($zip->numFiles)); - $this->assertNotEmpty($xml); - - $cols = $xml->cols->col; - foreach ($widths as $col_index => $col_width) { - $col = $cols[$col_index]; - $this->assertFalse(filter_var($col["collapsed"], FILTER_VALIDATE_BOOLEAN)); - $this->assertFalse(filter_var($col["hidden"], FILTER_VALIDATE_BOOLEAN)); - $this->assertTrue(filter_var($col["customWidth"], FILTER_VALIDATE_BOOLEAN)); - $this->assertEquals($col_index + 1, (string) $col["max"]); - $this->assertEquals($col_index + 1, (string) $col["min"]); - $this->assertEquals("0", (string) $col["style"]); - $this->assertEquals($col_width, (string) $col["width"]); - } - $last_col_index = count($widths); - $last_col = $cols[$last_col_index]; - $this->assertFalse(filter_var($last_col["collapsed"], FILTER_VALIDATE_BOOLEAN)); - $this->assertFalse(filter_var($last_col["hidden"], FILTER_VALIDATE_BOOLEAN)); - $this->assertFalse(filter_var($last_col["customWidth"], FILTER_VALIDATE_BOOLEAN)); - $this->assertEquals("1024", (string) $last_col["max"]); - $this->assertEquals($last_col_index + 1, (string) $last_col["min"]); - $this->assertEquals("0", (string) $last_col["style"]); - $this->assertEquals("11.5", (string) $last_col["width"]); - - $zip->close(); - @unlink($filename); - } - - public function testRowHeight() { - $filename = tempnam("/tmp", "xlsx_writer"); - - $sheet = [ - ['55','66','77','88'], - ['10','11','12','13'], - ]; - - $custom_height = 20.5; - - $row_options = ['height' => $custom_height]; - - $xlsx_writer = new XLSXWriter(); - $xlsx_writer->writeSheetRow('mysheet', $sheet[0], $format = 'xlsx', $delimiter = ';', $row_options); - $xlsx_writer->writeSheetRow('mysheet', $sheet[1]); - $xlsx_writer->writeToFile($filename); - - $zip = new ZipArchive(); - $r = $zip->open($filename); - $xml = $this->extractSheetXml($zip); - - $this->assertTrue($r); - $this->assertNotEmpty(($zip->numFiles)); - $this->assertNotEmpty($xml); - - $rows = $xml->sheetData->row; - $this->assertRowProperties($custom_height, $expected_custom_height = true, $expected_hidden = false, $expected_collapsed = false, $rows[0]); - $this->assertRowProperties($expected_height = 12.1, $expected_custom_height = false, $expected_hidden = false, $expected_collapsed = false, $rows[1]); - - $zip->close(); - @unlink($filename); - } - - public function testRowHidden() { - $filename = tempnam("/tmp", "xlsx_writer"); - - $sheet = [ - ['55','66','77','88'], - ['10','11','12','13'], - ]; - - $row_options = ['hidden' => true]; - - $expected_height = 12.1; - $expected_custom_height = false; - $expected_collapsed = false; - - $xlsx_writer = new XLSXWriter(); - $xlsx_writer->writeSheetRow('mysheet', $sheet[0], $format = 'xlsx', $delimiter = ';', $row_options); - $xlsx_writer->writeSheetRow('mysheet', $sheet[1]); - $xlsx_writer->writeToFile($filename); - - $zip = new ZipArchive(); - $r = $zip->open($filename); - $xml = $this->extractSheetXml($zip); - - $this->assertTrue($r); - $this->assertNotEmpty(($zip->numFiles)); - $this->assertNotEmpty($xml); - - $rows = $xml->sheetData->row; - $this->assertRowProperties($expected_height, $expected_custom_height, $expected_hidden = true, $expected_collapsed, $rows[0]); - $this->assertRowProperties($expected_height, $expected_custom_height, $expected_hidden = false, $expected_collapsed, $rows[1]); - - $zip->close(); - @unlink($filename); - } - - public function testRowCollapsed() { - $filename = tempnam("/tmp", "xlsx_writer"); - - $sheet = [ - ['55','66','77','88'], - ['10','11','12','13'], - ]; - - $row_options = ['collapsed' => true]; - - $expected_height = 12.1; - $expected_custom_height = false; - $expected_hidden = false; - - $xlsx_writer = new XLSXWriter(); - $xlsx_writer->writeSheetRow('mysheet', $sheet[0], $format = 'xlsx', $delimiter = ';', $row_options); - $xlsx_writer->writeSheetRow('mysheet', $sheet[1]); - $xlsx_writer->writeToFile($filename); - - $zip = new ZipArchive(); - $r = $zip->open($filename); - $xml = $this->extractSheetXml($zip); - - $this->assertTrue($r); - $this->assertNotEmpty(($zip->numFiles)); - $this->assertNotEmpty($xml); - - $rows = $xml->sheetData->row; - $this->assertRowProperties($expected_height, $expected_custom_height, $expected_hidden, $expected_collapsed = true, $rows[0]); - $this->assertRowProperties($expected_height, $expected_custom_height, $expected_hidden, $expected_collapsed = false, $rows[1]); - - $zip->close(); - @unlink($filename); - } - - public function testAddBorder() { - $filename = tempnam("/tmp", "xlsx_writer"); - - $header = ["0"=>"string", "1"=>"string", "2"=>"string", "3"=>"string"]; - $sheet = [ - ["55", "66", "77", "88"], - ["10", "11", "12", "13"], - ]; - - $expected_borders = ["right", "left", "top", "bottom"]; - $expected_border_style = "thick"; - $expected_border_color_base = "ff99cc"; - $expected_border_color = "FFFF99CC"; - - $row_options = [ - "border" => implode(",", $expected_borders), - "border-style" => $expected_border_style, - "border-color" => "#$expected_border_color_base" , - ]; - - $xlsx_writer = new XLSXWriter(); - $xlsx_writer->writeSheetHeader("mysheet", $header); - $xlsx_writer->writeSheetRow("mysheet", $sheet[0], $format = "xlsx", $delimiter = ";", $row_options); - $xlsx_writer->writeSheetRow("mysheet", $sheet[1]); - $xlsx_writer->writeToFile($filename); - - $zip = new ZipArchive(); - $r = $zip->open($filename); - $xml = $this->extractSheetXml($zip); - $styles = $this->extractStyleXml($zip); - - $this->assertTrue($r); - $this->assertNotEmpty(($zip->numFiles)); - $this->assertNotEmpty($xml); - $this->assertNotEmpty($styles); - - $border_styles = $styles->borders; - $this->assertBorderStyle($expected_border_style, $expected_border_color, $border = $border_styles->border[1]); - $this->assertFillStyle($expected_pattern = "solid", $expected_bg_color = "FF003300", $styles->fills->fill[2]); - $this->assertFontStyle($expected_font_name = "Arial", $expected_is_bold = "true", $styles->fonts->font[4]); - - $cell_styles = $styles->cellXfs->xf; - $this->assertCellStyle($expected_apply_border_string = "false", $expected_border_id = 0, $expected_fill_id = 2, $expected_font_id = 4, $cell_styles[6]); - $this->assertCellStyle($expected_apply_border_string = "true", $expected_border_id = 1, $expected_fill_id = 0, $expected_font_id = 0, $cell_styles[7]); - - $rows = $xml->sheetData->row; - $this->assertRowHasStyleIndex($rows[0], $expected_header_style = 6); - $this->assertRowHasStyleIndex($rows[1], $expected_style = 7); - - $zip->close(); - @unlink($filename); - } - - private function stripCellsFromSheetXML($sheet_xml) { - $output = []; - - $xml = new SimpleXMLElement($sheet_xml); - - for ($i = 0; $i < count($xml->sheetData->row); $i++) { - $row = $xml->sheetData->row[$i]; - for ($j = 0; $j < count($row->c); $j ++) { - $output[$i][$j] = (string)$row->c[$j]->v; - } - } - - return $output; - } - - public static function array_diff_assoc_recursive($array1, $array2) { - $difference = []; - foreach($array1 as $key => $value) { - if(is_array($value)) { - if(!isset($array2[$key]) || !is_array($array2[$key])) { - $difference[$key] = $value; - } else { - $new_diff = self::array_diff_assoc_recursive($value, $array2[$key]); - if(!empty($new_diff)) { - $difference[$key] = $new_diff; - } - } - } else if(!isset($array2[$key]) || $array2[$key] != $value) { - $difference[$key] = $value; - } - } - - return empty($difference) ? [] : $difference; - } - - private function extractSheetXml($zip) { - for($z=0; $z < $zip->numFiles; $z++) { - $inside_zip_filename = $zip->getNameIndex($z); - $sheet_xml = $zip->getFromName($inside_zip_filename); - if (preg_match("/sheet(\d+).xml/", basename($inside_zip_filename))) { - return new SimpleXMLElement($sheet_xml); - } - } - - return null; - } - - private function extractStyleXml($zip) { - for($z=0; $z < $zip->numFiles; $z++) { - $inside_zip_filename = $zip->getNameIndex($z); - $xml = $zip->getFromName($inside_zip_filename); - if (preg_match("/styles.xml/", basename($inside_zip_filename))) { - return new SimpleXMLElement($xml); - } - } - - return null; - } - - private function assertRowProperties($expected_height, $expected_custom_height, $expected_hidden, $expected_collapsed, $row) { - $this->assertEquals($expected_height, (string)$row['ht']); - $this->assertEquals($expected_custom_height, filter_var($row['customHeight'], FILTER_VALIDATE_BOOLEAN)); - $this->assertEquals($expected_hidden, filter_var($row['hidden'], FILTER_VALIDATE_BOOLEAN)); - $this->assertEquals($expected_collapsed, filter_var($row['collapsed'], FILTER_VALIDATE_BOOLEAN)); - } - - private function assertCellStyle($expected_apply_border_string, $expected_border_id, $expected_fill_id, $expected_font_id, $cell_style) { - $this->assertEquals($expected_apply_border_string, $cell_style["applyBorder"]); - $this->assertEquals($expected_border_id, (int)$cell_style["borderId"]); - $this->assertEquals($expected_fill_id, (int)$cell_style["fillId"]); - $this->assertEquals($expected_font_id, (int)$cell_style["fontId"]); - } - - private function assertBorderStyle($expected_border_style, $expected_border_color, $border) { - $this->assertEquals($expected_border_style, $border->left["style"]); - $this->assertEquals($expected_border_style, $border->right["style"]); - $this->assertEquals($expected_border_style, $border->top["style"]); - $this->assertEquals($expected_border_style, $border->bottom["style"]); - - $this->assertEquals($expected_border_color, $border->left->color["rgb"]); - $this->assertEquals($expected_border_color, $border->right->color["rgb"]); - $this->assertEquals($expected_border_color, $border->top->color["rgb"]); - $this->assertEquals($expected_border_color, $border->bottom->color["rgb"]); - } - - private function assertFillStyle($expected_pattern, $expected_bg_color, $fill) { - $this->assertEquals($expected_pattern, $fill->patternFill["patternType"]); - if (!empty($expected_bg_color)) { - $this->assertEquals($expected_bg_color, $fill->patternFill->bgColor["rgb"]); - } - } - - private function assertFontStyle($expected_font_name, $expected_is_bold, $font) { - $this->assertEquals($expected_font_name, $font->name["val"]); - if (!empty($expected_is_bold)) { - $this->assertEquals($expected_is_bold, $font->b["val"]); - } - } - - private function assertRowHasStyleIndex($row, $expected_style) { - foreach ($row->c as $cell) { - $this->assertEquals($expected_style, (int)$cell["s"]); - } - } -} diff --git a/composer.json b/composer.json index b6a6b4512..c963afe2e 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,6 @@ "classmap": ["xlsxwriter.class.php"] }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "4.3.*" } } diff --git a/composer.lock b/composer.lock index 87737532d..fdd58eeac 100644 --- a/composer.lock +++ b/composer.lock @@ -4,41 +4,37 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9c5833be9ba3f93c4ddfb4ac7316b78a", + "content-hash": "6d76d900200f071de0f2b27bca3d7bd8", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.2.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^9", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -52,7 +48,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", @@ -61,409 +57,61 @@ "constructor", "instantiate" ], - "time": "2019-03-17T17:37:11+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.9.1", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", - "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", - "shasum": "" - }, - "require": { - "php": "^7.1" + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2019-04-07T13:18:21+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" }, { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" } ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2017-09-11T18:02:19+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-04-30T17:48:53+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2017-07-14T14:27:02+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.8.1", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2019-06-13T12:50:23+00:00" + "time": "2022-03-03T08:28:38+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "2.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -478,7 +126,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", + "email": "sb@sebastian-bergmann.de", "role": "lead" } ], @@ -489,47 +137,47 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "support": { + "irc": "irc://irc.freenode.net/phpunit", + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/2.2" + }, + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", "shasum": "" }, "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" + "php": ">=5.3.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "classmap": [ - "src/" + "File/" ] }, "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", + "email": "sb@sebastian-bergmann.de", "role": "lead" } ], @@ -539,7 +187,12 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "support": { + "irc": "irc://irc.freenode.net/phpunit", + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.3.4" + }, + "time": "2013-10-10T15:34:57+00:00" }, { "name": "phpunit/php-text-template", @@ -580,32 +233,36 @@ "keywords": [ "template" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "2.1.2", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "1.0-dev" } }, "autoload": { @@ -620,7 +277,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", + "email": "sb@sebastian-bergmann.de", "role": "lead" } ], @@ -629,33 +286,37 @@ "keywords": [ "timer" ], - "time": "2019-06-07T04:22:29+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/master" + }, + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.0.1", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", - "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.1" + "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "~4.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -678,57 +339,48 @@ "keywords": [ "tokenizer" ], - "time": "2018-10-30T05:52:18+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/1.4" + }, + "abandoned": true, + "time": "2017-12-04T08:55:13+00:00" }, { "name": "phpunit/phpunit", - "version": "7.5.13", + "version": "4.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b9278591caa8630127f96c63b598712b699e671c" + "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b9278591caa8630127f96c63b598712b699e671c", - "reference": "b9278591caa8630127f96c63b598712b699e671c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2dab9d593997db4abcf58d0daf798eb4e9cecfe1", + "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, - "require-dev": { - "ext-pdo": "*" + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpunit/php-code-coverage": "~2.0", + "phpunit/php-file-iterator": "~1.3.2", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "~1.0.2", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.0", + "sebastian/diff": "~1.1", + "sebastian/environment": "~1.0", + "sebastian/exporter": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.0" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/php-invoker": "~1.1" }, "bin": [ "phpunit" @@ -736,7 +388,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "4.3.x-dev" } }, "autoload": { @@ -745,6 +397,10 @@ ] }, "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "", + "../../symfony/yaml/" + ], "license": [ "BSD-3-Clause" ], @@ -756,38 +412,49 @@ } ], "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", + "homepage": "http://www.phpunit.de/", "keywords": [ "phpunit", "testing", "xunit" ], - "time": "2019-06-19T12:01:51+00:00" + "support": { + "irc": "irc://irc.freenode.net/phpunit", + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/4.3" + }, + "time": "2014-11-11T10:11:09+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.3.x-dev" } }, "autoload": { @@ -802,39 +469,50 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sb@sebastian-bergmann.de", + "role": "lead" } ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "support": { + "irc": "irc://irc.freenode.net/phpunit", + "issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues", + "source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/2.3" + }, + "abandoned": true, + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -865,39 +543,42 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", + "homepage": "http://www.github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/1.2" + }, + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "3.0.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -922,40 +603,38 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" + "diff" ], - "time": "2019-02-04T06:01:07+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/1.4" + }, + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", - "version": "4.2.2", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404" + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -980,34 +659,38 @@ "environment", "hhvm" ], - "time": "2019-05-05T09:05:15+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/1.3" + }, + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.0", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -1047,175 +730,36 @@ "export", "exporter" ], - "time": "2017-04-03T13:19:02+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/master" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -1243,73 +787,27 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/master" }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, - "require": { - "php": ">=5.6" - }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "classmap": [ "src/" @@ -1328,24 +826,31 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/1.0.6" + }, + "time": "2015-06-21T13:59:46+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.11.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "82ebae02209c21113908c229e9883c419720738a" + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", - "reference": "82ebae02209c21113908c229e9883c419720738a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" @@ -1353,29 +858,33 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -1386,80 +895,56 @@ "polyfill", "portable" ], - "time": "2019-02-06T07:57:58+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-06-13T22:48:21+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { - "name": "webmozart/assert", - "version": "1.4.0", + "name": "symfony/yaml", + "version": "v2.8.52", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + "url": "https://github.com/symfony/yaml.git", + "reference": "02c1859112aa779d9ab394ae4f3381911d84052b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "url": "https://api.github.com/repos/symfony/yaml/zipball/02c1859112aa779d9ab394ae4f3381911d84052b", + "reference": "02c1859112aa779d9ab394ae4f3381911d84052b", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "php": ">=5.3.9", + "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "2.8-dev" } }, "autoload": { "psr-4": { - "Webmozart\\Assert\\": "src/" - } + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1467,17 +952,20 @@ ], "authors": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2018-12-25T11:19:39+00:00" + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/yaml/tree/v2.8.52" + }, + "time": "2018-11-11T11:18:13+00:00" } ], "aliases": [], @@ -1486,5 +974,6 @@ "prefer-stable": false, "prefer-lowest": false, "platform": [], - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.0.0" } diff --git a/testbench/xlsxwriter.class.Test.php b/testbench/xlsxwriter.class.Test.php index c6ea5efc4..f17c071eb 100644 --- a/testbench/xlsxwriter.class.Test.php +++ b/testbench/xlsxwriter.class.Test.php @@ -2,8 +2,6 @@ include_once __DIR__.'/../vendor/autoload.php'; -use PHPUnit\Framework\TestCase; - //TODO test double:writeSheetHeader //TODO test invalid UTF8 //TODO test outoforder writeSheetRow('Sheet1',()); @@ -11,12 +9,12 @@ class _XLSXWriter_ extends XLSXWriter { public function writeCell(XLSXWriter_BuffererWriter &$file, $row_number, $column_number, $value, $cell_format) { - return call_user_func_array('parent::writeCell', [&$file, $row_number, $column_number, $value, $cell_format]); + parent::writeCell($file, $row_number, $column_number, $value, $cell_format); } } //Just a simple test, by no means comprehensive -class XLSXWriterTest extends TestCase +class XLSXWriterTest extends PHPUnit_Framework_TestCase { /** * @covers XLSXWriter::writeCell diff --git a/xlsxwriter.class.php b/xlsxwriter.class.php index ee1ae2998..5f0f8e243 100644 --- a/xlsxwriter.class.php +++ b/xlsxwriter.class.php @@ -20,46 +20,6 @@ class XLSXWriter protected $current_sheet = ''; - protected $title; - protected $subject; - protected $company; - protected $description; - protected $keywords = []; - - protected $cell_styles = []; - - private const CELL_STYLES = [ - 'money' => 1, - 'dollar' => 1, - 'datetime' => 2, - 'date' => 3, - 'string' => 0, - 'number.2' => 4, - 'number.4' => 5, - 'blackheader' => 6 - ]; - private const ALLOWED_BORDERS = [ - 'left', - 'right', - 'top', - 'bottom', - ]; - private const ALLOWED_BORDER_STYLES = [ - 'thin', - 'medium', - 'thick', - 'dashDot', - 'dashDotDot', - 'dashed', - 'dotted', - 'double', - 'hair', - 'mediumDashDot', - 'mediumDashDotDot', - 'mediumDashed', - 'slantDashDot', - ]; - public function __construct() { if(!ini_get('date.timezone')) @@ -67,38 +27,9 @@ public function __construct() //using date functions can kick out warning if this isn't set date_default_timezone_set('UTC'); } - - - $this->addCellStyle($number_format='GENERAL', $style_string=null); - $this->addCellStyle($number_format='GENERAL', $style_string=null); - $this->addCellStyle($number_format='GENERAL', $style_string=null); - $this->addCellStyle($number_format='GENERAL', $style_string=null); - $this->addCellStyle($number_format='string', $style_string=null); - $this->addCellStyle($number_format='money', $style_string=null); - $this->addCellStyle($number_format='dollar', $style_string=null); - $this->addCellStyle($number_format='datetime', $style_string=null); - $this->addCellStyle($number_format='date', $style_string=null); - $this->addCellStyle($number_format='number.2', $style_string=null); - $this->addCellStyle($number_format='number.4', $style_string=null); } public function setAuthor($author='') { $this->author=$author; } - public function setTitle($title='') { $this->title=$title; } - public function setSubject($subject='') { $this->subject=$subject; } - public function setCompany($company='') { $this->company=$company; } - public function setKeywords($keywords=[]) { $this->keywords=$keywords; } - public function setDescription($description='') { $this->description=$description; } - - public function getFileProperties(): array { - return [ - "author" => $this->author, - "title" => $this->title, - "subject" => $this->subject, - "company" => $this->company, - "keywords" => $this->keywords, - "description" => $this->description, - ]; - } public function __destruct() { @@ -165,7 +96,7 @@ public function writeToFile($filename) $zip->close(); } - protected function initializeSheet($sheet_name, $col_widths = [], $freeze_rows=false, $freeze_columns=false) + protected function initializeSheet($sheet_name) { //if already initialized if ($this->current_sheet==$sheet_name || isset($this->sheets[$sheet_name])) @@ -173,20 +104,17 @@ protected function initializeSheet($sheet_name, $col_widths = [], $freeze_rows=f $sheet_filename = $this->tempFilename(); $sheet_xmlname = 'sheet' . (count($this->sheets) + 1).".xml"; - $this->sheets[$sheet_name] = (object)[ + $this->sheets[$sheet_name] = (object)array( 'filename' => $sheet_filename, 'sheetname' => $sheet_name, 'xmlname' => $sheet_xmlname, 'row_count' => 0, 'file_writer' => new XLSXWriter_BuffererWriter($sheet_filename), - 'cell_formats' => [], - 'merge_cells' => [], + 'cell_formats' => array(), 'max_cell_tag_start' => 0, 'max_cell_tag_end' => 0, - 'freeze_rows' => $freeze_rows, - 'freeze_columns' => $freeze_columns, 'finalized' => false, - ]; + ); $sheet = &$this->sheets[$sheet_name]; $tabselected = count($this->sheets) == 1 ? 'true' : 'false';//only first sheet is selected $max_cell=XLSXWriter::xlsCell(self::EXCEL_2007_MAX_ROW, self::EXCEL_2007_MAX_COL);//XFE1048577 @@ -200,40 +128,16 @@ protected function initializeSheet($sheet_name, $col_widths = [], $freeze_rows=f $sheet->max_cell_tag_end = $sheet->file_writer->ftell(); $sheet->file_writer->write( ''); $sheet->file_writer->write( ''); - - if ($sheet->freeze_rows !== false && $sheet->freeze_columns !== false) { - $sheet->file_writer->write( ''); - $sheet->file_writer->write( ''); - $sheet->file_writer->write( ''); - $sheet->file_writer->write( ''); - } elseif ($sheet->freeze_rows !== false) { - $sheet->file_writer->write( ''); - $sheet->file_writer->write( ''); - } elseif ($sheet->freeze_columns !== false) { - $sheet->file_writer->write( ''); - $sheet->file_writer->write( ''); - } else { // not frozen - $sheet->file_writer->write( ''); - } - + $sheet->file_writer->write( ''); $sheet->file_writer->write( ''); $sheet->file_writer->write( ''); $sheet->file_writer->write( ''); - - $cols_count = count($col_widths); - - if (!empty($col_widths)) { - foreach($col_widths as $i => $column_width) { - $sheet->file_writer->write( ''); - } - } - $sheet->file_writer->write( ''); - + $sheet->file_writer->write( ''); $sheet->file_writer->write( ''); $sheet->file_writer->write( ''); } - public function writeSheetHeader($sheet_name, array $header_types, $format = 'xlsx', $delimiter = ';', $subheader = NULL, $col_options = []) { + public function writeSheetHeader($sheet_name, array $header_types, $format = 'xlsx', $delimiter = ';', $subheader = NULL) { if (empty($sheet_name) || empty($header_types) || !empty($this->sheets[$sheet_name])) { return; } @@ -257,28 +161,21 @@ public function writeSheetHeader($sheet_name, array $header_types, $format = 'xl $start = 0; } - $col_widths = (!empty($col_options['widths'])) ? (array)$col_options['widths'] : []; - $freeze_rows = (array_key_exists('freeze_rows', $col_options) && $col_options['freeze_rows'] !== false) ? intval($col_options['freeze_rows']) : false; - $freeze_columns = (array_key_exists('freeze_columns', $col_options) && $col_options['freeze_columns'] !== false) ? intval($col_options['freeze_columns']) : false; - - self::initializeSheet($sheet_name, $col_widths, $freeze_rows, $freeze_columns); + self::initializeSheet($sheet_name); $sheet = &$this->sheets[$sheet_name]; $sheet->cell_formats = array_values($header_types); $header_row = array_keys($header_types); $sheet->file_writer->write(''); $sheet->row_count++; $this->current_sheet = $sheet_name; } - public function writeSheetRow($sheet_name, array $row, $format = 'xlsx', $delimiter = ';', array $row_options = []) { + public function writeSheetRow($sheet_name, array $row, $format = 'xlsx', $delimiter = ';') { if (empty($sheet_name) || empty($row)) { return; } @@ -292,21 +189,14 @@ public function writeSheetRow($sheet_name, array $row, $format = 'xlsx', $delimi $sheet->cell_formats = array_fill(0, count($row), 'string'); } - $ht = array_key_exists('height', $row_options) ? floatval($row_options['height']) : 12.1; - $customHt = array_key_exists('height', $row_options) ? 'true' : 'false'; - $hidden = (array_key_exists('hidden', $row_options) && $row_options['hidden']) ? 'true' : 'false'; - $collapsed = (array_key_exists('collapsed', $row_options) && $row_options['collapsed']) ? 'true' : 'false'; - $sheet->file_writer->write(''); - - if (!empty($sheet->merge_cells)) { - $sheet->file_writer->write(''); - foreach ($sheet->merge_cells as $range) { - $sheet->file_writer->write(''); - } - $sheet->file_writer->write(''); - } - $sheet->file_writer->write( ''); $sheet->file_writer->write( ''); $sheet->file_writer->write( ''); @@ -347,20 +228,6 @@ protected function finalizeSheet($sheet_name) $sheet->finalized=true; } - public function markMergedCell($sheet_name, $start_cell_row, $start_cell_column, $end_cell_row, $end_cell_column, $format = 'xlsx') { - if (empty($sheet_name) || $this->sheets[$sheet_name]->finalized || $format == 'csv'){ - return; - } - - self::initializeSheet($sheet_name); - - $sheet = &$this->sheets[$sheet_name]; - $startCell = self::xlsCell($start_cell_row, $start_cell_column); - $endCell = self::xlsCell($end_cell_row, $end_cell_column); - - $sheet->merge_cells[] = $startCell . ":" . $endCell; - } - public function writeCSV(array $data, array $header_types=array(), $delimiter = ';') { $header_text = array_keys($header_types); @@ -399,50 +266,42 @@ public function writeSheet(array $data, $sheet_name='', array $header_types=arra $this->finalizeSheet($sheet_name); } - protected function getCellFormat($cell_format) { - return isset(self::CELL_STYLES[$cell_format]) ? self::CELL_STYLES[$cell_format] : '0'; - } - - private function addCellStyle($cell_format, $cell_style_string) { - $cell_format_idx = $this->getCellFormat($cell_format); - $lookup_string = $cell_format_idx.";".$cell_style_string; - $cell_style_idx = self::add_to_list_get_index($this->cell_styles, $lookup_string); - - return $cell_style_idx; - } - - protected function writeCell(XLSXWriter_BuffererWriter &$file, $row_number, $column_number, $value, $cell_format, $cell_style_idx = null) + protected function writeCell(XLSXWriter_BuffererWriter &$file, $row_number, $column_number, $value, $cell_format) { - $cell_name = self::xlsCell($row_number, $column_number); - if (is_null($cell_style_idx)) { - $cell_style_idx = $this->addCellStyle($cell_format, null); - } + static $styles = array( + 'money' => 1, + 'dollar' => 1, + 'datetime' => 2, + 'date' => 3, + 'string' => 0, + 'number.2' => 4, + 'number.4' => 5, + 'blackheader' => 6 + ); + $cell = self::xlsCell($row_number, $column_number); + $s = isset($styles[$cell_format]) ? $styles[$cell_format] : '0'; if (!is_scalar($value) || $value==='') { //objects, array, empty - $file->write(''); + $file->write(''); } elseif (preg_match('#^number\.[0-9]$#', $cell_format)) { - $file->write(''.$value.''); + $file->write(''.$value.''); } elseif ($cell_format=='date') { - $file->write(''.intval(self::convert_date_time($value)).''); + $file->write(''.intval(self::convert_date_time($value)).''); } elseif ($cell_format=='datetime') { - $file->write(''.self::convert_date_time($value).''); + $file->write(''.self::convert_date_time($value).''); } elseif (!is_string($value)) { - $file->write(''.($value*1).'');//int,float, etc - } elseif ($value[0]!='0' && filter_var($value, FILTER_VALIDATE_INT)){ //excel wants to trim leading zeros - $file->write(''.($value).'');//numeric string - } elseif ($value[0]=='='){ - $file->write(''.self::xmlspecialchars($value).''); + $file->write(''.($value*1).'');//int,float, etc + } elseif ($value{0}!='0' && filter_var($value, FILTER_VALIDATE_INT)){ //excel wants to trim leading zeros + $file->write(''.($value).'');//numeric string + } elseif ($value{0}=='='){ + $file->write(''.self::xmlspecialchars($value).''); } elseif ($value!==''){ - $file->write(''.self::xmlspecialchars($this->setSharedString($value)).''); + $file->write(''.self::xmlspecialchars($this->setSharedString($value)).''); } } protected function writeStylesXML() { - $styles = $this->spreadStyles(); - $borders = $styles['borders']; - $cell_styles = $styles['styles']; - $temporary_filename = $this->tempFilename(); $file = new XLSXWriter_BuffererWriter($temporary_filename); $file->write(''."\n"); @@ -467,32 +326,8 @@ protected function writeStylesXML() $file->write(' '); $file->write(' '); $file->write(''); - - $file->write(''); - $file->write( ''); - foreach($borders as $border) { - if (empty($border)) { - continue; - } - - $pieces = json_decode($border,true); - - $border_style = !empty($pieces['style']) ? $pieces['style'] : 'hair'; - $border_color = !empty($pieces['color']) ? '' : ''; - - $file->write(''); - - foreach (self::ALLOWED_BORDERS as $side) { - $show_side = in_array($side,$pieces['side']) ? true : false; - $file->write($show_side ? "<$side style=\"$border_style\">$border_color" : "<$side/>"); - } - - $file->write( ''); - $file->write(''); - } - $file->write(''); - - $file->write(''); + $file->write(''); + $file->write( ''); $file->write( ''); $file->write( ''); $file->write( ''); - - $file->write(''); - foreach($cell_styles as $cell_style) { - $applyAlignment = isset($cell_style['alignment']) ? 'true' : 'false'; - $wrapText = !empty($cell_style['wrap_text']) ? 'true' : 'false'; - $horizAlignment = isset($cell_style['halign']) ? $cell_style['halign'] : 'general'; - $vertAlignment = isset($cell_style['valign']) ? $cell_style['valign'] : 'bottom'; - $applyBorder = isset($cell_style['border_idx']) ? 'true' : 'false'; - $applyFont = 'true'; - $borderIdx = isset($cell_style['border_idx']) ? intval($cell_style['border_idx']) : 0; - $fillIdx = isset($cell_style['fill_idx']) ? intval($cell_style['fill_idx']) : 0; - $fontIdx = isset($cell_style['font_idx']) ? intval($cell_style['font_idx']) : 0; - $file->write(''); - $file->write(' '); - $file->write(' '); - } - $file->write(''); - + $file->write( ''); + $file->write( ''); + $file->write( ''); + $file->write( ''); + $file->write( ''); + $file->write( ''); + $file->write( ''); + $file->write( ''); + $file->write( ''); + $file->write( ''); $file->write( ''); $file->write( ''); $file->write( ''); @@ -545,46 +370,10 @@ protected function writeStylesXML() $file->write( ''); $file->write( ''); $file->write(''); - $file->close(); return $temporary_filename; } - protected function spreadStyles() { - $borders = [''];//1 placeholder for static xml later - $style_indexes = []; - - foreach ($this->cell_styles as $i => $cell_style_string) { - [$number_format_idx, $style_json_string] = explode(";", $cell_style_string, 2); - $style = json_decode($style_json_string, $as_assoc = true); - - $style_indexes[$i] = $style ?? []; - $style_indexes[$i]['num_fmt_idx'] = $number_format_idx; - if (isset($style['border']) && is_string($style['border'])) { //border is a comma delimited str - $border_value['side'] = array_intersect(explode(",", $style['border']), self::ALLOWED_BORDERS); - - if (isset($style['border-style']) && in_array($style['border-style'], self::ALLOWED_BORDER_STYLES)) { - $border_value['style'] = $style['border-style']; - } - - if (isset($style['border-color']) && is_string($style['border-color']) && $style['border-color'][0] == '#') { - $hexa_border_color = substr($style['border-color'], 1, 6); - $hexa_border_color = strlen($hexa_border_color) == 3 ? $hexa_border_color[0] . $hexa_border_color[0] . - $hexa_border_color[1] . $hexa_border_color[1] . - $hexa_border_color[2] . $hexa_border_color[2] : $hexa_border_color;// expand cf0 => ccff00 - $border_value['color'] = "FF" . strtoupper($hexa_border_color); - } - - $style_indexes[$i]['border_idx'] = self::add_to_list_get_index($borders, json_encode($border_value)); - } - } - - return [ - 'borders' => $borders, - 'styles' => $style_indexes, - ]; - } - protected function setSharedString($v) { if (isset($this->shared_strings[$v])) @@ -620,10 +409,7 @@ protected function buildAppXML() { $app_xml=""; $app_xml.=''."\n"; - $app_xml.=''; - $app_xml.='0'; - $app_xml.=''.self::xmlspecialchars($this->company).''; - $app_xml.=''; + $app_xml.='0'; return $app_xml; } @@ -633,13 +419,7 @@ protected function buildCoreXML() $core_xml.=''."\n"; $core_xml.=''; $core_xml.=''.date("Y-m-d\TH:i:s.00\Z").'';//$date_time = '2014-10-25T15:54:37.00Z'; - $core_xml.=''.self::xmlspecialchars($this->title).''; - $core_xml.=''.self::xmlspecialchars($this->subject).''; $core_xml.=''.self::xmlspecialchars($this->author).''; - if (!empty($this->keywords)) { - $core_xml.=''.self::xmlspecialchars(implode (", ", (array)$this->keywords)).''; - } - $core_xml.=''.self::xmlspecialchars($this->description).''; $core_xml.='0'; $core_xml.=''; return $core_xml; @@ -815,16 +595,6 @@ public static function convert_date_time($date_input) //thanks to Excel::Writer: return $days + $seconds; } //------------------------------------------------------------------ - public static function add_to_list_get_index(&$haystack, $needle) { - $existing_idx = array_search($needle, $haystack, $strict=true); - - if ($existing_idx === false) { - $existing_idx = count($haystack); - $haystack[] = $needle; - } - - return $existing_idx; - } } class XLSXWriter_BuffererWriter