diff --git a/composer.json b/composer.json index f448b6e..14213eb 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,5 @@ { "name": "iter8/builder", - "version": "3.0.3", "description": "A wrapper for the PHP Excel library to help you quickly build reports", "keywords": ["phpexcel", "reports", "excel", "spout", "silex"], "license": "MIT", @@ -21,11 +20,13 @@ "require": { "php": "^7.1", "phpoffice/phpspreadsheet": "~1.2", - "box/spout": "^2.7" + "box/spout": "^2.7", + "webmozart/assert": "^1.3" }, "require-dev": { "phpunit/phpunit": "^7.0", - "silex/silex": "^2.0" + "silex/silex": "^2.0", + "symfony/var-dumper": "^4.1" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index a7a7417..cb7734a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9fb19db6c0ba0126812375820b10989c", + "content-hash": "98557f66691846b17e7be45d59e73df0", "packages": [ { "name": "box/spout", @@ -74,18 +74,113 @@ ], "time": "2017-09-25T19:44:35+00:00" }, + { + "name": "markbaker/complex", + "version": "1.4.7", + "source": { + "type": "git", + "url": "https://github.com/MarkBaker/PHPComplex.git", + "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000" + }, + "dist": { + "type": "zip", + "url": "https://github.com/gitapi/repos/MarkBaker/PHPComplex/zipball/1ea674a8308baf547cbcbd30c5fcd6d301b7c000", + "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000", + "shasum": "" + }, + "require": { + "php": "^5.6.0|^7.0.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3", + "phpcompatibility/php-compatibility": "^8.0", + "phpdocumentor/phpdocumentor": "2.*", + "phploc/phploc": "2.*", + "phpmd/phpmd": "2.*", + "phpunit/phpunit": "^4.8.35|^5.4.0", + "sebastian/phpcpd": "2.*", + "squizlabs/php_codesniffer": "^3.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Complex\\": "classes/src/" + }, + "files": [ + "classes/src/functions/abs.php", + "classes/src/functions/acos.php", + "classes/src/functions/acosh.php", + "classes/src/functions/acot.php", + "classes/src/functions/acoth.php", + "classes/src/functions/acsc.php", + "classes/src/functions/acsch.php", + "classes/src/functions/argument.php", + "classes/src/functions/asec.php", + "classes/src/functions/asech.php", + "classes/src/functions/asin.php", + "classes/src/functions/asinh.php", + "classes/src/functions/atan.php", + "classes/src/functions/atanh.php", + "classes/src/functions/conjugate.php", + "classes/src/functions/cos.php", + "classes/src/functions/cosh.php", + "classes/src/functions/cot.php", + "classes/src/functions/coth.php", + "classes/src/functions/csc.php", + "classes/src/functions/csch.php", + "classes/src/functions/exp.php", + "classes/src/functions/inverse.php", + "classes/src/functions/ln.php", + "classes/src/functions/log2.php", + "classes/src/functions/log10.php", + "classes/src/functions/negative.php", + "classes/src/functions/pow.php", + "classes/src/functions/rho.php", + "classes/src/functions/sec.php", + "classes/src/functions/sech.php", + "classes/src/functions/sin.php", + "classes/src/functions/sinh.php", + "classes/src/functions/sqrt.php", + "classes/src/functions/tan.php", + "classes/src/functions/tanh.php", + "classes/src/functions/theta.php", + "classes/src/operations/add.php", + "classes/src/operations/subtract.php", + "classes/src/operations/multiply.php", + "classes/src/operations/divideby.php", + "classes/src/operations/divideinto.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Baker", + "email": "mark@lange.demon.co.uk" + } + ], + "description": "PHP Class for working with complex numbers", + "homepage": "https://github.com/MarkBaker/PHPComplex", + "keywords": [ + "complex", + "mathematics" + ], + "time": "2018-10-13T23:28:42+00:00" + }, { "name": "phpoffice/phpspreadsheet", - "version": "1.3.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "aa5b0d0236c907fd8dba0883f3ceb97cc52e46ec" + "reference": "2dfd06c59825914a1a325f2a2ed13634b9d8c411" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/PHPOffice/PhpSpreadsheet/zipball/aa5b0d0236c907fd8dba0883f3ceb97cc52e46ec", - "reference": "aa5b0d0236c907fd8dba0883f3ceb97cc52e46ec", + "url": "https://github.com/gitapi/repos/PHPOffice/PhpSpreadsheet/zipball/2dfd06c59825914a1a325f2a2ed13634b9d8c411", + "reference": "2dfd06c59825914a1a325f2a2ed13634b9d8c411", "shasum": "" }, "require": { @@ -101,6 +196,7 @@ "ext-xmlwriter": "*", "ext-zip": "*", "ext-zlib": "*", + "markbaker/complex": "^1.4.1", "php": "^5.6|^7.0", "psr/simple-cache": "^1.0" }, @@ -110,14 +206,14 @@ "jpgraph/jpgraph": "^4.0", "mpdf/mpdf": "^7.0.0", "phpunit/phpunit": "^5.7", - "squizlabs/php_codesniffer": "^2.7", + "squizlabs/php_codesniffer": "^3.3", "tecnickcom/tcpdf": "^6.2" }, "suggest": { "dompdf/dompdf": "Option for rendering PDF with PDF Writer", "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", "mpdf/mpdf": "Option for rendering PDF with PDF Writer", - "tecnick.com/tcpdf": "Option for rendering PDF with PDF Writer" + "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" }, "type": "library", "autoload": { @@ -158,7 +254,7 @@ "xls", "xlsx" ], - "time": "2018-06-12T13:40:21+00:00" + "time": "2018-10-21T10:04:54+00:00" }, { "name": "psr/simple-cache", @@ -207,6 +303,56 @@ "simple-cache" ], "time": "2017-10-23T01:57:42+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + }, + "dist": { + "type": "zip", + "url": "https://github.com/gitapi/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-01-29T19:49:41+00:00" } ], "packages-dev": [ @@ -568,16 +714,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.7.6", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "url": "https://github.com/gitapi/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { @@ -589,12 +735,12 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -627,20 +773,20 @@ "spy", "stub" ], - "time": "2018-04-18T13:57:24+00:00" + "time": "2018-08-05T17:53:17+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.0.7", + "version": "6.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a" + "reference": "4d3ae9b21a7d7e440bd0cf65565533117976859f" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/php-code-coverage/zipball/865662550c384bc1db7e51d29aeda1c2c161d69a", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a", + "url": "https://github.com/gitapi/repos/sebastianbergmann/php-code-coverage/zipball/4d3ae9b21a7d7e440bd0cf65565533117976859f", + "reference": "4d3ae9b21a7d7e440bd0cf65565533117976859f", "shasum": "" }, "require": { @@ -651,7 +797,7 @@ "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", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, @@ -664,7 +810,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.0-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -690,25 +836,28 @@ "testing", "xunit" ], - "time": "2018-06-01T07:51:50+00:00" + "time": "2018-10-23T05:59:32+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c", + "url": "https://github.com/gitapi/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { "php": "^7.1" }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, "type": "library", "extra": { "branch-alias": { @@ -737,7 +886,7 @@ "filesystem", "iterator" ], - "time": "2018-06-11T11:44:00+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -880,16 +1029,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.2.7", + "version": "7.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8e878aff7917ef66e702e03d1359b16eee254e2c" + "reference": "c151651fb6ed264038d486ea262e243af72e5e64" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/phpunit/zipball/8e878aff7917ef66e702e03d1359b16eee254e2c", - "reference": "8e878aff7917ef66e702e03d1359b16eee254e2c", + "url": "https://github.com/gitapi/repos/sebastianbergmann/phpunit/zipball/c151651fb6ed264038d486ea262e243af72e5e64", + "reference": "c151651fb6ed264038d486ea262e243af72e5e64", "shasum": "" }, "require": { @@ -910,11 +1059,11 @@ "phpunit/php-timer": "^2.0", "sebastian/comparator": "^3.0", "sebastian/diff": "^3.0", - "sebastian/environment": "^3.1", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", + "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, "conflict": { @@ -934,7 +1083,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.2-dev" + "dev-master": "7.4-dev" } }, "autoload": { @@ -960,7 +1109,7 @@ "testing", "xunit" ], - "time": "2018-07-15T05:20:50+00:00" + "time": "2018-10-23T05:57:41+00:00" }, { "name": "pimple/pimple", @@ -1588,25 +1737,25 @@ }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://github.com/gitapi/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1626,7 +1775,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" }, { "name": "sebastian/version", @@ -1755,20 +1904,21 @@ "keywords": [ "microframework" ], + "abandoned": "symfony/flex", "time": "2018-04-20T05:17:01+00:00" }, { "name": "symfony/debug", - "version": "v4.1.2", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "a1f2118cedb8731c45e945cdd2b808ca82abc4b5" + "reference": "e3f76ce6198f81994e019bb2b4e533e9de1b9b90" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/debug/zipball/a1f2118cedb8731c45e945cdd2b808ca82abc4b5", - "reference": "a1f2118cedb8731c45e945cdd2b808ca82abc4b5", + "url": "https://github.com/gitapi/repos/symfony/debug/zipball/e3f76ce6198f81994e019bb2b4e533e9de1b9b90", + "reference": "e3f76ce6198f81994e019bb2b4e533e9de1b9b90", "shasum": "" }, "require": { @@ -1811,20 +1961,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2018-07-06T14:52:28+00:00" + "time": "2018-10-02T16:36:10+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.1.2", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "00d64638e4f0703a00ab7fc2c8ae5f75f3b4020f" + "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/event-dispatcher/zipball/00d64638e4f0703a00ab7fc2c8ae5f75f3b4020f", - "reference": "00d64638e4f0703a00ab7fc2c8ae5f75f3b4020f", + "url": "https://github.com/gitapi/repos/symfony/event-dispatcher/zipball/bfb30c2ad377615a463ebbc875eba64a99f6aa3e", + "reference": "bfb30c2ad377615a463ebbc875eba64a99f6aa3e", "shasum": "" }, "require": { @@ -1874,20 +2024,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2018-07-10T11:02:47+00:00" + "time": "2018-07-26T09:10:45+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.1.2", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "8da9ea68ab2d80dfabd41e0d14b9606bb47a10c0" + "reference": "d528136617ff24f530e70df9605acc1b788b08d4" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/http-foundation/zipball/8da9ea68ab2d80dfabd41e0d14b9606bb47a10c0", - "reference": "8da9ea68ab2d80dfabd41e0d14b9606bb47a10c0", + "url": "https://github.com/gitapi/repos/symfony/http-foundation/zipball/d528136617ff24f530e70df9605acc1b788b08d4", + "reference": "d528136617ff24f530e70df9605acc1b788b08d4", "shasum": "" }, "require": { @@ -1928,20 +2078,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2018-07-16T14:05:40+00:00" + "time": "2018-10-03T08:48:45+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.1.2", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "ebd28f4f88a2ca0a0488882ad73c4004f3afdbe3" + "reference": "f5e7c15a5d010be0e16ce798594c5960451d4220" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/http-kernel/zipball/ebd28f4f88a2ca0a0488882ad73c4004f3afdbe3", - "reference": "ebd28f4f88a2ca0a0488882ad73c4004f3afdbe3", + "url": "https://github.com/gitapi/repos/symfony/http-kernel/zipball/f5e7c15a5d010be0e16ce798594c5960451d4220", + "reference": "f5e7c15a5d010be0e16ce798594c5960451d4220", "shasum": "" }, "require": { @@ -2015,29 +2165,32 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-07-23T17:16:22+00:00" + "time": "2018-10-03T12:53:38+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "url": "https://github.com/gitapi/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "suggest": { + "ext-ctype": "For best performance" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2070,20 +2223,20 @@ "polyfill", "portable" ], - "time": "2018-04-30T19:57:29+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", + "version": "v1.9.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://github.com/gitapi/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", "shasum": "" }, "require": { @@ -2095,7 +2248,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -2129,20 +2282,75 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae" + }, + "dist": { + "type": "zip", + "url": "https://github.com/gitapi/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae", + "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-08-06T14:22:27+00:00" }, { "name": "symfony/routing", - "version": "v4.1.2", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "73770bf3682b4407b017c2bdcb2b11cdcbce5322" + "reference": "537803f0bdfede36b9acef052d2e4d447d9fa0e9" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/routing/zipball/73770bf3682b4407b017c2bdcb2b11cdcbce5322", - "reference": "73770bf3682b4407b017c2bdcb2b11cdcbce5322", + "url": "https://github.com/gitapi/repos/symfony/routing/zipball/537803f0bdfede36b9acef052d2e4d447d9fa0e9", + "reference": "537803f0bdfede36b9acef052d2e4d447d9fa0e9", "shasum": "" }, "require": { @@ -2206,97 +2414,122 @@ "uri", "url" ], - "time": "2018-06-28T06:30:33+00:00" + "time": "2018-10-02T12:40:59+00:00" }, { - "name": "theseer/tokenizer", - "version": "1.1.0", + "name": "symfony/var-dumper", + "version": "v4.1.6", "source": { "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + "url": "https://github.com/symfony/var-dumper.git", + "reference": "60319b45653580b0cdacca499344577d87732f16" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "url": "https://github.com/gitapi/repos/symfony/var-dumper/zipball/60319b45653580b0cdacca499344577d87732f16", + "reference": "60319b45653580b0cdacca499344577d87732f16", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.5" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/console": "<3.4" + }, + "require-dev": { + "ext-iconv": "*", + "symfony/process": "~3.4|~4.0", + "twig/twig": "~1.34|~2.4" }, + "suggest": { + "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", + "ext-intl": "To show region name in time zone dump", + "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, "autoload": { - "classmap": [ - "src/" + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" + "description": "Symfony mechanism for exploring and dumping PHP variables", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "time": "2018-10-02T16:36:10+00:00" }, { - "name": "webmozart/assert", - "version": "1.3.0", + "name": "theseer/tokenizer", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "url": "https://github.com/gitapi/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" } ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2018-01-29T19:49:41+00:00" + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" } ], "aliases": [], diff --git a/src/Builder/Builder.php b/src/Builder/Builder.php index f62160f..5210294 100644 --- a/src/Builder/Builder.php +++ b/src/Builder/Builder.php @@ -41,7 +41,12 @@ class Builder /** * @var array */ - private $data; + private $headers = []; + + /** + * @var array + */ + private $data = []; /** * @var null|string @@ -53,7 +58,10 @@ class Builder */ private $title; - private $sheetTitles; + /** + * @var array + */ + private $sheetTitles = []; /** * @var null|string @@ -68,17 +76,17 @@ class Builder /** * @var array */ - private $sheets; + private $sheets = []; /** * @var array */ - private $columnWidths; + private $columnWidths = []; /** * @var array */ - private $columnStyles; + private $columnStyles = []; /** * Builder constructor. @@ -171,12 +179,14 @@ public function generateExcel(): void $this->createSheets(); } else { // Single sheet - these will be an array and a string. + $headers = $this->getHeaders(); $reportArray = $this->getData(); $sheetTitle = $this->getSheetTitles(); $this->builder->setActiveSheetIndex(0); $this->createSheet( + $headers, $reportArray, $sheetTitle ); @@ -210,7 +220,8 @@ public function createSheets(): void foreach ($sheets as $sheet) { $this->createSheet( - $sheet, + $sheet['headers'], + $sheet['rows'], $titles[$sheetCount] ); @@ -231,13 +242,15 @@ public function createSheets(): void } /** - * @param array $data + * @param array $headers + * @param array $rows * @param string $title * * @return void */ public function createSheet( - array $data, + array $headers, + array $rows, string $title ): void { // Check if we are setting any custom column widths. @@ -261,14 +274,14 @@ public function createSheet( ]); // Build column headers. - $this->builder->buildHeaderRow($data[0], $style); + $this->builder->buildHeaderRow($headers, $style); // Build all the rows now. - $this->builder->buildRows($data); + $this->builder->buildRows($rows); // If no column widths are specified, then simply auto-size all columns. if (!$this->hasColumnWidths()) { - $this->builder->autoSizeColumns($data[0]); + $this->builder->autoSizeColumns($rows[0]); } // Rename sheet. @@ -324,19 +337,23 @@ public function setCreator($creator): self return $this; } - /** - * @return array - */ + public function getHeaders(): array + { + return $this->headers; + } + + public function setHeaders(array $headers): self + { + $this->headers = $headers; + + return $this; + } + public function getData(): array { return $this->data; } - /** - * @param array $data - * - * @return $this - */ public function setData(array $data): self { $this->data = $data; diff --git a/src/Builder/Builders/SpoutBuilder.php b/src/Builder/Builders/SpoutBuilder.php index dad9f83..4871f69 100644 --- a/src/Builder/Builders/SpoutBuilder.php +++ b/src/Builder/Builders/SpoutBuilder.php @@ -181,12 +181,10 @@ public function buildHeaderRow( $this->initialise(); } - $keys = array_keys($columns); - if ($style instanceof Style) { - $this->writer->addRowWithStyle($keys, $style); + $this->writer->addRowWithStyle($columns, $style); } else { - $this->writer->addRow($keys); + $this->writer->addRow($columns); } return; diff --git a/tests/PHPSpreadsheetTest.php b/tests/PHPSpreadsheetTest.php index d8797de..5062853 100644 --- a/tests/PHPSpreadsheetTest.php +++ b/tests/PHPSpreadsheetTest.php @@ -45,22 +45,29 @@ public function can_create_single_sheet_spreadsheet() // Act $app['builder']->setSheetTitles('PHPExcel Test'); + $app['builder']->setHeaders( + [ + 'Column 1', + 'Column 2', + 'Column 3', + ] + ); $app['builder']->setData( [ [ - 'Column 1' => 'column_1', - 'Column 2' => 'column_2', - 'Column 3' => 'column_3', + 'column_1', + 'column_2', + 'column_3', ], [ - 'Column 1' => '1', - 'Column 2' => 'Two', - 'Column 3' => '333' + '1', + 'Two', + '333' ], [ - 'Column 1' => 'One', - 'Column 2' => '2', - 'Column 3' => 'Three x 3' + 'One', + '2', + 'Three x 3' ], ] ); @@ -95,20 +102,32 @@ public function can_create_multi_sheet_spreadsheet() $app['builder']->setSheets( [ [ - [ - 'Column 1' => 'Row 1', - 'Column 2' => 'Sheet 1', + 'headers' => [ + 'Column 1', + 'Column 2', + ], + 'rows' => [ + [ + 'Row 1', + 'Sheet 1', + ] ], ], [ - [ - 'Column 1' => 'Row 2', - 'Column 2' => 'Sheet 2', - ], - [ - 'Column 1' => 'Row 3', - 'Column 2' => 'Sheet 2', + 'headers' => [ + 'Column 1', + 'Column 2', ], + 'rows' => [ + [ + 'Row 2', + 'Sheet 2', + ], + [ + 'Row 3', + 'Sheet 2', + ], + ] ], ] ); diff --git a/tests/SpoutTest.php b/tests/SpoutTest.php index e2ffc4a..7a16c4f 100644 --- a/tests/SpoutTest.php +++ b/tests/SpoutTest.php @@ -3,6 +3,8 @@ namespace Tests\Builder; use Box\Spout\Common\Helper\FileSystemHelper; +use Box\Spout\Common\Type; +use Box\Spout\Reader\ReaderFactory; use Box\Spout\Writer\Style\Color; use Box\Spout\Writer\Style\Style; use Box\Spout\Writer\Style\StyleBuilder; @@ -72,8 +74,6 @@ public function row_style_is_parsed_correctly() /** * @test - * - * TODO: Open the file with the Reader and verify a row/column value. */ public function can_create_single_sheet_spreadsheet() { @@ -83,27 +83,20 @@ public function can_create_single_sheet_spreadsheet() 'builder.default' => 'spout', 'builder.cache_dir' => $this->getCacheDir(), ]); - // $reader = ReaderFactory::create(Type::XLSX); + $reader = ReaderFactory::create(Type::XLSX); // Act $app['builder']->setSheetTitles('Spout Test'); + $app['builder']->setHeaders([ + 'Column 1', + 'Column 2', + 'Column 3', + ]); $app['builder']->setData( [ - [ - 'Column 1' => 'column_1', - 'Column 2' => 'column_2', - 'Column 3' => 'column_3', - ], - [ - 'Column 1' => '1', - 'Column 2' => 'Two', - 'Column 3' => '333' - ], - [ - 'Column 1' => 'One', - 'Column 2' => '2', - 'Column 3' => 'Three x 3' - ], + ['column_1', 'column_2', 'column_3'], + ['1', 'Two', '333'], + ['One', '2', 'Three x 3'], ] ); $app['builder']->generateExcel(); @@ -113,14 +106,36 @@ public function can_create_single_sheet_spreadsheet() // Assert $this->assertFileExists($generatedExcelFile); $this->assertGreaterThan(3000, stat($generatedExcelFile)['size']); -// $reader->open($generatedExcel); -// -// $sheets = $reader->getSheetIterator(); -// -// $sheets->rewind(); -// -// $sheet = $sheets->current()->getRowIterator()->next()->current(); -// die(var_dump($sheet)); + $reader->open($generatedExcelFile); + + // Need to use `iterator_to_array` as it's the only way to coerce Spout to read the spreadsheet into memory + // unless you manually do a foreach over the rows. + $sheets = iterator_to_array($reader->getSheetIterator()); + // Sheets array is *NOT* zero-based when fetched from the iterator. + $sheetData = iterator_to_array($sheets[1]->getRowIterator()); + + $headers = array_shift($sheetData); + $rows = $sheetData; + + $this->assertCount(3, $headers, sprintf('Headers row should have 3 values, "%d" supplied.', count($headers))); + $this->assertEquals('Column 1', $headers[0]); + $this->assertEquals('Column 2', $headers[1]); + $this->assertEquals('Column 3', $headers[2]); + + $this->assertCount(3, $rows, sprintf('Rows should have 3 rows, "%d" supplied.', count($rows))); + + $row1 = $rows[0]; + $row3 = $rows[2]; + + $this->assertCount(3, $row1, sprintf('Row 1 should have 3 values, "%d" supplied.', count($row1))); + $this->assertEquals('column_1', $row1[0]); + $this->assertEquals('column_2', $row1[1]); + $this->assertEquals('column_3', $row1[2]); + + $this->assertCount(3, $row3, sprintf('Row 3 should have 3 values, "%d" supplied.', count($row3))); + $this->assertEquals('One', $row3[0]); + $this->assertEquals('2', $row3[1]); + $this->assertEquals('Three x 3', $row3[2]); } /** @@ -145,20 +160,32 @@ public function can_create_multi_sheet_spreadsheet() $app['builder']->setSheets( [ [ - [ - 'Column 1' => 'Row 1', - 'Column 2' => 'Sheet 1', + 'headers' => [ + 'Column 1', + 'Column 2', + ], + 'rows' => [ + [ + 'Row 1', + 'Sheet 1', + ] ], ], [ - [ - 'Column 1' => 'Row 2', - 'Column 2' => 'Sheet 2', - ], - [ - 'Column 1' => 'Row 3', - 'Column 2' => 'Sheet 2', + 'headers' => [ + 'Column 1', + 'Column 2', ], + 'rows' => [ + [ + 'Row 2', + 'Sheet 2', + ], + [ + 'Row 3', + 'Sheet 2', + ], + ] ], ] );