diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bc3ab5c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 702a4f8..f7ce401 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php: ['8.2', '8.3', '8.4'] os: ['ubuntu-latest'] steps: diff --git a/composer.json b/composer.json index 75694ad..6e9b396 100644 --- a/composer.json +++ b/composer.json @@ -1,24 +1,10 @@ { "require": { - "textalk/websocket": "^1.5", - "iio/libmergepdf": "^4.0", - "cweagans/composer-patches": "^1.7" + "php": ">=8.2", + "phrity/websocket": "^3.6", + "karriere/pdf-merge": "^3.3" }, "config": { - "sort-packages": true, - "platform": { - "php": "7.2.9" - }, - "allow-plugins": { - "cweagans/composer-patches": true - } - }, - "extra": { - "composer-exit-on-patch-failure": true, - "patches": { - "iio/libmergepdf": { - "Add PHP 8.2 support": "patches/iio-libmergepdf-support-php82.patch" - } - } + "sort-packages": true } } diff --git a/composer.lock b/composer.lock index 8de3495..a24e8f2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,140 +4,444 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c7d83fbb2e2e3ef3a2d8ac90883d26d6", + "content-hash": "5cffa2096256d965b5bbedcd5a7b515b", "packages": [ { - "name": "cweagans/composer-patches", - "version": "1.7.3", + "name": "karriere/pdf-merge", + "version": "v3.3.1", "source": { "type": "git", - "url": "https://github.com/cweagans/composer-patches.git", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db" + "url": "https://github.com/karriereat/pdf-merge.git", + "reference": "d524a9d261ea96b18bbbab685b5710a7a0fe3a6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/e190d4466fe2b103a55467dfa83fc2fecfcaf2db", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db", + "url": "https://api.github.com/repos/karriereat/pdf-merge/zipball/d524a9d261ea96b18bbbab685b5710a7a0fe3a6e", + "reference": "d524a9d261ea96b18bbbab685b5710a7a0fe3a6e", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3.0" + "php": "8.1.* | 8.2.* | 8.3.* | 8.4.*", + "tecnickcom/tcpdf": "^6.3" }, "require-dev": { - "composer/composer": "~1.0 || ~2.0", - "phpunit/phpunit": "~4.6" + "laravel/pint": "^1.5 | ^1.6", + "pestphp/pest": "^1.22", + "phpstan/phpstan": "^1.10" }, - "type": "composer-plugin", - "extra": { - "class": "cweagans\\Composer\\Patches" + "type": "library", + "autoload": { + "psr-4": { + "Karriere\\PdfMerge\\": "src/" + }, + "classmap": [ + "tcpi/fpdf_tpl.php", + "tcpi/tcpdi.php", + "tcpi/tcpdi_parser.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alexander Lentner", + "email": "alexander.lentner@karriere.at", + "role": "Maintainer" + } + ], + "description": "A wrapper for the TCPDF class that provides an elegant API for merging PDFs", + "keywords": [ + "merge", + "pdf" + ], + "support": { + "issues": "https://github.com/karriereat/pdf-merge/issues", + "source": "https://github.com/karriereat/pdf-merge/tree/v3.3.1" + }, + "time": "2025-02-19T11:02:10+00:00" + }, + { + "name": "phrity/comparison", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/sirn-se/phrity-comparison.git", + "reference": "aedd44d59db08de7d6c31812d1490c22aab35c92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirn-se/phrity-comparison/zipball/aedd44d59db08de7d6c31812d1490c22aab35c92", + "reference": "aedd44d59db08de7d6c31812d1490c22aab35c92", + "shasum": "" }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", "autoload": { "psr-4": { - "cweagans\\Composer\\": "src" + "Phrity\\Comparison\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Cameron Eagans", - "email": "me@cweagans.net" + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" } ], - "description": "Provides a way to patch Composer packages.", + "description": "Interfaces and helper trait for comparing objects. Comparator for sort and filter applications.", + "homepage": "https://phrity.sirn.se/comparison", + "keywords": [ + "comparable", + "comparator", + "comparison", + "equalable", + "filter", + "sort" + ], + "support": { + "issues": "https://github.com/sirn-se/phrity-comparison/issues", + "source": "https://github.com/sirn-se/phrity-comparison/tree/1.4.0" + }, + "time": "2025-05-26T20:12:39+00:00" + }, + { + "name": "phrity/http", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sirn-se/phrity-http.git", + "reference": "536e3e46e6220d171a59599ed1f4da9f6b6244fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirn-se/phrity-http/zipball/536e3e46e6220d171a59599ed1f4da9f6b6244fc", + "reference": "536e3e46e6220d171a59599ed1f4da9f6b6244fc", + "shasum": "" + }, + "require": { + "php": "^8.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 | ^2.0" + }, + "require-dev": { + "guzzlehttp/psr7": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "robiningelbrecht/phpunit-coverage-tools": "^1.9", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Phrity\\Http\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "description": "Utilities and interfaces for handling HTTP.", + "homepage": "https://phrity.sirn.se/http", + "keywords": [ + "HTTP Factories", + "http", + "psr-17" + ], "support": { - "issues": "https://github.com/cweagans/composer-patches/issues", - "source": "https://github.com/cweagans/composer-patches/tree/1.7.3" + "issues": "https://github.com/sirn-se/phrity-http/issues", + "source": "https://github.com/sirn-se/phrity-http/tree/1.0.0" }, - "time": "2022-12-20T22:53:13+00:00" + "time": "2025-09-07T17:04:26+00:00" }, { - "name": "iio/libmergepdf", - "version": "4.0.4", + "name": "phrity/net-stream", + "version": "2.3.1", "source": { "type": "git", - "url": "https://github.com/hanneskod/libmergepdf.git", - "reference": "6613b978c08d00d559796ab510614243e4dd5dfb" + "url": "https://github.com/sirn-se/phrity-net-stream.git", + "reference": "c621bb3108a5a02bba64df2e5f0cd7ada02665b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hanneskod/libmergepdf/zipball/6613b978c08d00d559796ab510614243e4dd5dfb", - "reference": "6613b978c08d00d559796ab510614243e4dd5dfb", + "url": "https://api.github.com/repos/sirn-se/phrity-net-stream/zipball/c621bb3108a5a02bba64df2e5f0cd7ada02665b5", + "reference": "c621bb3108a5a02bba64df2e5f0cd7ada02665b5", "shasum": "" }, "require": { - "php": "^7.1||^8.0", - "setasign/fpdi": "^2", - "tecnickcom/tcpdf": "^6.2.22" + "php": "^8.1", + "phrity/util-errorhandler": "^1.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 | ^2.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "phrity/net-uri": "^2.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Phrity\\Net\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "description": "Socket stream classes implementing PSR-7 Stream and PSR-17 StreamFactory", + "homepage": "https://phrity.sirn.se/net-stream", + "keywords": [ + "Socket", + "client", + "psr-17", + "psr-7", + "server", + "stream", + "stream factory" + ], + "support": { + "issues": "https://github.com/sirn-se/phrity-net-stream/issues", + "source": "https://github.com/sirn-se/phrity-net-stream/tree/2.3.1" + }, + "time": "2025-08-08T09:51:04+00:00" + }, + { + "name": "phrity/net-uri", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/sirn-se/phrity-net-uri.git", + "reference": "08de4cf07e439c4708f572249659f09198ac99f0" }, - "conflict": { - "rafikhaceb/tcpdi": "*", - "setasign/fpdf": "*" + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirn-se/phrity-net-uri/zipball/08de4cf07e439c4708f572249659f09198ac99f0", + "reference": "08de4cf07e439c4708f572249659f09198ac99f0", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^8.1", + "phrity/comparison": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 | ^2.0" }, "require-dev": { - "phpunit/phpunit": "^7|^8", - "smalot/pdfparser": "~0.13" + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "phrity/util-errorhandler": "^1.1", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggest": { + "ext-intl": "Enables IDN conversion for non-ASCII domains" }, "type": "library", "autoload": { "psr-4": { - "iio\\libmergepdf\\": "src/" - }, - "classmap": [ - "tcpdi/" - ] + "Phrity\\Net\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "WTFPL" + "MIT" ], "authors": [ { - "name": "Hannes Forsgård", - "email": "hannes.forsgard@fripost.org" + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" } ], - "description": "Library for merging multiple PDFs", - "homepage": "https://github.com/hanneskod/libmergepdf", + "description": "PSR-7 Uri and PSR-17 UriFactory implementation", + "homepage": "https://phrity.sirn.se/net-uri", "keywords": [ - "merge", - "pdf" + "psr-17", + "psr-7", + "uri", + "uri factory" ], "support": { - "issues": "https://github.com/hanneskod/libmergepdf/issues", - "source": "https://github.com/hanneskod/libmergepdf/tree/4.0.4" + "issues": "https://github.com/sirn-se/phrity-net-uri/issues", + "source": "https://github.com/sirn-se/phrity-net-uri/tree/2.2.0" }, - "time": "2020-12-07T12:18:49+00:00" + "time": "2025-05-25T13:05:13+00:00" }, { - "name": "psr/log", - "version": "1.1.4", + "name": "phrity/util-errorhandler", + "version": "1.2.1", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "url": "https://github.com/sirn-se/phrity-util-errorhandler.git", + "reference": "9825f15ef9b4a93252ce53ca8962278832d834da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/sirn-se/phrity-util-errorhandler/zipball/9825f15ef9b4a93252ce53ca8962278832d834da", + "reference": "9825f15ef9b4a93252ce53ca8962278832d834da", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^8.1" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Phrity\\Util\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "description": "Inline error handler; catch and resolve errors for code block.", + "homepage": "https://phrity.sirn.se/util-errorhandler", + "keywords": [ + "error", + "warning" + ], + "support": { + "issues": "https://github.com/sirn-se/phrity-util-errorhandler/issues", + "source": "https://github.com/sirn-se/phrity-util-errorhandler/tree/1.2.1" + }, + "time": "2025-08-08T09:48:45+00:00" + }, + { + "name": "phrity/websocket", + "version": "3.6.0", + "source": { + "type": "git", + "url": "https://github.com/sirn-se/websocket-php.git", + "reference": "3f16b2564a230bbce716cccaff2f6156a60a8798" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirn-se/websocket-php/zipball/3f16b2564a230bbce716cccaff2f6156a60a8798", + "reference": "3f16b2564a230bbce716cccaff2f6156a60a8798", + "shasum": "" + }, + "require": { + "php": "^8.1", + "phrity/http": "^1.0", + "phrity/net-stream": "^2.3", + "phrity/net-uri": "^2.1", + "psr/http-message": "^1.1 | ^2.0", + "psr/log": "^1.0 | ^2.0 | ^3.0" + }, + "require-dev": { + "guzzlehttp/psr7": "^2.0", + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "phrity/logger-console": "^1.0", + "phrity/net-mock": "^2.3", + "phrity/util-errorhandler": "^1.1", + "robiningelbrecht/phpunit-coverage-tools": "^1.9", + "squizlabs/php_codesniffer": "^3.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "WebSocket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Fredrik Liljegren" + }, + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "description": "WebSocket client and server", + "homepage": "https://phrity.sirn.se/websocket", + "keywords": [ + "client", + "server", + "websocket" + ], + "support": { + "issues": "https://github.com/sirn-se/websocket-php/issues", + "source": "https://github.com/sirn-se/websocket-php/tree/3.6.0" + }, + "time": "2025-09-08T16:21:41+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -150,53 +454,48 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ - "log", + "factory", + "http", + "message", "psr", - "psr-3" + "psr-17", + "psr-7", + "request", + "response" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { - "name": "setasign/fpdi", - "version": "v2.6.4", + "name": "psr/http-message", + "version": "2.0", "source": { "type": "git", - "url": "https://github.com/Setasign/FPDI.git", - "reference": "4b53852fde2734ec6a07e458a085db627c60eada" + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/4b53852fde2734ec6a07e458a085db627c60eada", - "reference": "4b53852fde2734ec6a07e458a085db627c60eada", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { - "ext-zlib": "*", - "php": "^7.1 || ^8.0" - }, - "conflict": { - "setasign/tfpdf": "<1.31" - }, - "require-dev": { - "phpunit/phpunit": "^7", - "setasign/fpdf": "~1.8.6", - "setasign/tfpdf": "~1.33", - "squizlabs/php_codesniffer": "^3.5", - "tecnickcom/tcpdf": "^6.8" - }, - "suggest": { - "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured." + "php": "^7.2 || ^8.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { - "setasign\\Fpdi\\": "src/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -205,47 +504,87 @@ ], "authors": [ { - "name": "Jan Slabon", - "email": "jan.slabon@setasign.com", - "homepage": "https://www.setasign.com" - }, - { - "name": "Maximilian Kresse", - "email": "maximilian.kresse@setasign.com", - "homepage": "https://www.setasign.com" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.", - "homepage": "https://www.setasign.com/fpdi", + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", "keywords": [ - "fpdf", - "fpdi", - "pdf" + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" ], "support": { - "issues": "https://github.com/Setasign/FPDI/issues", - "source": "https://github.com/Setasign/FPDI/tree/v2.6.4" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "funding": [ + "time": "2023-04-04T09:54:51+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ { - "url": "https://tidelift.com/funding/github/packagist/setasign/fpdi", - "type": "tidelift" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "time": "2025-08-05T09:57:14+00:00" + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" }, { "name": "tecnickcom/tcpdf", - "version": "6.8.0", + "version": "6.10.0", "source": { "type": "git", "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "14ffa0e308f5634aa2489568b4b90b24073b6731" + "reference": "ca5b6de294512145db96bcbc94e61696599c391d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/14ffa0e308f5634aa2489568b4b90b24073b6731", - "reference": "14ffa0e308f5634aa2489568b4b90b24073b6731", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/ca5b6de294512145db96bcbc94e61696599c391d", + "reference": "ca5b6de294512145db96bcbc94e61696599c391d", "shasum": "" }, "require": { @@ -258,8 +597,6 @@ "config", "include", "tcpdf.php", - "tcpdf_parser.php", - "tcpdf_import.php", "tcpdf_barcodes_1d.php", "tcpdf_barcodes_2d.php", "include/tcpdf_colors.php", @@ -297,64 +634,15 @@ ], "support": { "issues": "https://github.com/tecnickcom/TCPDF/issues", - "source": "https://github.com/tecnickcom/TCPDF/tree/6.8.0" + "source": "https://github.com/tecnickcom/TCPDF/tree/6.10.0" }, "funding": [ { - "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project", + "url": "https://www.paypal.com/donate/?hosted_button_id=NZUEC5XS8MFBJ", "type": "custom" } ], - "time": "2024-12-23T13:34:57+00:00" - }, - { - "name": "textalk/websocket", - "version": "1.5.8", - "source": { - "type": "git", - "url": "https://github.com/Textalk/websocket-php.git", - "reference": "d05dbaa97500176447ffb1f1800573f23085ab13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Textalk/websocket-php/zipball/d05dbaa97500176447ffb1f1800573f23085ab13", - "reference": "d05dbaa97500176447ffb1f1800573f23085ab13", - "shasum": "" - }, - "require": { - "php": "^7.2 | ^8.0", - "psr/log": "^1 | ^2 | ^3" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.0", - "phpunit/phpunit": "^8.0|^9.0", - "squizlabs/php_codesniffer": "^3.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "WebSocket\\": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Fredrik Liljegren" - }, - { - "name": "Sören Jensen", - "email": "soren@abicart.se" - } - ], - "description": "WebSocket client and server", - "support": { - "issues": "https://github.com/Textalk/websocket-php/issues", - "source": "https://github.com/Textalk/websocket-php/tree/1.5.8" - }, - "time": "2022-04-26T06:28:24+00:00" + "time": "2025-05-27T18:02:28+00:00" } ], "packages-dev": [], @@ -363,10 +651,9 @@ "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": {}, - "platform-dev": {}, - "platform-overrides": { - "php": "7.2.9" + "platform": { + "php": ">=8.2" }, + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/library/Pdfexport/HeadlessChrome.php b/library/Pdfexport/HeadlessChrome.php index 23ebe85..5957b42 100644 --- a/library/Pdfexport/HeadlessChrome.php +++ b/library/Pdfexport/HeadlessChrome.php @@ -543,7 +543,7 @@ private function printToPDF($socket, $browserId, array $parameters) return $pdf; } - private function renderApiCall($method, $options = null) + private function renderApiCall($method, $options = null): string { $data = [ 'id' => time(), @@ -554,7 +554,7 @@ private function renderApiCall($method, $options = null) return json_encode($data, JSON_FORCE_OBJECT); } - private function parseApiResponse($payload) + private function parseApiResponse(string $payload) { $data = json_decode($payload, true); if (isset($data['method']) || isset($data['result'])) { @@ -619,10 +619,10 @@ private function registerEvent($method, $params) private function communicate(Client $ws, $method, $params = null) { Logger::debug('Transmitting CDP call: %s(%s)', $method, $params ? join(',', array_keys($params)) : ''); - $ws->send($this->renderApiCall($method, $params)); + $ws->text($this->renderApiCall($method, $params)); do { - $response = $this->parseApiResponse($ws->receive()); + $response = $this->parseApiResponse($ws->receive()->getContent()); $gotEvent = isset($response['method']); if ($gotEvent) { @@ -658,7 +658,7 @@ private function waitFor(Client $ws, $eventName, array $expectedParams = null) $response = $this->interceptedEvents[$interceptedPos]; $intercepted = true; } else { - $response = $this->parseApiResponse($ws->receive()); + $response = $this->parseApiResponse($ws->receive()->getContent()); $intercepted = false; } diff --git a/library/Pdfexport/ProvidedHook/Pdfexport.php b/library/Pdfexport/ProvidedHook/Pdfexport.php index 8bf5778..945e072 100644 --- a/library/Pdfexport/ProvidedHook/Pdfexport.php +++ b/library/Pdfexport/ProvidedHook/Pdfexport.php @@ -10,10 +10,10 @@ use Icinga\Application\Hook\PdfexportHook; use Icinga\Application\Icinga; use Icinga\Application\Web; +use Icinga\File\Storage\TemporaryLocalFileStorage; use Icinga\Module\Pdfexport\HeadlessChrome; use Icinga\Module\Pdfexport\PrintableHtmlDocument; -use iio\libmergepdf\Driver\TcpdiDriver; -use iio\libmergepdf\Merger; +use Karriere\PdfMerge\PdfMerge; use React\Promise\ExtendedPromiseInterface; class Pdfexport extends PdfexportHook @@ -165,11 +165,20 @@ protected function chrome() protected function mergePdfs(string ...$pdfs): string { - $merger = new Merger(new TcpdiDriver()); - foreach ($pdfs as $pdf) { - $merger->addRaw($pdf); - } + $merger = new PdfMerge(); + $storage = new TemporaryLocalFileStorage(); + + try { + foreach ($pdfs as $i => $pdf) { + $storage->create($i, $pdf); + $merger->add($storage->resolvePath($i)); + } - return $merger->merge(); + return $merger->merge('', 'S'); + } finally { + foreach ($pdfs as $i => $_) { + $storage->delete($i); + } + } } } diff --git a/vendor/autoload.php b/vendor/autoload.php index 7642d2c..5f84171 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -14,10 +14,7 @@ echo $err; } } - trigger_error( - $err, - E_USER_ERROR - ); + throw new RuntimeException($err); } require_once __DIR__ . '/composer/autoload_real.php'; diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 51e734a..2052022 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -26,12 +26,23 @@ */ class InstalledVersions { + /** + * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to + * @internal + */ + private static $selfDir = null; + /** * @var mixed[]|null * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null */ private static $installed; + /** + * @var bool + */ + private static $installedIsLocalDir; + /** * @var bool|null */ @@ -309,6 +320,24 @@ public static function reload($data) { self::$installed = $data; self::$installedByVendor = array(); + + // when using reload, we disable the duplicate protection to ensure that self::$installed data is + // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, + // so we have to assume it does not, and that may result in duplicate data being returned when listing + // all installed packages for example + self::$installedIsLocalDir = false; + } + + /** + * @return string + */ + private static function getSelfDir() + { + if (self::$selfDir === null) { + self::$selfDir = strtr(__DIR__, '\\', '/'); + } + + return self::$selfDir; } /** @@ -322,19 +351,27 @@ private static function getInstalled() } $installed = array(); + $copiedLocalDir = false; if (self::$canGetVendors) { + $selfDir = self::getSelfDir(); foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + $vendorDir = strtr($vendorDir, '\\', '/'); if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ $required = require $vendorDir.'/composer/installed.php'; - $installed[] = self::$installedByVendor[$vendorDir] = $required; - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { - self::$installed = $installed[count($installed) - 1]; + self::$installedByVendor[$vendorDir] = $required; + $installed[] = $required; + if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { + self::$installed = $required; + self::$installedIsLocalDir = true; } } + if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { + $copiedLocalDir = true; + } } } @@ -350,7 +387,7 @@ private static function getInstalled() } } - if (self::$installed !== array()) { + if (self::$installed !== array() && !$copiedLocalDir) { $installed[] = self::$installed; } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 9aed049..e598c22 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -8,8 +8,8 @@ return array( 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'Datamatrix' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php', - 'FPDF' => $vendorDir . '/iio/libmergepdf/tcpdi/tcpdi.php', - 'FPDF_TPL' => $vendorDir . '/iio/libmergepdf/tcpdi/fpdf_tpl.php', + 'FPDF' => $vendorDir . '/karriere/pdf-merge/tcpi/tcpdi.php', + 'FPDF_TPL' => $vendorDir . '/karriere/pdf-merge/tcpi/fpdf_tpl.php', 'PDF417' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/pdf417.php', 'QRcode' => $vendorDir . '/tecnickcom/tcpdf/include/barcodes/qrcode.php', 'TCPDF' => $vendorDir . '/tecnickcom/tcpdf/tcpdf.php', @@ -20,9 +20,7 @@ 'TCPDF_FONTS' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_fonts.php', 'TCPDF_FONT_DATA' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_font_data.php', 'TCPDF_IMAGES' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_images.php', - 'TCPDF_IMPORT' => $vendorDir . '/tecnickcom/tcpdf/tcpdf_import.php', - 'TCPDF_PARSER' => $vendorDir . '/tecnickcom/tcpdf/tcpdf_parser.php', 'TCPDF_STATIC' => $vendorDir . '/tecnickcom/tcpdf/include/tcpdf_static.php', - 'TCPDI' => $vendorDir . '/iio/libmergepdf/tcpdi/tcpdi.php', - 'tcpdi_parser' => $vendorDir . '/iio/libmergepdf/tcpdi/tcpdi_parser.php', + 'TCPDI' => $vendorDir . '/karriere/pdf-merge/tcpi/tcpdi.php', + 'tcpdi_parser' => $vendorDir . '/karriere/pdf-merge/tcpi/tcpdi_parser.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 0ddeaa4..6e32a62 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -6,9 +6,12 @@ $baseDir = dirname($vendorDir); return array( - 'setasign\\Fpdi\\' => array($vendorDir . '/setasign/fpdi/src'), - 'iio\\libmergepdf\\' => array($vendorDir . '/iio/libmergepdf/src'), - 'cweagans\\Composer\\' => array($vendorDir . '/cweagans/composer-patches/src'), - 'WebSocket\\' => array($vendorDir . '/textalk/websocket/lib'), - 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), + 'WebSocket\\' => array($vendorDir . '/phrity/websocket/src'), + 'Psr\\Log\\' => array($vendorDir . '/psr/log/src'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), + 'Phrity\\Util\\' => array($vendorDir . '/phrity/util-errorhandler/src'), + 'Phrity\\Net\\' => array($vendorDir . '/phrity/net-uri/src', $vendorDir . '/phrity/net-stream/src'), + 'Phrity\\Http\\' => array($vendorDir . '/phrity/http/src'), + 'Phrity\\Comparison\\' => array($vendorDir . '/phrity/comparison/src'), + 'Karriere\\PdfMerge\\' => array($vendorDir . '/karriere/pdf-merge/src'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 4680b7d..8281a73 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -7,18 +7,6 @@ class ComposerStaticInitff8ca5c94912b5ce3ac82b5c9f2b4776 { public static $prefixLengthsPsr4 = array ( - 's' => - array ( - 'setasign\\Fpdi\\' => 14, - ), - 'i' => - array ( - 'iio\\libmergepdf\\' => 16, - ), - 'c' => - array ( - 'cweagans\\Composer\\' => 18, - ), 'W' => array ( 'WebSocket\\' => 10, @@ -26,37 +14,60 @@ class ComposerStaticInitff8ca5c94912b5ce3ac82b5c9f2b4776 'P' => array ( 'Psr\\Log\\' => 8, + 'Psr\\Http\\Message\\' => 17, + 'Phrity\\Util\\' => 12, + 'Phrity\\Net\\' => 11, + 'Phrity\\Http\\' => 12, + 'Phrity\\Comparison\\' => 18, + ), + 'K' => + array ( + 'Karriere\\PdfMerge\\' => 18, ), ); public static $prefixDirsPsr4 = array ( - 'setasign\\Fpdi\\' => + 'WebSocket\\' => array ( - 0 => __DIR__ . '/..' . '/setasign/fpdi/src', + 0 => __DIR__ . '/..' . '/phrity/websocket/src', ), - 'iio\\libmergepdf\\' => + 'Psr\\Log\\' => array ( - 0 => __DIR__ . '/..' . '/iio/libmergepdf/src', + 0 => __DIR__ . '/..' . '/psr/log/src', ), - 'cweagans\\Composer\\' => + 'Psr\\Http\\Message\\' => array ( - 0 => __DIR__ . '/..' . '/cweagans/composer-patches/src', + 0 => __DIR__ . '/..' . '/psr/http-factory/src', + 1 => __DIR__ . '/..' . '/psr/http-message/src', ), - 'WebSocket\\' => + 'Phrity\\Util\\' => array ( - 0 => __DIR__ . '/..' . '/textalk/websocket/lib', + 0 => __DIR__ . '/..' . '/phrity/util-errorhandler/src', ), - 'Psr\\Log\\' => + 'Phrity\\Net\\' => + array ( + 0 => __DIR__ . '/..' . '/phrity/net-uri/src', + 1 => __DIR__ . '/..' . '/phrity/net-stream/src', + ), + 'Phrity\\Http\\' => + array ( + 0 => __DIR__ . '/..' . '/phrity/http/src', + ), + 'Phrity\\Comparison\\' => + array ( + 0 => __DIR__ . '/..' . '/phrity/comparison/src', + ), + 'Karriere\\PdfMerge\\' => array ( - 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', + 0 => __DIR__ . '/..' . '/karriere/pdf-merge/src', ), ); public static $classMap = array ( 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'Datamatrix' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/datamatrix.php', - 'FPDF' => __DIR__ . '/..' . '/iio/libmergepdf/tcpdi/tcpdi.php', - 'FPDF_TPL' => __DIR__ . '/..' . '/iio/libmergepdf/tcpdi/fpdf_tpl.php', + 'FPDF' => __DIR__ . '/..' . '/karriere/pdf-merge/tcpi/tcpdi.php', + 'FPDF_TPL' => __DIR__ . '/..' . '/karriere/pdf-merge/tcpi/fpdf_tpl.php', 'PDF417' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/pdf417.php', 'QRcode' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/barcodes/qrcode.php', 'TCPDF' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf.php', @@ -67,11 +78,9 @@ class ComposerStaticInitff8ca5c94912b5ce3ac82b5c9f2b4776 'TCPDF_FONTS' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_fonts.php', 'TCPDF_FONT_DATA' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_font_data.php', 'TCPDF_IMAGES' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_images.php', - 'TCPDF_IMPORT' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf_import.php', - 'TCPDF_PARSER' => __DIR__ . '/..' . '/tecnickcom/tcpdf/tcpdf_parser.php', 'TCPDF_STATIC' => __DIR__ . '/..' . '/tecnickcom/tcpdf/include/tcpdf_static.php', - 'TCPDI' => __DIR__ . '/..' . '/iio/libmergepdf/tcpdi/tcpdi.php', - 'tcpdi_parser' => __DIR__ . '/..' . '/iio/libmergepdf/tcpdi/tcpdi_parser.php', + 'TCPDI' => __DIR__ . '/..' . '/karriere/pdf-merge/tcpi/tcpdi.php', + 'tcpdi_parser' => __DIR__ . '/..' . '/karriere/pdf-merge/tcpi/tcpdi_parser.php', ); public static function getInitializer(ClassLoader $loader) diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 0790686..6a2cf90 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,147 +1,465 @@ { "packages": [ { - "name": "cweagans/composer-patches", - "version": "1.7.3", - "version_normalized": "1.7.3.0", + "name": "karriere/pdf-merge", + "version": "v3.3.1", + "version_normalized": "3.3.1.0", "source": { "type": "git", - "url": "https://github.com/cweagans/composer-patches.git", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db" + "url": "https://github.com/karriereat/pdf-merge.git", + "reference": "d524a9d261ea96b18bbbab685b5710a7a0fe3a6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/e190d4466fe2b103a55467dfa83fc2fecfcaf2db", - "reference": "e190d4466fe2b103a55467dfa83fc2fecfcaf2db", + "url": "https://api.github.com/repos/karriereat/pdf-merge/zipball/d524a9d261ea96b18bbbab685b5710a7a0fe3a6e", + "reference": "d524a9d261ea96b18bbbab685b5710a7a0fe3a6e", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3.0" + "php": "8.1.* | 8.2.* | 8.3.* | 8.4.*", + "tecnickcom/tcpdf": "^6.3" }, "require-dev": { - "composer/composer": "~1.0 || ~2.0", - "phpunit/phpunit": "~4.6" + "laravel/pint": "^1.5 | ^1.6", + "pestphp/pest": "^1.22", + "phpstan/phpstan": "^1.10" }, - "time": "2022-12-20T22:53:13+00:00", - "type": "composer-plugin", - "extra": { - "class": "cweagans\\Composer\\Patches" + "time": "2025-02-19T11:02:10+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Karriere\\PdfMerge\\": "src/" + }, + "classmap": [ + "tcpi/fpdf_tpl.php", + "tcpi/tcpdi.php", + "tcpi/tcpdi_parser.php" + ] }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Alexander Lentner", + "email": "alexander.lentner@karriere.at", + "role": "Maintainer" + } + ], + "description": "A wrapper for the TCPDF class that provides an elegant API for merging PDFs", + "keywords": [ + "merge", + "pdf" + ], + "support": { + "issues": "https://github.com/karriereat/pdf-merge/issues", + "source": "https://github.com/karriereat/pdf-merge/tree/v3.3.1" + }, + "install-path": "../karriere/pdf-merge" + }, + { + "name": "phrity/comparison", + "version": "1.4.0", + "version_normalized": "1.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sirn-se/phrity-comparison.git", + "reference": "aedd44d59db08de7d6c31812d1490c22aab35c92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirn-se/phrity-comparison/zipball/aedd44d59db08de7d6c31812d1490c22aab35c92", + "reference": "aedd44d59db08de7d6c31812d1490c22aab35c92", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "time": "2025-05-26T20:12:39+00:00", + "type": "library", "installation-source": "dist", "autoload": { "psr-4": { - "cweagans\\Composer\\": "src" + "Phrity\\Comparison\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Cameron Eagans", - "email": "me@cweagans.net" + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" } ], - "description": "Provides a way to patch Composer packages.", + "description": "Interfaces and helper trait for comparing objects. Comparator for sort and filter applications.", + "homepage": "https://phrity.sirn.se/comparison", + "keywords": [ + "comparable", + "comparator", + "comparison", + "equalable", + "filter", + "sort" + ], "support": { - "issues": "https://github.com/cweagans/composer-patches/issues", - "source": "https://github.com/cweagans/composer-patches/tree/1.7.3" + "issues": "https://github.com/sirn-se/phrity-comparison/issues", + "source": "https://github.com/sirn-se/phrity-comparison/tree/1.4.0" }, - "install-path": "../cweagans/composer-patches" + "install-path": "../phrity/comparison" }, { - "name": "iio/libmergepdf", - "version": "4.0.4", - "version_normalized": "4.0.4.0", + "name": "phrity/http", + "version": "1.0.0", + "version_normalized": "1.0.0.0", "source": { "type": "git", - "url": "https://github.com/hanneskod/libmergepdf.git", - "reference": "6613b978c08d00d559796ab510614243e4dd5dfb" + "url": "https://github.com/sirn-se/phrity-http.git", + "reference": "536e3e46e6220d171a59599ed1f4da9f6b6244fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hanneskod/libmergepdf/zipball/6613b978c08d00d559796ab510614243e4dd5dfb", - "reference": "6613b978c08d00d559796ab510614243e4dd5dfb", + "url": "https://api.github.com/repos/sirn-se/phrity-http/zipball/536e3e46e6220d171a59599ed1f4da9f6b6244fc", + "reference": "536e3e46e6220d171a59599ed1f4da9f6b6244fc", "shasum": "" }, "require": { - "php": "^7.1||^8.0", - "setasign/fpdi": "^2", - "tecnickcom/tcpdf": "^6.2.22" + "php": "^8.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 | ^2.0" }, - "conflict": { - "rafikhaceb/tcpdi": "*", - "setasign/fpdf": "*" + "require-dev": { + "guzzlehttp/psr7": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "robiningelbrecht/phpunit-coverage-tools": "^1.9", + "squizlabs/php_codesniffer": "^3.5" + }, + "time": "2025-09-07T17:04:26+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Phrity\\Http\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "description": "Utilities and interfaces for handling HTTP.", + "homepage": "https://phrity.sirn.se/http", + "keywords": [ + "HTTP Factories", + "http", + "psr-17" + ], + "support": { + "issues": "https://github.com/sirn-se/phrity-http/issues", + "source": "https://github.com/sirn-se/phrity-http/tree/1.0.0" + }, + "install-path": "../phrity/http" + }, + { + "name": "phrity/net-stream", + "version": "2.3.1", + "version_normalized": "2.3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sirn-se/phrity-net-stream.git", + "reference": "c621bb3108a5a02bba64df2e5f0cd7ada02665b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirn-se/phrity-net-stream/zipball/c621bb3108a5a02bba64df2e5f0cd7ada02665b5", + "reference": "c621bb3108a5a02bba64df2e5f0cd7ada02665b5", + "shasum": "" + }, + "require": { + "php": "^8.1", + "phrity/util-errorhandler": "^1.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 | ^2.0" }, "require-dev": { - "phpunit/phpunit": "^7|^8", - "smalot/pdfparser": "~0.13" + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "phrity/net-uri": "^2.0", + "squizlabs/php_codesniffer": "^3.5" }, - "time": "2020-12-07T12:18:49+00:00", + "time": "2025-08-08T09:51:04+00:00", "type": "library", - "extra": { - "patches_applied": { - "Add PHP 8.2 support": "patches/iio-libmergepdf-support-php82.patch" + "installation-source": "dist", + "autoload": { + "psr-4": { + "Phrity\\Net\\": "src/" } }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "description": "Socket stream classes implementing PSR-7 Stream and PSR-17 StreamFactory", + "homepage": "https://phrity.sirn.se/net-stream", + "keywords": [ + "Socket", + "client", + "psr-17", + "psr-7", + "server", + "stream", + "stream factory" + ], + "support": { + "issues": "https://github.com/sirn-se/phrity-net-stream/issues", + "source": "https://github.com/sirn-se/phrity-net-stream/tree/2.3.1" + }, + "install-path": "../phrity/net-stream" + }, + { + "name": "phrity/net-uri", + "version": "2.2.0", + "version_normalized": "2.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sirn-se/phrity-net-uri.git", + "reference": "08de4cf07e439c4708f572249659f09198ac99f0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirn-se/phrity-net-uri/zipball/08de4cf07e439c4708f572249659f09198ac99f0", + "reference": "08de4cf07e439c4708f572249659f09198ac99f0", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^8.1", + "phrity/comparison": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 | ^2.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "phrity/util-errorhandler": "^1.1", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggest": { + "ext-intl": "Enables IDN conversion for non-ASCII domains" + }, + "time": "2025-05-25T13:05:13+00:00", + "type": "library", "installation-source": "dist", "autoload": { "psr-4": { - "iio\\libmergepdf\\": "src/" - }, - "classmap": [ - "tcpdi/" - ] + "Phrity\\Net\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "WTFPL" + "MIT" ], "authors": [ { - "name": "Hannes Forsgård", - "email": "hannes.forsgard@fripost.org" + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" } ], - "description": "Library for merging multiple PDFs", - "homepage": "https://github.com/hanneskod/libmergepdf", + "description": "PSR-7 Uri and PSR-17 UriFactory implementation", + "homepage": "https://phrity.sirn.se/net-uri", "keywords": [ - "merge", - "pdf" + "psr-17", + "psr-7", + "uri", + "uri factory" ], - "install-path": "../iio/libmergepdf" + "support": { + "issues": "https://github.com/sirn-se/phrity-net-uri/issues", + "source": "https://github.com/sirn-se/phrity-net-uri/tree/2.2.0" + }, + "install-path": "../phrity/net-uri" }, { - "name": "psr/log", - "version": "1.1.4", - "version_normalized": "1.1.4.0", + "name": "phrity/util-errorhandler", + "version": "1.2.1", + "version_normalized": "1.2.1.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "url": "https://github.com/sirn-se/phrity-util-errorhandler.git", + "reference": "9825f15ef9b4a93252ce53ca8962278832d834da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/sirn-se/phrity-util-errorhandler/zipball/9825f15ef9b4a93252ce53ca8962278832d834da", + "reference": "9825f15ef9b4a93252ce53ca8962278832d834da", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^8.1" }, - "time": "2021-05-03T11:20:27+00:00", + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "time": "2025-08-08T09:48:45+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Phrity\\Util\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "description": "Inline error handler; catch and resolve errors for code block.", + "homepage": "https://phrity.sirn.se/util-errorhandler", + "keywords": [ + "error", + "warning" + ], + "support": { + "issues": "https://github.com/sirn-se/phrity-util-errorhandler/issues", + "source": "https://github.com/sirn-se/phrity-util-errorhandler/tree/1.2.1" + }, + "install-path": "../phrity/util-errorhandler" + }, + { + "name": "phrity/websocket", + "version": "3.6.0", + "version_normalized": "3.6.0.0", + "source": { + "type": "git", + "url": "https://github.com/sirn-se/websocket-php.git", + "reference": "3f16b2564a230bbce716cccaff2f6156a60a8798" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sirn-se/websocket-php/zipball/3f16b2564a230bbce716cccaff2f6156a60a8798", + "reference": "3f16b2564a230bbce716cccaff2f6156a60a8798", + "shasum": "" + }, + "require": { + "php": "^8.1", + "phrity/http": "^1.0", + "phrity/net-stream": "^2.3", + "phrity/net-uri": "^2.1", + "psr/http-message": "^1.1 | ^2.0", + "psr/log": "^1.0 | ^2.0 | ^3.0" + }, + "require-dev": { + "guzzlehttp/psr7": "^2.0", + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "phrity/logger-console": "^1.0", + "phrity/net-mock": "^2.3", + "phrity/util-errorhandler": "^1.1", + "robiningelbrecht/phpunit-coverage-tools": "^1.9", + "squizlabs/php_codesniffer": "^3.5" + }, + "time": "2025-09-08T16:21:41+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "WebSocket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Fredrik Liljegren" + }, + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "description": "WebSocket client and server", + "homepage": "https://phrity.sirn.se/websocket", + "keywords": [ + "client", + "server", + "websocket" + ], + "support": { + "issues": "https://github.com/sirn-se/websocket-php/issues", + "source": "https://github.com/sirn-se/websocket-php/tree/3.6.0" + }, + "install-path": "../phrity/websocket" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "time": "2024-04-15T12:06:14+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.0.x-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -154,53 +472,51 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", "keywords": [ - "log", + "factory", + "http", + "message", "psr", - "psr-3" + "psr-17", + "psr-7", + "request", + "response" ], - "install-path": "../psr/log" + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "install-path": "../psr/http-factory" }, { - "name": "setasign/fpdi", - "version": "v2.6.0", - "version_normalized": "2.6.0.0", + "name": "psr/http-message", + "version": "2.0", + "version_normalized": "2.0.0.0", "source": { "type": "git", - "url": "https://github.com/Setasign/FPDI.git", - "reference": "a6db878129ec6c7e141316ee71872923e7f1b7ad" + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6db878129ec6c7e141316ee71872923e7f1b7ad", - "reference": "a6db878129ec6c7e141316ee71872923e7f1b7ad", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { - "ext-zlib": "*", - "php": "^5.6 || ^7.0 || ^8.0" - }, - "conflict": { - "setasign/tfpdf": "<1.31" + "php": "^7.2 || ^8.0" }, - "require-dev": { - "phpunit/phpunit": "~5.7", - "setasign/fpdf": "~1.8.6", - "setasign/tfpdf": "~1.33", - "squizlabs/php_codesniffer": "^3.5", - "tecnickcom/tcpdf": "~6.2" - }, - "suggest": { - "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured." - }, - "time": "2023-12-11T16:03:32+00:00", + "time": "2023-04-04T09:54:51+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "installation-source": "dist", "autoload": { "psr-4": { - "setasign\\Fpdi\\": "src/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -209,54 +525,98 @@ ], "authors": [ { - "name": "Jan Slabon", - "email": "jan.slabon@setasign.com", - "homepage": "https://www.setasign.com" - }, - { - "name": "Maximilian Kresse", - "email": "maximilian.kresse@setasign.com", - "homepage": "https://www.setasign.com" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.", - "homepage": "https://www.setasign.com/fpdi", + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", "keywords": [ - "fpdf", - "fpdi", - "pdf" + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" ], "support": { - "issues": "https://github.com/Setasign/FPDI/issues", - "source": "https://github.com/Setasign/FPDI/tree/v2.6.0" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "funding": [ + "install-path": "../psr/http-message" + }, + { + "name": "psr/log", + "version": "3.0.2", + "version_normalized": "3.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "time": "2024-09-11T13:17:53+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ { - "url": "https://tidelift.com/funding/github/packagist/setasign/fpdi", - "type": "tidelift" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "install-path": "../setasign/fpdi" + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "install-path": "../psr/log" }, { "name": "tecnickcom/tcpdf", - "version": "6.7.5", - "version_normalized": "6.7.5.0", + "version": "6.10.0", + "version_normalized": "6.10.0.0", "source": { "type": "git", "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36" + "reference": "ca5b6de294512145db96bcbc94e61696599c391d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/951eabf0338ec2522bd0d5d9c79b08a3a3d36b36", - "reference": "951eabf0338ec2522bd0d5d9c79b08a3a3d36b36", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/ca5b6de294512145db96bcbc94e61696599c391d", + "reference": "ca5b6de294512145db96bcbc94e61696599c391d", "shasum": "" }, "require": { - "php": ">=5.5.0" + "ext-curl": "*", + "php": ">=7.1.0" }, - "time": "2024-04-20T17:25:10+00:00", + "time": "2025-05-27T18:02:28+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -264,8 +624,6 @@ "config", "include", "tcpdf.php", - "tcpdf_parser.php", - "tcpdf_import.php", "tcpdf_barcodes_1d.php", "tcpdf_barcodes_2d.php", "include/tcpdf_colors.php", @@ -303,67 +661,15 @@ ], "support": { "issues": "https://github.com/tecnickcom/TCPDF/issues", - "source": "https://github.com/tecnickcom/TCPDF/tree/6.7.5" + "source": "https://github.com/tecnickcom/TCPDF/tree/6.10.0" }, "funding": [ { - "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project", + "url": "https://www.paypal.com/donate/?hosted_button_id=NZUEC5XS8MFBJ", "type": "custom" } ], "install-path": "../tecnickcom/tcpdf" - }, - { - "name": "textalk/websocket", - "version": "1.5.8", - "version_normalized": "1.5.8.0", - "source": { - "type": "git", - "url": "https://github.com/Textalk/websocket-php.git", - "reference": "d05dbaa97500176447ffb1f1800573f23085ab13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Textalk/websocket-php/zipball/d05dbaa97500176447ffb1f1800573f23085ab13", - "reference": "d05dbaa97500176447ffb1f1800573f23085ab13", - "shasum": "" - }, - "require": { - "php": "^7.2 | ^8.0", - "psr/log": "^1 | ^2 | ^3" - }, - "require-dev": { - "php-coveralls/php-coveralls": "^2.0", - "phpunit/phpunit": "^8.0|^9.0", - "squizlabs/php_codesniffer": "^3.5" - }, - "time": "2022-04-26T06:28:24+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "WebSocket\\": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Fredrik Liljegren" - }, - { - "name": "Sören Jensen", - "email": "soren@abicart.se" - } - ], - "description": "WebSocket client and server", - "support": { - "issues": "https://github.com/Textalk/websocket-php/issues", - "source": "https://github.com/Textalk/websocket-php/tree/1.5.8" - }, - "install-path": "../textalk/websocket" } ], "dev": true, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 4a2afd8..88f772f 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -19,57 +19,102 @@ 'aliases' => array(), 'dev_requirement' => false, ), - 'cweagans/composer-patches' => array( - 'pretty_version' => '1.7.3', - 'version' => '1.7.3.0', - 'reference' => 'e190d4466fe2b103a55467dfa83fc2fecfcaf2db', - 'type' => 'composer-plugin', - 'install_path' => __DIR__ . '/../cweagans/composer-patches', + 'karriere/pdf-merge' => array( + 'pretty_version' => 'v3.3.1', + 'version' => '3.3.1.0', + 'reference' => 'd524a9d261ea96b18bbbab685b5710a7a0fe3a6e', + 'type' => 'library', + 'install_path' => __DIR__ . '/../karriere/pdf-merge', 'aliases' => array(), 'dev_requirement' => false, ), - 'iio/libmergepdf' => array( - 'pretty_version' => '4.0.4', - 'version' => '4.0.4.0', - 'reference' => '6613b978c08d00d559796ab510614243e4dd5dfb', + 'phrity/comparison' => array( + 'pretty_version' => '1.4.0', + 'version' => '1.4.0.0', + 'reference' => 'aedd44d59db08de7d6c31812d1490c22aab35c92', 'type' => 'library', - 'install_path' => __DIR__ . '/../iio/libmergepdf', + 'install_path' => __DIR__ . '/../phrity/comparison', 'aliases' => array(), 'dev_requirement' => false, ), - 'psr/log' => array( - 'pretty_version' => '1.1.4', - 'version' => '1.1.4.0', - 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', + 'phrity/http' => array( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'reference' => '536e3e46e6220d171a59599ed1f4da9f6b6244fc', 'type' => 'library', - 'install_path' => __DIR__ . '/../psr/log', + 'install_path' => __DIR__ . '/../phrity/http', 'aliases' => array(), 'dev_requirement' => false, ), - 'setasign/fpdi' => array( - 'pretty_version' => 'v2.6.0', - 'version' => '2.6.0.0', - 'reference' => 'a6db878129ec6c7e141316ee71872923e7f1b7ad', + 'phrity/net-stream' => array( + 'pretty_version' => '2.3.1', + 'version' => '2.3.1.0', + 'reference' => 'c621bb3108a5a02bba64df2e5f0cd7ada02665b5', 'type' => 'library', - 'install_path' => __DIR__ . '/../setasign/fpdi', + 'install_path' => __DIR__ . '/../phrity/net-stream', 'aliases' => array(), 'dev_requirement' => false, ), - 'tecnickcom/tcpdf' => array( - 'pretty_version' => '6.7.5', - 'version' => '6.7.5.0', - 'reference' => '951eabf0338ec2522bd0d5d9c79b08a3a3d36b36', + 'phrity/net-uri' => array( + 'pretty_version' => '2.2.0', + 'version' => '2.2.0.0', + 'reference' => '08de4cf07e439c4708f572249659f09198ac99f0', 'type' => 'library', - 'install_path' => __DIR__ . '/../tecnickcom/tcpdf', + 'install_path' => __DIR__ . '/../phrity/net-uri', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'phrity/util-errorhandler' => array( + 'pretty_version' => '1.2.1', + 'version' => '1.2.1.0', + 'reference' => '9825f15ef9b4a93252ce53ca8962278832d834da', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phrity/util-errorhandler', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'phrity/websocket' => array( + 'pretty_version' => '3.6.0', + 'version' => '3.6.0.0', + 'reference' => '3f16b2564a230bbce716cccaff2f6156a60a8798', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phrity/websocket', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-factory' => array( + 'pretty_version' => '1.1.0', + 'version' => '1.1.0.0', + 'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/http-factory', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-message' => array( + 'pretty_version' => '2.0', + 'version' => '2.0.0.0', + 'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/http-message', 'aliases' => array(), 'dev_requirement' => false, ), - 'textalk/websocket' => array( - 'pretty_version' => '1.5.8', - 'version' => '1.5.8.0', - 'reference' => 'd05dbaa97500176447ffb1f1800573f23085ab13', + 'psr/log' => array( + 'pretty_version' => '3.0.2', + 'version' => '3.0.2.0', + 'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3', 'type' => 'library', - 'install_path' => __DIR__ . '/../textalk/websocket', + 'install_path' => __DIR__ . '/../psr/log', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'tecnickcom/tcpdf' => array( + 'pretty_version' => '6.10.0', + 'version' => '6.10.0.0', + 'reference' => 'ca5b6de294512145db96bcbc94e61696599c391d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../tecnickcom/tcpdf', 'aliases' => array(), 'dev_requirement' => false, ), diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index 589e9e7..14bf88d 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -4,8 +4,8 @@ $issues = array(); -if (!(PHP_VERSION_ID >= 70200)) { - $issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.0". You are running ' . PHP_VERSION . '.'; +if (!(PHP_VERSION_ID >= 80200)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 8.2.0". You are running ' . PHP_VERSION . '.'; } if ($issues) { @@ -19,8 +19,7 @@ echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; } } - trigger_error( - 'Composer detected issues in your platform: ' . implode(' ', $issues), - E_USER_ERROR + throw new \RuntimeException( + 'Composer detected issues in your platform: ' . implode(' ', $issues) ); } diff --git a/vendor/cweagans/composer-patches/.gitignore b/vendor/cweagans/composer-patches/.gitignore deleted file mode 100644 index 48b8bf9..0000000 --- a/vendor/cweagans/composer-patches/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vendor/ diff --git a/vendor/cweagans/composer-patches/LICENSE.md b/vendor/cweagans/composer-patches/LICENSE.md deleted file mode 100644 index d0dad3d..0000000 --- a/vendor/cweagans/composer-patches/LICENSE.md +++ /dev/null @@ -1,9 +0,0 @@ -Copyright 2013 Cameron Eagans - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/cweagans/composer-patches/README.md b/vendor/cweagans/composer-patches/README.md deleted file mode 100644 index 87f9dc0..0000000 --- a/vendor/cweagans/composer-patches/README.md +++ /dev/null @@ -1,205 +0,0 @@ -# composer-patches - -Simple patches plugin for Composer. Applies a patch from a local or remote file to any package required with composer. - -Note that the 1.x versions of Composer Patches are supported on a best-effort -basis due to the imminent release of 2.0.0. You may still be interested in -using 1.x if you need Composer to cooperate with earlier PHP versions. No new -features will be added to 1.x releases, but any security or bug fixes will -still be accepted. - -## Usage - -Example composer.json: - -```json -{ - "require": { - "cweagans/composer-patches": "~1.0", - "drupal/drupal": "~8.2" - }, - "config": { - "preferred-install": "source" - }, - "extra": { - "patches": { - "drupal/drupal": { - "Add startup configuration for PHP server": "https://www.drupal.org/files/issues/add_a_startup-1543858-30.patch" - } - } - } -} - -``` - -## Using an external patch file - -Instead of a patches key in your root composer.json, use a patches-file key. - -```json -{ - "require": { - "cweagans/composer-patches": "~1.0", - "drupal/drupal": "~8.2" - }, - "config": { - "preferred-install": "source" - }, - "extra": { - "patches-file": "local/path/to/your/composer.patches.json" - } -} - -``` - -Then your `composer.patches.json` should look like this: - -``` -{ - "patches": { - "vendor/project": { - "Patch title": "http://example.com/url/to/patch.patch" - } - } -} -``` - -## Allowing patches to be applied from dependencies - -If your project doesn't supply any patches of its own, but you still want to accept patches from dependencies, you must have the following in your composer file: - -```json -{ - "require": { - "cweagans/composer-patches": "^1.5.0" - }, - "extra": { - "enable-patching": true - } -} -``` - -If you do have a `patches` section in your composer file that defines your own set of patches then the `enable-patching` setting will be ignored and patches from dependencies will always be applied. - -## Ignoring patches - -There may be situations in which you want to ignore a patch supplied by a dependency. For example: - -- You use a different more recent version of a dependency, and now a patch isn't applying. -- You have a more up to date patch than the dependency, and want to use yours instead of theirs. -- A dependency's patch adds a feature to a project that you don't need. -- Your patches conflict with a dependency's patches. - -```json -{ - "require": { - "cweagans/composer-patches": "~1.0", - "drupal/drupal": "~8.2", - "drupal/lightning": "~8.1" - }, - "config": { - "preferred-install": "source" - }, - "extra": { - "patches": { - "drupal/drupal": { - "Add startup configuration for PHP server": "https://www.drupal.org/files/issues/add_a_startup-1543858-30.patch" - } - }, - "patches-ignore": { - "drupal/lightning": { - "drupal/panelizer": { - "This patch has known conflicts with our Quick Edit integration": "https://www.drupal.org/files/issues/2664682-49.patch" - } - } - } - } -} -``` - -## Allowing to force the patch level (-pX) - -Some situations require to force the patchLevel used to apply patches on a particular package. -Its useful for packages like drupal/core which packages only a subdir of the original upstream project on which patches are based. - -```json -{ - "extra": { - "patchLevel": { - "drupal/core": "-p2" - } - } -} -``` - -## Using patches from HTTP URLs - -Composer [blocks](https://getcomposer.org/doc/06-config.md#secure-http) you from downloading anything from HTTP URLs, you can disable this for your project by adding a `secure-http` setting in the config section of your `composer.json`. Note that the `config` section should be under the root of your `composer.json`. - -```json -{ - "config": { - "secure-http": false - } -} -``` - -However, it's always advised to setup HTTPS to prevent MITM code injection. - -## Patches containing modifications to composer.json files - -Because patching occurs _after_ Composer calculates dependencies and installs packages, changes to an underlying dependency's `composer.json` file introduced in a patch will have _no effect_ on installed packages. - -If you need to modify a dependency's `composer.json` or its underlying dependencies, you cannot use this plugin. Instead, you must do one of the following: -- Work to get the underlying issue resolved in the upstream package. -- Fork the package and [specify your fork as the package repository](https://getcomposer.org/doc/05-repositories.md#vcs) in your root `composer.json` -- Specify compatible package version requirements in your root `composer.json` - -## Error handling - -If a patch cannot be applied (hunk failed, different line endings, etc.) a message will be shown and the patch will be skipped. - -To enforce throwing an error and stopping package installation/update immediately, you have two available options: - -1. Add `"composer-exit-on-patch-failure": true` option to the `extra` section of your composer.json file. -1. Export `COMPOSER_EXIT_ON_PATCH_FAILURE=1` - -By default, failed patches are skipped. - -## Patches reporting - -When a patch is applied, the plugin writes a report-file `PATCHES.txt` to a patching directory (e.g. `./patch-me/PATCHES.txt`), -which contains a list of applied patches. - -If you want to avoid this behavior, add a specific key to the `extra` section: -```json -"extra": { - "composer-patches-skip-reporting": true -} -``` - -Or provide an environment variable `COMPOSER_PATCHES_SKIP_REPORTING` with a config. - -## Patching composer.json in dependencies - -This doesn't work like you'd want. By the time you're running `composer install`, -the metadata from your dependencies' composer.json has already been aggregated by -packagist (or whatever metadata repo you're using). Unfortunately, this means that -you cannot e.g. patch a dependency to be compatible with an earlier version of PHP -or change the framework version that a plugin depends on. - -@anotherjames over at @computerminds wrote an article about how to work around -that particular problem for a Drupal 8 -> Drupal 9 upgrade: - -[Apply Drupal 9 compatibility patches with Composer](https://www.computerminds.co.uk/articles/apply-drupal-9-compatibility-patches-composer) ([archive](https://web.archive.org/web/20210124171010/https://www.computerminds.co.uk/articles/apply-drupal-9-compatibility-patches-composer)) - -## Difference between this and netresearch/composer-patches-plugin - -- This plugin is much more simple to use and maintain -- This plugin doesn't require you to specify which package version you're patching -- This plugin is easy to use with Drupal modules (which don't use semantic versioning). -- This plugin will gather patches from all dependencies and apply them as if they were in the root composer.json - -## Credits - -A ton of this code is adapted or taken straight from https://github.com/jpstacey/composer-patcher, which is abandoned in favor of https://github.com/netresearch/composer-patches-plugin, which is (IMHO) overly complex and difficult to use. diff --git a/vendor/cweagans/composer-patches/composer.json b/vendor/cweagans/composer-patches/composer.json deleted file mode 100644 index 1565b02..0000000 --- a/vendor/cweagans/composer-patches/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "cweagans/composer-patches", - "description": "Provides a way to patch Composer packages.", - "minimum-stability": "dev", - "license": "BSD-3-Clause", - "type": "composer-plugin", - "extra": { - "class": "cweagans\\Composer\\Patches" - }, - "authors": [ - { - "name": "Cameron Eagans", - "email": "me@cweagans.net" - } - ], - "require": { - "php": ">=5.3.0", - "composer-plugin-api": "^1.0 || ^2.0" - }, - "require-dev": { - "composer/composer": "~1.0 || ~2.0", - "phpunit/phpunit": "~4.6" - }, - "autoload": { - "psr-4": {"cweagans\\Composer\\": "src"} - }, - "autoload-dev": { - "psr-4": {"cweagans\\Composer\\Tests\\": "tests"} - } -} diff --git a/vendor/cweagans/composer-patches/composer.lock b/vendor/cweagans/composer-patches/composer.lock deleted file mode 100644 index d5fe177..0000000 --- a/vendor/cweagans/composer-patches/composer.lock +++ /dev/null @@ -1,2568 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "4a5c841252204815536a37cad51d347b", - "packages": [], - "packages-dev": [ - { - "name": "composer/ca-bundle", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/ca-bundle.git", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/95c63ab2117a72f48f5a55da9740a3273d45b7fd", - "reference": "95c63ab2117a72f48f5a55da9740a3273d45b7fd", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "ext-pcre": "*", - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", - "psr/log": "^1.0", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\CaBundle\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", - "keywords": [ - "cabundle", - "cacert", - "certificate", - "ssl", - "tls" - ], - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2020-04-08T08:27:21+00:00" - }, - { - "name": "composer/composer", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/composer.git", - "reference": "870fdc59dfcffe0bd2d43ca2de4235761d0dec7a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/870fdc59dfcffe0bd2d43ca2de4235761d0dec7a", - "reference": "870fdc59dfcffe0bd2d43ca2de4235761d0dec7a", - "shasum": "" - }, - "require": { - "composer/ca-bundle": "^1.0", - "composer/semver": "^3.0", - "composer/spdx-licenses": "^1.2", - "composer/xdebug-handler": "^1.1", - "justinrainbow/json-schema": "^5.2.10", - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0", - "react/promise": "^1.2 || ^2.7", - "seld/jsonlint": "^1.4", - "seld/phar-utils": "^1.0", - "symfony/console": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", - "symfony/filesystem": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", - "symfony/finder": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0", - "symfony/process": "^2.8.52 || ^3.4.35 || ^4.4 || ^5.0" - }, - "require-dev": { - "phpspec/prophecy": "^1.10", - "symfony/phpunit-bridge": "^4.2 || ^5.0" - }, - "suggest": { - "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", - "ext-zip": "Enabling the zip extension allows you to unzip archives", - "ext-zlib": "Allow gzip compression of HTTP requests" - }, - "bin": [ - "bin/composer" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\": "src/Composer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "https://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "https://seld.be" - } - ], - "description": "Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.", - "homepage": "https://getcomposer.org/", - "keywords": [ - "autoload", - "dependency", - "package" - ], - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2020-07-15T15:02:16+00:00" - }, - { - "name": "composer/semver", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "00915994bb1de62e750ae279669c9c5a57379957" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/00915994bb1de62e750ae279669c9c5a57379957", - "reference": "00915994bb1de62e750ae279669c9c5a57379957", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.19", - "symfony/phpunit-bridge": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2020-05-31T11:44:06+00:00" - }, - { - "name": "composer/spdx-licenses", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/composer/spdx-licenses.git", - "reference": "6946f785871e2314c60b4524851f3702ea4f2223" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/6946f785871e2314c60b4524851f3702ea4f2223", - "reference": "6946f785871e2314c60b4524851f3702ea4f2223", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Spdx\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "SPDX licenses list and validation library.", - "keywords": [ - "license", - "spdx", - "validator" - ], - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2020-07-15T15:35:07+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", - "reference": "fa2aaf99e2087f013a14f7432c1cd2dd7d8f1f51", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2020-06-04T11:16:35+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14T21:17:01+00:00" - }, - { - "name": "justinrainbow/json-schema", - "version": "5.x-dev", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", - "reference": "2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20||~2.15.1", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.35" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "time": "2020-05-27T16:41:55+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "time": "2015-02-03T12:10:50+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4f9b1eaf0a7da77c362f8d91cbc68ab1f4718d62" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4f9b1eaf0a7da77c362f8d91cbc68ab1f4718d62", - "reference": "4f9b1eaf0a7da77c362f8d91cbc68ab1f4718d62", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1" - }, - "require-dev": { - "phpspec/phpspec": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.5.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "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": "2015-09-22T14:49:23+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.x-dev", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "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": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2015-10-06T15:47:00+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2015-06-21T13:08:43+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2015-06-21T08:01:12+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "cab6c6fefee93d7b7c3a01292a0fe0884ea66644" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/cab6c6fefee93d7b7c3a01292a0fe0884ea66644", - "reference": "cab6c6fefee93d7b7c3a01292a0fe0884ea66644", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2015-09-23T14:46:55+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.x-dev", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "be067d6105286b74272facefc2697038f8807b77" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/264188ddf4d3586c80ea615f8ec8eaea34e652a1", - "reference": "be067d6105286b74272facefc2697038f8807b77", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2015-10-14T13:49:40+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.x-dev", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "abandoned": true, - "time": "2015-10-02T06:51:40+00:00" - }, - { - "name": "psr/container", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/fc1bc363ecf887921e3897c7b1dad3587ae154eb", - "reference": "fc1bc363ecf887921e3897c7b1dad3587ae154eb", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2019-10-04T14:07:35+00:00" - }, - { - "name": "psr/log", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2020-03-23T09:12:05+00:00" - }, - { - "name": "react/promise", - "version": "2.x-dev", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4", - "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com" - } - ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "keywords": [ - "promise", - "promises" - ], - "time": "2020-05-12T15:16:56+00:00" - }, - { - "name": "sebastian/comparator", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2015-07-26T15:48:44+00:00" - }, - { - "name": "sebastian/diff", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6899b3e33bfbd386d88b5eea5f65f563e8793051", - "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2015-06-22T14:15:55+00:00" - }, - { - "name": "sebastian/environment", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/dc7a29032cf72b54f36dac15a1ca5b3a1b6029bf", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2015-08-03T06:14:51+00:00" - }, - { - "name": "sebastian/exporter", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "f88f8936517d54ae6d589166810877fb2015d0a2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f88f8936517d54ae6d589166810877fb2015d0a2", - "reference": "f88f8936517d54ae6d589166810877fb2015d0a2", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2015-08-09T04:23:41+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.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": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "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": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-06-21T08:04:50+00:00" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21T13:59:46+00:00" - }, - { - "name": "seld/jsonlint", - "version": "1.8.0", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "ff2aa5420bfbc296cf6a0bc785fa5b35736de7c1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/ff2aa5420bfbc296cf6a0bc785fa5b35736de7c1", - "reference": "ff2aa5420bfbc296cf6a0bc785fa5b35736de7c1", - "shasum": "" - }, - "require": { - "php": "^5.3 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "bin": [ - "bin/jsonlint" - ], - "type": "library", - "autoload": { - "psr-4": { - "Seld\\JsonLint\\": "src/Seld/JsonLint/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "JSON Linter", - "keywords": [ - "json", - "linter", - "parser", - "validator" - ], - "funding": [ - { - "url": "https://github.com/Seldaek", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/seld/jsonlint", - "type": "tidelift" - } - ], - "time": "2020-04-30T19:05:18+00:00" - }, - { - "name": "seld/phar-utils", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8674b1d84ffb47cc59a101f5d5a3b61e87d23796", - "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Seld\\PharUtils\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "PHAR file format utilities, for when PHP phars you up", - "keywords": [ - "phar" - ], - "time": "2020-07-07T18:42:57+00:00" - }, - { - "name": "symfony/console", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "e4a70bd8c5a4382630197b7b87910b3fc0e6b526" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/e4a70bd8c5a4382630197b7b87910b3fc0e6b526", - "reference": "e4a70bd8c5a4382630197b7b87910b3fc0e6b526", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.15", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" - }, - "conflict": { - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command line", - "console", - "terminal" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-06T13:25:45+00:00" - }, - { - "name": "symfony/filesystem", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "e7550993849f986f01a9161b302d4aed8d4aab0a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e7550993849f986f01a9161b302d4aed8d4aab0a", - "reference": "e7550993849f986f01a9161b302d4aed8d4aab0a", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-05-30T20:38:10+00:00" - }, - { - "name": "symfony/finder", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "2a63a45741144325f84d28ea1e67bc1b669b1748" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/2a63a45741144325f84d28ea1e67bc1b669b1748", - "reference": "2a63a45741144325f84d28ea1e67bc1b669b1748", - "shasum": "" - }, - "require": { - "php": ">=7.2.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-05-20T17:44:07+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", - "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "b740103edbdcc39602239ee8860f0f45a8eb9aa5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b740103edbdcc39602239ee8860f0f45a8eb9aa5", - "reference": "b740103edbdcc39602239ee8860f0f45a8eb9aa5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, - "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 for intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", - "reference": "37078a8dd4a2a1e9ab0231af7c6cb671b2ed5a7e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "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 for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a", - "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "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 for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fffa1a52a023e782cdcc221d781fe1ec8f87fcca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fffa1a52a023e782cdcc221d781fe1ec8f87fcca", - "reference": "fffa1a52a023e782cdcc221d781fe1ec8f87fcca", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "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.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981", - "shasum": "" - }, - "require": { - "php": ">=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, - { - "name": "symfony/process", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "d158a452d952049e0e55b7cfe5f360c973edc57c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d158a452d952049e0e55b7cfe5f360c973edc57c", - "reference": "d158a452d952049e0e55b7cfe5f360c973edc57c", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-06T13:25:45+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "58c7475e5457c5492c26cc740cc0ad7464be9442" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/58c7475e5457c5492c26cc740cc0ad7464be9442", - "reference": "58c7475e5457c5492c26cc740cc0ad7464be9442", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/container": "^1.0" - }, - "suggest": { - "symfony/service-implementation": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" - } - }, - "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": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", - "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-06T13:23:11+00:00" - }, - { - "name": "symfony/string", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "b7914561c03f8d78f83eec3ec4502adbdc343c48" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/b7914561c03f8d78f83eec3ec4502adbdc343c48", - "reference": "b7914561c03f8d78f83eec3ec4502adbdc343c48", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.0", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" - }, - "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, - "files": [ - "Resources/functions.php" - ], - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "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 String component", - "homepage": "https://symfony.com", - "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-08T08:28:10+00:00" - }, - { - "name": "symfony/yaml", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "8d32eb597b531eb915b4fee3dc582ade5ae1fe6a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/ab0314f7544d600ea7917f02cdad774358b81113", - "reference": "8d32eb597b531eb915b4fee3dc582ade5ae1fe6a", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2015-10-13T16:01:35+00:00" - } - ], - "aliases": [], - "minimum-stability": "dev", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.3.0", - "composer-plugin-api": "^1.0 || ^2.0" - }, - "platform-dev": [], - "plugin-api-version": "1.1.0" -} diff --git a/vendor/cweagans/composer-patches/phpunit.xml.dist b/vendor/cweagans/composer-patches/phpunit.xml.dist deleted file mode 100644 index 62409b3..0000000 --- a/vendor/cweagans/composer-patches/phpunit.xml.dist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - ./tests/ - - - - - - src/ - - - vendor/ - - - diff --git a/vendor/cweagans/composer-patches/src/PatchEvent.php b/vendor/cweagans/composer-patches/src/PatchEvent.php deleted file mode 100644 index 31d36f8..0000000 --- a/vendor/cweagans/composer-patches/src/PatchEvent.php +++ /dev/null @@ -1,70 +0,0 @@ -package = $package; - $this->url = $url; - $this->description = $description; - } - - /** - * Returns the package that is patched. - * - * @return PackageInterface - */ - public function getPackage() { - return $this->package; - } - - /** - * Returns the url of the patch. - * - * @return string - */ - public function getUrl() { - return $this->url; - } - - /** - * Returns the description of the patch. - * - * @return string - */ - public function getDescription() { - return $this->description; - } - -} diff --git a/vendor/cweagans/composer-patches/src/PatchEvents.php b/vendor/cweagans/composer-patches/src/PatchEvents.php deleted file mode 100644 index ecee947..0000000 --- a/vendor/cweagans/composer-patches/src/PatchEvents.php +++ /dev/null @@ -1,30 +0,0 @@ -composer = $composer; - $this->io = $io; - $this->eventDispatcher = $composer->getEventDispatcher(); - $this->executor = new ProcessExecutor($this->io); - $this->patches = array(); - $this->installedPatches = array(); - } - - /** - * Returns an array of event names this subscriber wants to listen to. - */ - public static function getSubscribedEvents() { - return array( - ScriptEvents::PRE_INSTALL_CMD => array('checkPatches'), - ScriptEvents::PRE_UPDATE_CMD => array('checkPatches'), - PackageEvents::PRE_PACKAGE_INSTALL => array('gatherPatches'), - PackageEvents::PRE_PACKAGE_UPDATE => array('gatherPatches'), - // The following is a higher weight for compatibility with - // https://github.com/AydinHassan/magento-core-composer-installer and more generally for compatibility with - // every Composer plugin which deploys downloaded packages to other locations. - // In such cases you want that those plugins deploy patched files so they have to run after - // the "composer-patches" plugin. - // @see: https://github.com/cweagans/composer-patches/pull/153 - PackageEvents::POST_PACKAGE_INSTALL => array('postInstall', 10), - PackageEvents::POST_PACKAGE_UPDATE => array('postInstall', 10), - ); - } - - /** - * Before running composer install, - * @param Event $event - */ - public function checkPatches(Event $event) { - if (!$this->isPatchingEnabled()) { - return; - } - - try { - $repositoryManager = $this->composer->getRepositoryManager(); - $localRepository = $repositoryManager->getLocalRepository(); - $installationManager = $this->composer->getInstallationManager(); - $packages = $localRepository->getPackages(); - - $extra = $this->composer->getPackage()->getExtra(); - $patches_ignore = isset($extra['patches-ignore']) ? $extra['patches-ignore'] : array(); - - $tmp_patches = $this->grabPatches(); - foreach ($packages as $package) { - $extra = $package->getExtra(); - if (isset($extra['patches'])) { - if (isset($patches_ignore[$package->getName()])) { - foreach ($patches_ignore[$package->getName()] as $package_name => $patches) { - if (isset($extra['patches'][$package_name])) { - $extra['patches'][$package_name] = array_diff($extra['patches'][$package_name], $patches); - } - } - } - $this->installedPatches[$package->getName()] = $extra['patches']; - } - $patches = isset($extra['patches']) ? $extra['patches'] : array(); - $tmp_patches = $this->arrayMergeRecursiveDistinct($tmp_patches, $patches); - } - - if ($tmp_patches == FALSE) { - $this->io->write('No patches supplied.'); - return; - } - - // Remove packages for which the patch set has changed. - $promises = array(); - foreach ($packages as $package) { - if (!($package instanceof AliasPackage)) { - $package_name = $package->getName(); - $extra = $package->getExtra(); - $has_patches = isset($tmp_patches[$package_name]); - $has_applied_patches = isset($extra['patches_applied']) && count($extra['patches_applied']) > 0; - if (($has_patches && !$has_applied_patches) - || (!$has_patches && $has_applied_patches) - || ($has_patches && $has_applied_patches && $tmp_patches[$package_name] !== $extra['patches_applied'])) { - $uninstallOperation = new UninstallOperation($package, 'Removing package so it can be re-installed and re-patched.'); - $this->io->write('Removing package ' . $package_name . ' so that it can be re-installed and re-patched.'); - $promises[] = $installationManager->uninstall($localRepository, $uninstallOperation); - } - } - } - $promises = array_filter($promises); - if ($promises) { - $this->composer->getLoop()->wait($promises); - } - } - // If the Locker isn't available, then we don't need to do this. - // It's the first time packages have been installed. - catch (\LogicException $e) { - return; - } - } - - /** - * Gather patches from dependencies and store them for later use. - * - * @param PackageEvent $event - */ - public function gatherPatches(PackageEvent $event) { - // If we've already done this, then don't do it again. - if (isset($this->patches['_patchesGathered'])) { - $this->io->write('Patches already gathered. Skipping', TRUE, IOInterface::VERBOSE); - return; - } - // If patching has been disabled, bail out here. - elseif (!$this->isPatchingEnabled()) { - $this->io->write('Patching is disabled. Skipping.', TRUE, IOInterface::VERBOSE); - return; - } - - $this->patches = $this->grabPatches(); - if (empty($this->patches)) { - $this->io->write('No patches supplied.'); - } - - $extra = $this->composer->getPackage()->getExtra(); - $patches_ignore = isset($extra['patches-ignore']) ? $extra['patches-ignore'] : array(); - - // Now add all the patches from dependencies that will be installed. - $operations = $event->getOperations(); - $this->io->write('Gathering patches for dependencies. This might take a minute.'); - foreach ($operations as $operation) { - if ($operation instanceof InstallOperation || $operation instanceof UpdateOperation) { - $package = $this->getPackageFromOperation($operation); - $extra = $package->getExtra(); - if (isset($extra['patches'])) { - if (isset($patches_ignore[$package->getName()])) { - foreach ($patches_ignore[$package->getName()] as $package_name => $patches) { - if (isset($extra['patches'][$package_name])) { - $extra['patches'][$package_name] = array_diff($extra['patches'][$package_name], $patches); - } - } - } - $this->patches = $this->arrayMergeRecursiveDistinct($this->patches, $extra['patches']); - } - // Unset installed patches for this package - if(isset($this->installedPatches[$package->getName()])) { - unset($this->installedPatches[$package->getName()]); - } - } - } - - // Merge installed patches from dependencies that did not receive an update. - foreach ($this->installedPatches as $patches) { - $this->patches = $this->arrayMergeRecursiveDistinct($this->patches, $patches); - } - - // If we're in verbose mode, list the projects we're going to patch. - if ($this->io->isVerbose()) { - foreach ($this->patches as $package => $patches) { - $number = count($patches); - $this->io->write('Found ' . $number . ' patches for ' . $package . '.'); - } - } - - // Make sure we don't gather patches again. Extra keys in $this->patches - // won't hurt anything, so we'll just stash it there. - $this->patches['_patchesGathered'] = TRUE; - } - - /** - * Get the patches from root composer or external file - * @return Patches - * @throws \Exception - */ - public function grabPatches() { - // First, try to get the patches from the root composer.json. - $extra = $this->composer->getPackage()->getExtra(); - if (isset($extra['patches'])) { - $this->io->write('Gathering patches for root package.'); - $patches = $extra['patches']; - return $patches; - } - // If it's not specified there, look for a patches-file definition. - elseif (isset($extra['patches-file'])) { - $this->io->write('Gathering patches from patch file.'); - $patches = file_get_contents($extra['patches-file']); - $patches = json_decode($patches, TRUE); - $error = json_last_error(); - if ($error != 0) { - switch ($error) { - case JSON_ERROR_DEPTH: - $msg = ' - Maximum stack depth exceeded'; - break; - case JSON_ERROR_STATE_MISMATCH: - $msg = ' - Underflow or the modes mismatch'; - break; - case JSON_ERROR_CTRL_CHAR: - $msg = ' - Unexpected control character found'; - break; - case JSON_ERROR_SYNTAX: - $msg = ' - Syntax error, malformed JSON'; - break; - case JSON_ERROR_UTF8: - $msg = ' - Malformed UTF-8 characters, possibly incorrectly encoded'; - break; - default: - $msg = ' - Unknown error'; - break; - } - throw new \Exception('There was an error in the supplied patches file:' . $msg); - } - if (isset($patches['patches'])) { - $patches = $patches['patches']; - return $patches; - } - elseif(!$patches) { - throw new \Exception('There was an error in the supplied patch file'); - } - } - else { - return array(); - } - } - - /** - * @param PackageEvent $event - * @throws \Exception - */ - public function postInstall(PackageEvent $event) { - - // Check if we should exit in failure. - $extra = $this->composer->getPackage()->getExtra(); - $exitOnFailure = getenv('COMPOSER_EXIT_ON_PATCH_FAILURE') || !empty($extra['composer-exit-on-patch-failure']); - $skipReporting = getenv('COMPOSER_PATCHES_SKIP_REPORTING') || !empty($extra['composer-patches-skip-reporting']); - - // Get the package object for the current operation. - $operation = $event->getOperation(); - /** @var PackageInterface $package */ - $package = $this->getPackageFromOperation($operation); - $package_name = $package->getName(); - - if (!isset($this->patches[$package_name])) { - if ($this->io->isVerbose()) { - $this->io->write('No patches found for ' . $package_name . '.'); - } - return; - } - $this->io->write(' - Applying patches for ' . $package_name . ''); - - // Get the install path from the package object. - $manager = $event->getComposer()->getInstallationManager(); - $install_path = $manager->getInstaller($package->getType())->getInstallPath($package); - - // Set up a downloader. - $downloader = new RemoteFilesystem($this->io, $this->composer->getConfig()); - - // Track applied patches in the package info in installed.json - $localRepository = $this->composer->getRepositoryManager()->getLocalRepository(); - $localPackage = $localRepository->findPackage($package_name, $package->getVersion()); - $extra = $localPackage->getExtra(); - $extra['patches_applied'] = array(); - - foreach ($this->patches[$package_name] as $description => $url) { - $this->io->write(' ' . $url . ' (' . $description. ')'); - try { - $this->eventDispatcher->dispatch(NULL, new PatchEvent(PatchEvents::PRE_PATCH_APPLY, $package, $url, $description)); - $this->getAndApplyPatch($downloader, $install_path, $url, $package); - $this->eventDispatcher->dispatch(NULL, new PatchEvent(PatchEvents::POST_PATCH_APPLY, $package, $url, $description)); - $extra['patches_applied'][$description] = $url; - } - catch (\Exception $e) { - $this->io->write(' Could not apply patch! Skipping. The error was: ' . $e->getMessage() . ''); - if ($exitOnFailure) { - throw new \Exception("Cannot apply patch $description ($url)!"); - } - } - } - $localPackage->setExtra($extra); - - $this->io->write(''); - - if (true !== $skipReporting) { - $this->writePatchReport($this->patches[$package_name], $install_path); - } - } - - /** - * Get a Package object from an OperationInterface object. - * - * @param OperationInterface $operation - * @return PackageInterface - * @throws \Exception - */ - protected function getPackageFromOperation(OperationInterface $operation) { - if ($operation instanceof InstallOperation) { - $package = $operation->getPackage(); - } - elseif ($operation instanceof UpdateOperation) { - $package = $operation->getTargetPackage(); - } - else { - throw new \Exception('Unknown operation: ' . get_class($operation)); - } - - return $package; - } - - /** - * Apply a patch on code in the specified directory. - * - * @param RemoteFilesystem $downloader - * @param $install_path - * @param $patch_url - * @param PackageInterface $package - * @throws \Exception - */ - protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path, $patch_url, PackageInterface $package) { - - // Local patch file. - if (file_exists($patch_url)) { - $filename = realpath($patch_url); - } - else { - // Generate random (but not cryptographically so) filename. - $filename = uniqid(sys_get_temp_dir().'/') . ".patch"; - - // Download file from remote filesystem to this location. - $hostname = parse_url($patch_url, PHP_URL_HOST); - - try { - $downloader->copy($hostname, $patch_url, $filename, false); - } catch (\Exception $e) { - // In case of an exception, retry once as the download might - // have failed due to intermittent network issues. - $downloader->copy($hostname, $patch_url, $filename, false); - } - } - - // The order here is intentional. p1 is most likely to apply with git apply. - // p0 is next likely. p2 is extremely unlikely, but for some special cases, - // it might be useful. p4 is useful for Magento 2 patches - $patch_levels = array('-p1', '-p0', '-p2', '-p4'); - - // Check for specified patch level for this package. - $extra = $this->composer->getPackage()->getExtra(); - if (!empty($extra['patchLevel'][$package->getName()])){ - $patch_levels = array($extra['patchLevel'][$package->getName()]); - } - // Attempt to apply with git apply. - $patched = $this->applyPatchWithGit($install_path, $patch_levels, $filename); - - // In some rare cases, git will fail to apply a patch, fallback to using - // the 'patch' command. - if (!$patched) { - foreach ($patch_levels as $patch_level) { - // --no-backup-if-mismatch here is a hack that fixes some - // differences between how patch works on windows and unix. - if ($patched = $this->executeCommand("patch %s --no-backup-if-mismatch -d %s < %s", $patch_level, $install_path, $filename)) { - break; - } - } - } - - // Clean up the temporary patch file. - if (isset($hostname)) { - unlink($filename); - } - // If the patch *still* isn't applied, then give up and throw an Exception. - // Otherwise, let the user know it worked. - if (!$patched) { - throw new \Exception("Cannot apply patch $patch_url"); - } - } - - /** - * Checks if the root package enables patching. - * - * @return bool - * Whether patching is enabled. Defaults to TRUE. - */ - protected function isPatchingEnabled() { - $extra = $this->composer->getPackage()->getExtra(); - - if (empty($extra['patches']) && empty($extra['patches-ignore']) && !isset($extra['patches-file'])) { - // The root package has no patches of its own, so only allow patching if - // it has specifically opted in. - return isset($extra['enable-patching']) ? $extra['enable-patching'] : FALSE; - } - else { - return TRUE; - } - } - - /** - * Writes a patch report to the target directory. - * - * @param array $patches - * @param string $directory - */ - protected function writePatchReport($patches, $directory) { - $output = "This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)\n"; - $output .= "Patches applied to this directory:\n\n"; - foreach ($patches as $description => $url) { - $output .= $description . "\n"; - $output .= 'Source: ' . $url . "\n\n\n"; - } - file_put_contents($directory . "/PATCHES.txt", $output); - } - - /** - * Executes a shell command with escaping. - * - * @param string $cmd - * @return bool - */ - protected function executeCommand($cmd) { - // Shell-escape all arguments except the command. - $args = func_get_args(); - foreach ($args as $index => $arg) { - if ($index !== 0) { - $args[$index] = escapeshellarg($arg); - } - } - - // And replace the arguments. - $command = call_user_func_array('sprintf', $args); - $output = ''; - if ($this->io->isVerbose()) { - $this->io->write('' . $command . ''); - $io = $this->io; - $output = function ($type, $data) use ($io) { - if ($type == Process::ERR) { - $io->write('' . $data . ''); - } - else { - $io->write('' . $data . ''); - } - }; - } - return ($this->executor->execute($command, $output) == 0); - } - - /** - * Recursively merge arrays without changing data types of values. - * - * Does not change the data types of the values in the arrays. Matching keys' - * values in the second array overwrite those in the first array, as is the - * case with array_merge. - * - * @param array $array1 - * The first array. - * @param array $array2 - * The second array. - * @return array - * The merged array. - * - * @see http://php.net/manual/en/function.array-merge-recursive.php#92195 - */ - protected function arrayMergeRecursiveDistinct(array $array1, array $array2) { - $merged = $array1; - - foreach ($array2 as $key => &$value) { - if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { - $merged[$key] = $this->arrayMergeRecursiveDistinct($merged[$key], $value); - } - else { - $merged[$key] = $value; - } - } - - return $merged; - } - - /** - * Attempts to apply a patch with git apply. - * - * @param $install_path - * @param $patch_levels - * @param $filename - * - * @return bool - * TRUE if patch was applied, FALSE otherwise. - */ - protected function applyPatchWithGit($install_path, $patch_levels, $filename) { - // Do not use git apply unless the install path is itself a git repo - // @see https://stackoverflow.com/a/27283285 - if (!is_dir($install_path . '/.git')) { - return FALSE; - } - - $patched = FALSE; - foreach ($patch_levels as $patch_level) { - if ($this->io->isVerbose()) { - $comment = 'Testing ability to patch with git apply.'; - $comment .= ' This command may produce errors that can be safely ignored.'; - $this->io->write('' . $comment . ''); - } - $checked = $this->executeCommand('git -C %s apply --check -v %s %s', $install_path, $patch_level, $filename); - $output = $this->executor->getErrorOutput(); - if (substr($output, 0, 7) == 'Skipped') { - // Git will indicate success but silently skip patches in some scenarios. - // - // @see https://github.com/cweagans/composer-patches/pull/165 - $checked = FALSE; - } - if ($checked) { - // Apply the first successful style. - $patched = $this->executeCommand('git -C %s apply %s %s', $install_path, $patch_level, $filename); - break; - } - } - return $patched; - } - - /** - * Indicates if a package has been patched. - * - * @param \Composer\Package\PackageInterface $package - * The package to check. - * - * @return bool - * TRUE if the package has been patched. - */ - public static function isPackagePatched(PackageInterface $package) { - return array_key_exists('patches_applied', $package->getExtra()); - } - - /** - * {@inheritDoc} - */ - public function deactivate(Composer $composer, IOInterface $io) - { - } - - /** - * {@inheritDoc} - */ - public function uninstall(Composer $composer, IOInterface $io) - { - } - -} diff --git a/vendor/cweagans/composer-patches/tests/PatchEventTest.php b/vendor/cweagans/composer-patches/tests/PatchEventTest.php deleted file mode 100644 index 0f6adb7..0000000 --- a/vendor/cweagans/composer-patches/tests/PatchEventTest.php +++ /dev/null @@ -1,39 +0,0 @@ -assertEquals($event_name, $patch_event->getName()); - $this->assertEquals($package, $patch_event->getPackage()); - $this->assertEquals($url, $patch_event->getUrl()); - $this->assertEquals($description, $patch_event->getDescription()); - } - - public function patchEventDataProvider() { - $prophecy = $this->prophesize('Composer\Package\PackageInterface'); - $package = $prophecy->reveal(); - - return array( - array(PatchEvents::PRE_PATCH_APPLY, $package, 'https://www.drupal.org', 'A test patch'), - array(PatchEvents::POST_PATCH_APPLY, $package, 'https://www.drupal.org', 'A test patch'), - ); - } - -} diff --git a/vendor/iio/libmergepdf/.github/ISSUE_TEMPLATE/bug_report.md b/vendor/iio/libmergepdf/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index e6a8753..0000000 --- a/vendor/iio/libmergepdf/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Include files** -Please include the files that you are trying to merge so that the error can be reproduced. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Please complete the following information:** - - PHP-version - - Version of library [e.g. 22] - - Driver used - -**Additional context** -Add any other context about the problem here. - -> Please note that this library is only a wrapper around other pdf editing tools. -> As such we are only able to respond to problems regaring the actual -> merging process. Issues concering deeper pdf parsing problems should -> be directed elsewhere. diff --git a/vendor/iio/libmergepdf/PATCHES.txt b/vendor/iio/libmergepdf/PATCHES.txt deleted file mode 100644 index ae343e1..0000000 --- a/vendor/iio/libmergepdf/PATCHES.txt +++ /dev/null @@ -1,7 +0,0 @@ -This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches) -Patches applied to this directory: - -Add PHP 8.2 support -Source: patches/iio-libmergepdf-support-php82.patch - - diff --git a/vendor/iio/libmergepdf/composer.json b/vendor/iio/libmergepdf/composer.json deleted file mode 100644 index 195d0aa..0000000 --- a/vendor/iio/libmergepdf/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "iio/libmergepdf", - "description": "Library for merging multiple PDFs", - "keywords": ["pdf", "merge"], - "homepage": "https://github.com/hanneskod/libmergepdf", - "type": "library", - "license": "WTFPL", - "authors": [ - { - "name": "Hannes Forsgård", - "email": "hannes.forsgard@fripost.org" - } - ], - "autoload": { - "psr-4": { - "iio\\libmergepdf\\": "src/" - }, - "classmap": [ - "tcpdi/" - ] - }, - "require": { - "php": "^7.1||^8.0", - "tecnickcom/tcpdf": "^6.2.22", - "setasign/fpdi": "^2" - }, - "conflict": { - "setasign/fpdf": "*", - "rafikhaceb/tcpdi": "*" - }, - "require-dev": { - "phpunit/phpunit": "^7|^8", - "smalot/pdfparser": "~0.13" - } -} diff --git a/vendor/iio/libmergepdf/src/Driver/DefaultDriver.php b/vendor/iio/libmergepdf/src/Driver/DefaultDriver.php deleted file mode 100644 index 9ad6f73..0000000 --- a/vendor/iio/libmergepdf/src/Driver/DefaultDriver.php +++ /dev/null @@ -1,25 +0,0 @@ -wrapped = $wrapped ?: new Fpdi2Driver; - } - - public function merge(SourceInterface ...$sources): string - { - return $this->wrapped->merge(...$sources); - } -} diff --git a/vendor/iio/libmergepdf/src/Driver/DriverInterface.php b/vendor/iio/libmergepdf/src/Driver/DriverInterface.php deleted file mode 100644 index 39cca1e..0000000 --- a/vendor/iio/libmergepdf/src/Driver/DriverInterface.php +++ /dev/null @@ -1,13 +0,0 @@ -fpdi = $fpdi ?: @new FpdiTcpdf; - - if (!($this->fpdi instanceof FpdiFpdf) && !($this->fpdi instanceof FpdiTcpdf)) { - throw new \InvalidArgumentException('Constructor argument must be an FPDI instance.'); - } - } - - public function merge(SourceInterface ...$sources): string - { - $sourceName = ''; - - try { - $fpdi = clone $this->fpdi; - - foreach ($sources as $source) { - $sourceName = $source->getName(); - $pageCount = $fpdi->setSourceFile(StreamReader::createByString($source->getContents())); - $pageNumbers = $source->getPages()->getPageNumbers() ?: range(1, $pageCount); - - foreach ($pageNumbers as $pageNr) { - $template = $fpdi->importPage($pageNr); - $size = $fpdi->getTemplateSize($template); - $fpdi->SetPrintHeader(false); - $fpdi->SetPrintFooter(false); - $fpdi->AddPage( - $size['width'] > $size['height'] ? 'L' : 'P', - [$size['width'], $size['height']] - ); - $fpdi->useTemplate($template); - } - } - - return $fpdi->Output('', 'S'); - } catch (\Exception $e) { - throw new Exception("'{$e->getMessage()}' in '$sourceName'", 0, $e); - } - } -} diff --git a/vendor/iio/libmergepdf/src/Driver/TcpdiDriver.php b/vendor/iio/libmergepdf/src/Driver/TcpdiDriver.php deleted file mode 100644 index fa0ddc8..0000000 --- a/vendor/iio/libmergepdf/src/Driver/TcpdiDriver.php +++ /dev/null @@ -1,52 +0,0 @@ -tcpdi = $tcpdi ?: new \TCPDI; - } - - public function merge(SourceInterface ...$sources): string - { - $sourceName = ''; - - try { - $tcpdi = clone $this->tcpdi; - - foreach ($sources as $source) { - $sourceName = $source->getName(); - $pageCount = $tcpdi->setSourceData($source->getContents()); - $pageNumbers = $source->getPages()->getPageNumbers() ?: range(1, $pageCount); - - foreach ($pageNumbers as $pageNr) { - $template = $tcpdi->importPage($pageNr); - $size = $tcpdi->getTemplateSize($template); - $tcpdi->SetPrintHeader(false); - $tcpdi->SetPrintFooter(false); - $tcpdi->AddPage( - $size['w'] > $size['h'] ? 'L' : 'P', - [$size['w'], $size['h']] - ); - $tcpdi->useTemplate($template); - } - } - - return $tcpdi->Output('', 'S'); - } catch (\Exception $e) { - throw new Exception("'{$e->getMessage()}' in '$sourceName'", 0, $e); - } - } -} diff --git a/vendor/iio/libmergepdf/src/Exception.php b/vendor/iio/libmergepdf/src/Exception.php deleted file mode 100644 index 69b3208..0000000 --- a/vendor/iio/libmergepdf/src/Exception.php +++ /dev/null @@ -1,7 +0,0 @@ -driver = $driver ?: new DefaultDriver; - } - - /** - * Add raw PDF from string - */ - public function addRaw(string $content, PagesInterface $pages = null): void - { - $this->sources[] = new RawSource($content, $pages); - } - - /** - * Add PDF from file - */ - public function addFile(string $filename, PagesInterface $pages = null): void - { - $this->sources[] = new FileSource($filename, $pages); - } - - /** - * Add files using iterator - * - * @param iterable $iterator Set of filenames to add - * @param PagesInterface $pages Optional pages constraint used for every added pdf - */ - public function addIterator(iterable $iterator, PagesInterface $pages = null): void - { - foreach ($iterator as $filename) { - $this->addFile($filename, $pages); - } - } - - /** - * Merges loaded PDFs - */ - public function merge(): string - { - return $this->driver->merge(...$this->sources); - } - - /** - * Reset internal state - */ - public function reset(): void - { - $this->sources = []; - } -} diff --git a/vendor/iio/libmergepdf/src/Pages.php b/vendor/iio/libmergepdf/src/Pages.php deleted file mode 100644 index 7675315..0000000 --- a/vendor/iio/libmergepdf/src/Pages.php +++ /dev/null @@ -1,67 +0,0 @@ -addPage((int)$expr); - continue; - } - if (preg_match("/^(\d+)-(\d+)/", $expr, $matches)) { - $this->addRange((int)$matches[1], (int)$matches[2]); - continue; - } - throw new Exception("Invalid page number(s) for expression '$expr'"); - } - } - - /** - * Add a single page - */ - public function addPage(int $page): void - { - $this->pages[] = $page; - } - - /** - * Add a range of pages - */ - public function addRange(int $start, int $end): void - { - $this->pages = array_merge($this->pages, range($start, $end)); - } - - public function getPageNumbers(): array - { - return $this->pages; - } -} diff --git a/vendor/iio/libmergepdf/src/PagesInterface.php b/vendor/iio/libmergepdf/src/PagesInterface.php deleted file mode 100644 index e85d3c8..0000000 --- a/vendor/iio/libmergepdf/src/PagesInterface.php +++ /dev/null @@ -1,11 +0,0 @@ -filename = $filename; - $this->pages = $pages ?: new Pages; - } - - public function getName(): string - { - return $this->filename; - } - - public function getContents(): string - { - return (string)file_get_contents($this->filename); - } - - public function getPages(): PagesInterface - { - return $this->pages; - } -} diff --git a/vendor/iio/libmergepdf/src/Source/RawSource.php b/vendor/iio/libmergepdf/src/Source/RawSource.php deleted file mode 100644 index 7966918..0000000 --- a/vendor/iio/libmergepdf/src/Source/RawSource.php +++ /dev/null @@ -1,45 +0,0 @@ -contents = $contents; - $this->pages = $pages ?: new Pages; - } - - public function getName(): string - { - return "raw-content"; - } - - public function getContents(): string - { - return $this->contents; - } - - public function getPages(): PagesInterface - { - return $this->pages; - } -} diff --git a/vendor/iio/libmergepdf/src/Source/SourceInterface.php b/vendor/iio/libmergepdf/src/Source/SourceInterface.php deleted file mode 100644 index 4ce9c3c..0000000 --- a/vendor/iio/libmergepdf/src/Source/SourceInterface.php +++ /dev/null @@ -1,25 +0,0 @@ -AddPage(); -$pdf->setSourceFile('/path/to/file-to-import.pdf'); -$idx = $pdf->importPage(1); -$pdf->useTemplate($idx); - -$pdfdata = file_get_contents('/path/to/other-file.pdf'); // Simulate only having raw data available. -$pagecount = $pdf->setSourceData($pdfdata); -for ($i = 1; $i <= $pagecount; $i++) { - $tplidx = $pdf->importPage($i); - $pdf->AddPage(); - $pdf->useTemplate($tplidx); -} -``` - -As of version 1.1, TCPDI also includes additional functionality for handling PDF Annotations. As annotations are positioned relative to the bleed box rather than the crop box, you'll need to ensure that you're importing the full bleed box; a new function has also been introduced to set the page format (the various boxes, including the crop box) from the imported page, so that the imported page matches the original better. The following example demonstrates this: - -```php -// Create new PDF document. -$pdf = new TCPDI(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// Add a page from a PDF by file path. -$pdf->setSourceFile('/path/to/file-to-import.pdf'); - -// Import the bleed box (default is crop box) for page 1. -$tplidx = $pdf->importPage(1, '/BleedBox'); -$size = $pdf->getTemplatesize($tplidx); -$orientation = ($size['w'] > $size['h']) ? 'L' : 'P'; - -$pdf->AddPage($orientation); - -// Set page boxes from imported page 1. -$pdf->setPageFormatFromTemplatePage(1, $orientation); - -// Import the content for page 1. -$pdf->useTemplate($tplidx); - -// Import the annotations for page 1. -$pdf->importAnnotations(1); -``` - -TCPDI_PARSER -============ - -Parser for use with TCPDI, based on TCPDF_PARSER. Supports PDFs up to v1.7. diff --git a/vendor/karriere/pdf-merge/.github/workflows/ci.yml b/vendor/karriere/pdf-merge/.github/workflows/ci.yml new file mode 100644 index 0000000..3e5deea --- /dev/null +++ b/vendor/karriere/pdf-merge/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + strategy: + fail-fast: true + matrix: + php: [ "8.1", "8.2", "8.3", "8.4" ] + + runs-on: ubuntu-latest + name: PHP@${{ matrix.php }} + + steps: + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - uses: actions/checkout@v4 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Lint code + run: composer run-script lint + + - name: Analyse code + run: composer run-script analyse + + - name: Test code + run: composer run-script test diff --git a/vendor/karriere/pdf-merge/.gitignore b/vendor/karriere/pdf-merge/.gitignore new file mode 100644 index 0000000..dbb9aa7 --- /dev/null +++ b/vendor/karriere/pdf-merge/.gitignore @@ -0,0 +1,7 @@ +vendor/ +coverage/ +tests/output.pdf +.phpunit.result.cache +composer.lock +coverage.xml +junit.xml diff --git a/vendor/karriere/pdf-merge/CHANGELOG.md b/vendor/karriere/pdf-merge/CHANGELOG.md new file mode 100644 index 0000000..17f7d90 --- /dev/null +++ b/vendor/karriere/pdf-merge/CHANGELOG.md @@ -0,0 +1,81 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [3.3.1] - 2025-02-19 +### Added +- `@throws` to PHPDoc for better IDE support + +## [3.3.0] - 2025-02-19 +### Added +- Method `getFiles()` + +## [3.2.0] - 2024-12-05 +### Added +- Support for PHP 8.4 + +### Removed +- Support for PHP 8.0 + +## [3.1.0] - 2024-02-05 +### Added +- Support for PHP 8.3 + +## [3.0.0] - 2023-03-01 +### Added +- Support for PHP 8.2 + +### Changed +- [BREAKING] Header and footer config with dedicated classes instead of arrays +- Linting to `pint` +- Unit tests to `pest` + +### Removed +- Support for PHP 7.4 + +## [2.1.0] - 2022-12-07 +### Added +- Support for merging PDFs with mixed orientations (portrait and landscape) + +### Changed +- Default header and footer are removed if header/footer-data is empty + +## [2.0.0] - 2022-08-10 +### Added +- Support for PHP 8.1 +- Ability to get `TCPDF`-instance by calling `(new PdfMerge())->getPdf()` + +### Changed +- [BREAKING] `PdfMerge::merge()` now returns `string` instead of `bool` +- `PdfMerge::merge()` now accepts `string $destination` as second parameter + +### Removed +- Dropped support for PHP < 7.4 + +## [1.3.0] - 2021-10-20 +### Added +- Support for PHP 8 + +## [1.2.0] - 2021-09-06 +### Added +- Ability to set `tcpdf` footer and header data via PdfMerge constructor + +## [1.1.1] - 2020-04-03 +### Fixed +- removed unused imagick options + +## [1.1.0] - 2020-03-30 +### Added +- tcpdf dependency +- tcpdi implementation + +### Removed +- fpdf and fpdi dependencies + +## [1.0.0] - 2020-03-30 + +### Added +- Pdf merging implementation based on fpdf & fpdi diff --git a/vendor/karriere/pdf-merge/LICENSE b/vendor/karriere/pdf-merge/LICENSE new file mode 100644 index 0000000..760a4e8 --- /dev/null +++ b/vendor/karriere/pdf-merge/LICENSE @@ -0,0 +1,188 @@ + Copyright 2017 karriere.at GmbH + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/vendor/karriere/pdf-merge/README.md b/vendor/karriere/pdf-merge/README.md new file mode 100644 index 0000000..70a91e1 --- /dev/null +++ b/vendor/karriere/pdf-merge/README.md @@ -0,0 +1,67 @@ + +    +![](https://github.com/karriereat/pdf-merge/workflows/CI/badge.svg) +[![Packagist Downloads](https://img.shields.io/packagist/dt/karriere/pdf-merge.svg?style=flat-square)](https://packagist.org/packages/karriere/pdf-merge) + +# Pdf Merge Solution for PHP + +This package is a wrapper for the `TCPDF` class that provides an elegant API for merging PDF files. + +## Installation + +You can install the package via composer: + +```bash +composer require karriere/pdf-merge +``` + +## Usage + +```php +use Karriere\PdfMerge\PdfMerge; + +$pdfMerge = new PdfMerge(); + +$pdfMerge->add('/path/to/file1.pdf'); +$pdfMerge->add('/path/to/file2.pdf'); + +$pdfMerge->merge('/path/to/output.pdf'); +``` + +Please note, that the `merge()`-method will throw a `NoFilesDefinedException` if no files where added. + +### Check for file existence +You can check if a file was already added for merging by calling: + +```php +$pdfMerge->contains('/path/to/file.pdf'); +``` + +### Configuring header and footer +You can also configure the header of footer of all pages like this: + +```php +use Karriere\PdfMerge\PdfMerge; + +$pdfMerge = new PdfMerge( + new HeaderConfig( + imagePath: 'header_logo.png', + logoWidthMM: 20, + title: 'Header', + text: 'This is a header text', + textColor: new RGB(200, 200, 200), + lineColor: new RGB(0, 0, 255), + ), + new FooterConfig( + textColor: new RGB(100, 100, 100), + lineColor: new RGB(255, 0, 0), + margin: 20, + ), + ); +``` + +All config properties have default values, so you don't have to pass them all. + +## License + +Apache License 2.0 Please see [LICENSE](LICENSE) for more information. diff --git a/vendor/karriere/pdf-merge/UPGRADE.md b/vendor/karriere/pdf-merge/UPGRADE.md new file mode 100644 index 0000000..d98ecea --- /dev/null +++ b/vendor/karriere/pdf-merge/UPGRADE.md @@ -0,0 +1,69 @@ +# Upgrade Guide + +## v2 to v3 +The only breaking chance in this release is the way a header and/or footer configuration is done. +In version 2 this was done with simple arrays, in v3 dedicated classes were introduced to make the +configuration type safe and bullet proof. + +### Header/Footer Configuration +```php +// Before +use Karriere\PdfMerge\PdfMerge; + +new PdfMerge([ + 'ln' => 'header_logo.png', + 'lw' => 20, + 'ht' => 'title', + 'hs' => 'more text', + 'tc' => [255, 255, 255], + 'lc' => [0, 0, 0]. +], +[ + 'tc' => [255, 255, 255], + 'lc' => [0, 0, 0]. +]); + +// After +use Karriere\PdfMerge\Config\FooterConfig; +use Karriere\PdfMerge\Config\HeaderConfig; +use Karriere\PdfMerge\Config\RGB; +use Karriere\PdfMerge\PdfMerge; + +new PdfMerge( + new HeaderConfig( + imagePath: 'header_logo.png', + logoWidthMM: 20, + title: 'Header', + text: 'This is a header text', + textColor: new RGB(200, 200, 200), + lineColor: new RGB(0, 0, 255), + ), + new FooterConfig( + textColor: new RGB(100, 100, 100), + lineColor: new RGB(255, 0, 0), + margin: 20, + ), +); +``` + +The above example shows the full feature set of header/footer configuration, but when using named arguments you can +choose a subset of configuration values as well because all other values have defaults in place: + +```php +use Karriere\PdfMerge\Config\FooterConfig; +use Karriere\PdfMerge\Config\HeaderConfig; +use Karriere\PdfMerge\Config\RGB; +use Karriere\PdfMerge\PdfMerge; + +new PdfMerge( + new HeaderConfig( + imagePath: 'header_logo.png', + text: 'This is a header text', + textColor: new RGB(200, 200, 200), + ), + new FooterConfig( + lineColor: new RGB(255, 0, 0), + ), +); +``` + diff --git a/vendor/karriere/pdf-merge/composer.json b/vendor/karriere/pdf-merge/composer.json new file mode 100644 index 0000000..0603bd6 --- /dev/null +++ b/vendor/karriere/pdf-merge/composer.json @@ -0,0 +1,53 @@ +{ + "name": "karriere/pdf-merge", + "description": "A wrapper for the TCPDF class that provides an elegant API for merging PDFs", + "keywords": ["pdf", "merge"], + "license": "Apache-2.0", + "authors": [ + { + "name": "Alexander Lentner", + "email": "alexander.lentner@karriere.at", + "role": "Maintainer" + } + ], + "require": { + "php": "8.1.* | 8.2.* | 8.3.* | 8.4.*", + "tecnickcom/tcpdf": "^6.3" + }, + "require-dev": { + "laravel/pint": "^1.5 | ^1.6", + "pestphp/pest": "^1.22", + "phpstan/phpstan": "^1.10" + }, + "autoload": { + "psr-4": { + "Karriere\\PdfMerge\\": "src/" + }, + "classmap": [ + "tcpi/fpdf_tpl.php", + "tcpi/tcpdi.php", + "tcpi/tcpdi_parser.php" + ] + }, + "autoload-dev": { + "psr-4": { + "Karriere\\PdfMerge\\Tests\\": "tests" + } + }, + "scripts": { + "analyse": "phpstan analyse --memory-limit 512M", + "lint": "pint --test", + "lint:verbose": "pint -v --test", + "fix": "pint", + "test": "vendor/bin/pest", + "coverage": "vendor/bin/pest --coverage --ci --coverage-html coverage --coverage-clover coverage.xml --log-junit junit.xml", + "report": "vendor/bin/pest --coverage", + "report:html": "vendor/bin/pest --coverage --coverage-html coverage" + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true + } + } +} diff --git a/vendor/karriere/pdf-merge/phpstan.neon b/vendor/karriere/pdf-merge/phpstan.neon new file mode 100644 index 0000000..43aa29f --- /dev/null +++ b/vendor/karriere/pdf-merge/phpstan.neon @@ -0,0 +1,5 @@ +parameters: + paths: + - src + level: max + treatPhpDocTypesAsCertain: true diff --git a/vendor/karriere/pdf-merge/phpunit.xml b/vendor/karriere/pdf-merge/phpunit.xml new file mode 100644 index 0000000..72c39e5 --- /dev/null +++ b/vendor/karriere/pdf-merge/phpunit.xml @@ -0,0 +1,17 @@ + + + + + ./tests + + + + + ./src + + + diff --git a/vendor/karriere/pdf-merge/pint.json b/vendor/karriere/pdf-merge/pint.json new file mode 100644 index 0000000..e071280 --- /dev/null +++ b/vendor/karriere/pdf-merge/pint.json @@ -0,0 +1,8 @@ +{ + "preset": "psr12", + "rules": { + "concat_space": { + "spacing": "one" + } + } +} diff --git a/vendor/karriere/pdf-merge/src/Config/FooterConfig.php b/vendor/karriere/pdf-merge/src/Config/FooterConfig.php new file mode 100644 index 0000000..6947692 --- /dev/null +++ b/vendor/karriere/pdf-merge/src/Config/FooterConfig.php @@ -0,0 +1,33 @@ +textColor ?: new RGB(); + } + + public function lineColor(): RGB + { + return $this->lineColor ?: new RGB(); + } + + public function margin(): int + { + return $this->margin; + } +} diff --git a/vendor/karriere/pdf-merge/src/Config/HeaderConfig.php b/vendor/karriere/pdf-merge/src/Config/HeaderConfig.php new file mode 100644 index 0000000..d702273 --- /dev/null +++ b/vendor/karriere/pdf-merge/src/Config/HeaderConfig.php @@ -0,0 +1,54 @@ +imagePath; + } + + public function logoWidthMM(): int + { + return $this->logoWidthMM; + } + + public function title(): string + { + return $this->title; + } + + public function text(): string + { + return $this->text; + } + + public function textColor(): RGB + { + return $this->textColor ?: new RGB(); + } + + public function lineColor(): RGB + { + return $this->lineColor ?: new RGB(); + } +} diff --git a/vendor/karriere/pdf-merge/src/Config/RGB.php b/vendor/karriere/pdf-merge/src/Config/RGB.php new file mode 100644 index 0000000..b9bde8e --- /dev/null +++ b/vendor/karriere/pdf-merge/src/Config/RGB.php @@ -0,0 +1,18 @@ + + */ + public function toArray(): array + { + return [$this->red, $this->green, $this->blue]; + } +} diff --git a/vendor/karriere/pdf-merge/src/Exceptions/FileNotFoundException.php b/vendor/karriere/pdf-merge/src/Exceptions/FileNotFoundException.php new file mode 100644 index 0000000..9ee6138 --- /dev/null +++ b/vendor/karriere/pdf-merge/src/Exceptions/FileNotFoundException.php @@ -0,0 +1,13 @@ + + */ + private array $files = []; + private TCPDI $pdf; + + /** + * Passed parameters overrides settings for header and footer by calling tcpdf.php methods: + * setHeaderData($ln='', $lw=0, $ht='', $hs='', $tc=array(0,0,0), $lc=array(0,0,0)) + * setFooterData($tc=array(0,0,0), $lc=array(0,0,0)) + * For more info about tcpdf, please read https://tcpdf.org/docs/ + */ + public function __construct(?HeaderConfig $headerConfig = null, ?FooterConfig $footerConfig = null) + { + $this->pdf = new TCPDI(); + $this->configureHeaderAndFooter($headerConfig, $footerConfig); + } + + public function getPdf(): TCPDI + { + return $this->pdf; + } + + /** + * Adds a file to merge + * + * @throws FileNotFoundException + */ + public function add(string $file): void + { + if (!file_exists($file)) { + throw new FileNotFoundException($file); + } + + $this->files[] = $file; + } + + /** + * Checks if the given file is already registered for merging + */ + public function contains(string $file): bool + { + return in_array($file, $this->files); + } + + /** + * Resets the stored files + */ + public function reset(): void + { + $this->files = []; + } + + /** + * Generates a merged PDF file from the already stored PDF files + * + * @throws NoFilesDefinedException + */ + public function merge(string $outputFilename, string $destination = 'F'): string + { + if (count($this->files) === 0) { + throw new NoFilesDefinedException(); + } + + foreach ($this->files as $file) { + $pageCount = $this->pdf->setSourceFile($file); + + for ($i = 1; $i <= $pageCount; $i++) { + $pageId = $this->pdf->ImportPage($i); + $size = $this->pdf->getTemplateSize($pageId); + + $this->pdf->AddPage('', $size); + $this->pdf->useTemplate($pageId, null, null, 0, 0, true); + } + } + + return $this->pdf->Output($outputFilename, $destination); + } + + /** + * @return array + */ + public function getFiles(): array + { + return $this->files; + } + + private function configureHeaderAndFooter(?HeaderConfig $headerConfig, ?FooterConfig $footerConfig): void + { + if ($headerConfig) { + $this->pdf->setHeaderData( + $headerConfig->imagePath(), + $headerConfig->logoWidthMM(), + $headerConfig->title(), + $headerConfig->text(), + $headerConfig->textColor()->toArray(), + $headerConfig->lineColor()->toArray(), + ); + } else { + $this->pdf->setPrintHeader(false); + } + + if ($footerConfig) { + $this->pdf->setFooterData($footerConfig->textColor()->toArray(), $footerConfig->lineColor()->toArray()); + $this->pdf->setFooterMargin($footerConfig->margin()); + } else { + $this->pdf->setPrintFooter(false); + } + } +} diff --git a/vendor/iio/libmergepdf/tcpdi/fpdf_tpl.php b/vendor/karriere/pdf-merge/tcpi/fpdf_tpl.php similarity index 71% rename from vendor/iio/libmergepdf/tcpdi/fpdf_tpl.php rename to vendor/karriere/pdf-merge/tcpi/fpdf_tpl.php index 5322fa8..106d14a 100644 --- a/vendor/iio/libmergepdf/tcpdi/fpdf_tpl.php +++ b/vendor/karriere/pdf-merge/tcpi/fpdf_tpl.php @@ -1,4 +1,5 @@ Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.'); return; } - - if ($this->page <= 0) + + if ($this->page <= 0) { $this->error("You have to add a page to fpdf first!"); + } - if ($x == null) + if ($x == null) { $x = 0; - if ($y == null) + } + if ($y == null) { $y = 0; - if ($w == null) + } + if ($w == null) { $w = $this->w; - if ($h == null) + } + if ($h == null) { $h = $this->h; + } // Save settings $this->tpl++; - $tpl =& $this->tpls[$this->tpl]; + $tpl = & $this->tpls[$this->tpl]; $tpl = array( 'o_x' => $this->x, 'o_y' => $this->y, @@ -116,7 +124,7 @@ function beginTemplate($x = null, $y = null, $w = null, $h = null) { ); $this->SetAutoPageBreak(false); - + // Define own high and width to calculate possitions correct $this->h = $h; $this->w = $w; @@ -127,14 +135,14 @@ function beginTemplate($x = null, $y = null, $w = null, $h = null) { if ($this->CurrentFont) { $fontkey = $this->FontFamily . $this->FontStyle; - $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; - + $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] = & $this->fonts[$fontkey]; + $this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); } - + return $this->tpl; } - + /** * End Template * @@ -142,15 +150,16 @@ function beginTemplate($x = null, $y = null, $w = null, $h = null) { * * @return mixed If a template is opened, the ID is returned. If not a false is returned. */ - function endTemplate() { + public function endTemplate() + { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); - return call_user_func_array(array('TCPDF', 'endTemplate'), $args); + return call_user_func_array([TCPDF::class, 'endTemplate'], $args); } - + if ($this->_intpl) { - $this->_intpl = false; - $tpl =& $this->tpls[$this->tpl]; + $this->_intpl = false; + $tpl = & $this->tpls[$this->tpl]; $this->SetXY($tpl['o_x'], $tpl['o_y']); $this->tMargin = $tpl['o_tMargin']; $this->lMargin = $tpl['o_lMargin']; @@ -158,22 +167,23 @@ function endTemplate() { $this->h = $tpl['o_h']; $this->w = $tpl['o_w']; $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']); - + $this->FontFamily = $tpl['o_FontFamily']; $this->FontStyle = $tpl['o_FontStyle']; $this->FontSizePt = $tpl['o_FontSizePt']; $this->FontSize = $tpl['o_FontSize']; - + $fontkey = $this->FontFamily . $this->FontStyle; - if ($fontkey) - $this->CurrentFont =& $this->fonts[$fontkey]; - + if ($fontkey) { + $this->CurrentFont = & $this->fonts[$fontkey]; + } + return $this->tpl; } else { return false; } } - + /** * Use a Template in current Page or other Template * @@ -191,33 +201,38 @@ function endTemplate() { * @param int $_h The new height of the template * @retrun array The height and width of the template */ - function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { - if ($this->page <= 0) + public function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) + { + if ($this->page <= 0) { $this->error('You have to add a page first!'); - - if (!isset($this->tpls[$tplidx])) + } + + if (!isset($this->tpls[$tplidx])) { $this->error('Template does not exist!'); - + } + if ($this->_intpl) { - $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; + $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] = & $this->tpls[$tplidx]; } - - $tpl =& $this->tpls[$tplidx]; + + $tpl = & $this->tpls[$tplidx]; $w = $tpl['w']; $h = $tpl['h']; - - if ($_x == null) + + if ($_x == null) { $_x = 0; - if ($_y == null) + } + if ($_y == null) { $_y = 0; - + } + $_x += $tpl['x']; $_y += $tpl['y']; - + $wh = $this->getTemplateSize($tplidx, $_w, $_h); $_w = $wh['w']; $_h = $wh['h']; - + $tData = array( 'x' => $this->x, 'y' => $this->y, @@ -229,15 +244,15 @@ function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { 'ty' => ($this->h - $_y - $_h), 'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h) ); - - $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate + + $this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate $this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx)); $this->lastUsedTemplateData = $tData; - + return array('w' => $_w, 'h' => $_h); } - + /** * Get The calculated Size of a Template * @@ -248,139 +263,169 @@ function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { * @param int $_h The height of the template * @return array The height and width of the template */ - function getTemplateSize($tplidx, $_w = 0, $_h = 0) { - if (!isset($this->tpls[$tplidx])) + public function getTemplateSize($tplidx, $_w = 0, $_h = 0) + { + if (!isset($this->tpls[$tplidx])) { return false; + } - $tpl =& $this->tpls[$tplidx]; + $tpl = & $this->tpls[$tplidx]; $w = $tpl['w']; $h = $tpl['h']; - + if ($_w == 0 and $_h == 0) { $_w = $w; $_h = $h; } - if($_w == 0) + if ($_w == 0) { $_w = $_h * $w / $h; - if($_h == 0) + } + if ($_h == 0) { $_h = $_w * $h / $w; - + } + return array("w" => $_w, "h" => $_h); } - + /** * See FPDF/TCPDF-Documentation ;-) */ - public function SetFont($family, $style = '', $size = 0, $fontfile='', $subset='default', $out=true) { + public function SetFont($family, $style = '', $size = 0, $fontfile = '', $subset = 'default', $out = true) + { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); - return call_user_func_array(array('TCPDF', 'SetFont'), $args); + return call_user_func_array([TCPDF::class, 'SetFont'], $args); } - + parent::SetFont($family, $style, $size); - + $fontkey = $this->FontFamily . $this->FontStyle; - + if ($this->_intpl) { - $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey]; + $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] = & $this->fonts[$fontkey]; } else { - $this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey]; + $this->_res['page'][$this->page]['fonts'][$fontkey] = & $this->fonts[$fontkey]; } } - + /** * See FPDF/TCPDF-Documentation ;-) */ - function Image( - $file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false, - $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, - $hidden = false, $fitonpage = false, $alt = false, $altimgs = array() + public function Image( + $file, + $x = '', + $y = '', + $w = 0, + $h = 0, + $type = '', + $link = '', + $align = '', + $resize = false, + $dpi = 300, + $palign = '', + $ismask = false, + $imgmask = false, + $border = 0, + $fitbox = false, + $hidden = false, + $fitonpage = false, + $alt = false, + $altimgs = [] ) { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); - return call_user_func_array(array('TCPDF', 'Image'), $args); + return call_user_func_array([TCPDF::class, 'Image'], $args); } - + $ret = parent::Image($file, $x, $y, $w, $h, $type, $link); if ($this->_intpl) { - $this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file]; + $this->_res['tpl'][$this->tpl]['images'][$file] = & $this->images[$file]; } else { - $this->_res['page'][$this->page]['images'][$file] =& $this->images[$file]; + $this->_res['page'][$this->page]['images'][$file] = & $this->images[$file]; } - + return $ret; } - + /** * See FPDF-Documentation ;-) * * AddPage is not available when you're "in" a template. */ - function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) { + public function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) + { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); - return call_user_func_array(array('TCPDF', 'AddPage'), $args); + return call_user_func_array([TCPDF::class, 'AddPage'], $args); } - - if ($this->_intpl) + + if ($this->_intpl) { $this->Error('Adding pages in templates isn\'t possible!'); - + } + parent::AddPage($orientation, $format); } /** * Preserve adding Links in Templates ...won't work */ - function Link($x, $y, $w, $h, $link, $spaces = 0) { + public function Link($x, $y, $w, $h, $link, $spaces = 0) + { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); - return call_user_func_array(array('TCPDF', 'Link'), $args); + return call_user_func_array([TCPDF::class, 'Link'], $args); } - - if ($this->_intpl) + + if ($this->_intpl) { $this->Error('Using links in templates aren\'t possible!'); - + } + parent::Link($x, $y, $w, $h, $link); } - - function AddLink() { + + public function AddLink() + { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); - return call_user_func_array(array('TCPDF', 'AddLink'), $args); + return call_user_func_array([TCPDF::class, 'AddLink'], $args); } - - if ($this->_intpl) + + if ($this->_intpl) { $this->Error('Adding links in templates aren\'t possible!'); + } return parent::AddLink(); } - - function SetLink($link, $y = 0, $page = -1) { + + public function SetLink($link, $y = 0, $page = -1) + { if (is_subclass_of($this, 'TCPDF')) { $args = func_get_args(); - return call_user_func_array(array('TCPDF', 'SetLink'), $args); + return call_user_func_array([TCPDF::class, 'SetLink'], $args); } - - if ($this->_intpl) + + if ($this->_intpl) { $this->Error('Setting links in templates aren\'t possible!'); + } parent::SetLink($link, $y, $page); } - + /** * Private Method that writes the form xobjects */ - function _putformxobjects() { - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + public function _putformxobjects() + { + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; reset($this->tpls); - foreach($this->tpls AS $tplidx => $tpl) { - - $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + foreach ($this->tpls as $tplidx => $tpl) { + $p = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; $this->_newobj(); $this->tpls[$tplidx]['n'] = $this->n; - $this->_out('<<'.$filter.'/Type /XObject'); + $this->_out('<<' . $filter . '/Type /XObject'); $this->_out('/Subtype /Form'); $this->_out('/FormType 1'); - $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', + $this->_out(sprintf( + '/BBox [%.2F %.2F %.2F %.2F]', // llx $tpl['x'] * $this->k, // lly @@ -390,58 +435,64 @@ function _putformxobjects() { // ury ($tpl['h'] - $tpl['y']) * $this->k )); - + if ($tpl['x'] != 0 || $tpl['y'] != 0) { - $this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]', - -$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2 + $this->_out(sprintf( + '/Matrix [1 0 0 1 %.5F %.5F]', + -$tpl['x'] * $this->k * 2, + $tpl['y'] * $this->k * 2 )); } - + $this->_out('/Resources '); $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { $this->_out('/Font <<'); - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) + foreach ($this->_res['tpl'][$tplidx]['fonts'] as $font) { $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); + } $this->_out('>>'); } - if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || - isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) - { + if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || + isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { $this->_out('/XObject <<'); if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { - foreach($this->_res['tpl'][$tplidx]['images'] as $image) - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); + foreach ($this->_res['tpl'][$tplidx]['images'] as $image) { + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); + } } if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) + foreach ($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); + } } $this->_out('>>'); } $this->_out('>>'); - + $this->_out('/Length ' . strlen($p) . ' >>'); $this->_putstream($p); $this->_out('endobj'); } } - + /** * Overwritten to add _putformxobjects() after _putimages() * */ - function _putimages() { + public function _putimages() + { parent::_putimages(); $this->_putformxobjects(); } - - function _putxobjectdict() { + + public function _putxobjectdict() + { parent::_putxobjectdict(); - + if (count($this->tpls)) { - foreach($this->tpls as $tplidx => $tpl) { + foreach ($this->tpls as $tplidx => $tpl) { $this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n'])); } } @@ -450,7 +501,8 @@ function _putxobjectdict() { /** * Private Method */ - function _out($s) { + public function _out($s) + { if ($this->state == 2 && $this->_intpl) { $this->tpls[$this->tpl]['buffer'] .= $s . "\n"; } else { diff --git a/vendor/iio/libmergepdf/tcpdi/tcpdi.php b/vendor/karriere/pdf-merge/tcpi/tcpdi.php similarity index 80% rename from vendor/iio/libmergepdf/tcpdi/tcpdi.php rename to vendor/karriere/pdf-merge/tcpi/tcpdi.php index f210d42..ce9725a 100644 --- a/vendor/iio/libmergepdf/tcpdi/tcpdi.php +++ b/vendor/karriere/pdf-merge/tcpi/tcpdi.php @@ -1,4 +1,5 @@ current_filename = $filename; - if (!isset($this->parsers[$filename])) + if (!isset($this->parsers[$filename])) { $this->parsers[$filename] = $this->_getPdfParser($filename); - $this->current_parser =& $this->parsers[$filename]; + } + $this->current_parser = & $this->parsers[$filename]; $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); return $this->parsers[$filename]->getPageCount(); @@ -116,13 +122,15 @@ public function setSourceFile($filename) { * @param string $pdfdata The PDF file content * @return int number of available pages */ - public function setSourceData($pdfdata) { + public function setSourceData($pdfdata) + { $filename = uniqid('tcpdi-'); $this->current_filename = $filename; - if (!isset($this->parsers[$filename])) + if (!isset($this->parsers[$filename])) { $this->parsers[$filename] = new tcpdi_parser($pdfdata, $filename); - $this->current_parser =& $this->parsers[$filename]; + } + $this->current_parser = & $this->parsers[$filename]; $this->setPDFVersion(max($this->getPDFVersion(), $this->current_parser->getPDFVersion())); return $this->parsers[$filename]->getPageCount(); @@ -134,7 +142,8 @@ public function setSourceData($pdfdata) { * @param string $filename * @return fpdi_pdf_parser */ - protected function _getPdfParser($filename) { + public function _getPdfParser($filename) + { $data = file_get_contents($filename); return new tcpdi_parser($data, $filename); } @@ -144,7 +153,8 @@ protected function _getPdfParser($filename) { * * @return string */ - public function getPDFVersion() { + public function getPDFVersion() + { return $this->PDFVersion; } @@ -153,7 +163,8 @@ public function getPDFVersion() { * * @return string */ - public function setPDFVersion($version = '1.3') { + public function setPDFVersion($version = '1.3') + { $this->PDFVersion = $version; } @@ -163,7 +174,8 @@ public function setPDFVersion($version = '1.3') { * @param int $pageno pagenumber * @return int Index of imported page - to use with fpdf_tpl::useTemplate() */ - public function importPage($pageno, $boxName = '/CropBox') { + public function importPage($pageno, $boxName = '/CropBox') + { if ($this->_intpl) { return $this->error('Please import the desired pages before creating a new template.'); } @@ -172,14 +184,16 @@ public function importPage($pageno, $boxName = '/CropBox') { // check if page already imported $pageKey = $fn . '-' . ((int)$pageno) . $boxName; - if (isset($this->_importedPages[$pageKey])) + if (isset($this->_importedPages[$pageKey])) { return $this->_importedPages[$pageKey]; + } - $parser =& $this->parsers[$fn]; + $parser = & $this->parsers[$fn]; $parser->setPageno($pageno); - if (!in_array($boxName, $parser->availableBoxes)) + if (!in_array($boxName, $parser->availableBoxes)) { return $this->Error(sprintf('Unknown box: %s', $boxName)); + } $pageboxes = $parser->getPageBoxes($pageno, $this->k); @@ -190,13 +204,16 @@ public function importPage($pageno, $boxName = '/CropBox') { * TrimBox: Default -> CropBox * ArtBox: Default -> CropBox */ - if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) + if (!isset($pageboxes[$boxName]) && ($boxName == '/BleedBox' || $boxName == '/TrimBox' || $boxName == '/ArtBox')) { $boxName = '/CropBox'; - if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') + } + if (!isset($pageboxes[$boxName]) && $boxName == '/CropBox') { $boxName = '/MediaBox'; + } - if (!isset($pageboxes[$boxName])) + if (!isset($pageboxes[$boxName])) { return false; + } $this->lastUsedPageBox = $boxName; @@ -204,8 +221,8 @@ public function importPage($pageno, $boxName = '/CropBox') { $this->tpl++; $this->tpls[$this->tpl] = array(); - $tpl =& $this->tpls[$this->tpl]; - $tpl['parser'] =& $parser; + $tpl = & $this->tpls[$this->tpl]; + $tpl['parser'] = & $parser; $tpl['resources'] = $parser->getPageResources(); $tpl['buffer'] = $parser->getContent(); $tpl['box'] = $box; @@ -228,20 +245,21 @@ public function importPage($pageno, $boxName = '/CropBox') { $tpl['w'] = $steps % 2 == 0 ? $_w : $_h; $tpl['h'] = $steps % 2 == 0 ? $_h : $_w; - if ($angle < 0) + if ($angle < 0) { $angle += 360; + } $tpl['_rotationAngle'] = $angle * -1; } $this->_importedPages[$pageKey] = $this->tpl; - return $this->tpl; } - public function setPageFormatFromTemplatePage($pageno, $orientation) { + public function setPageFormatFromTemplatePage($pageno, $orientation) + { $fn = $this->current_filename; - $parser =& $this->parsers[$fn]; + $parser = & $this->parsers[$fn]; $parser->setPageno($pageno); $boxes = $parser->getPageBoxes($pageno, $this->k); foreach ($boxes as $name => $box) { @@ -254,7 +272,8 @@ public function setPageFormatFromTemplatePage($pageno, $orientation) { } /* Wrapper for AddPage() which tracks TOC pages to offset annotations later */ - public function AddPage($orientation='', $format='', $keepmargins=false, $tocpage=false) { + public function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) + { if ($this->inxobj) { // we are inside an XObject template return; @@ -266,7 +285,8 @@ public function AddPage($orientation='', $format='', $keepmargins=false, $tocpag } /* Wrapper for AddTOC() which tracks TOC position to offset annotations later */ - public function AddTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC', $style='', $color=array(0,0,0)) { + public function AddTOC($page = '', $numbersfont = '', $filler = '.', $toc_name = 'TOC', $style = '', $color = array(0,0,0)) + { if (!TCPDF_STATIC::empty_string($page)) { $this->_TOCpagenum = $page; } else { @@ -276,9 +296,10 @@ public function AddTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC', parent::AddTOC($page, $numbersfont, $filler, $toc_name, $style, $color); } - public function importAnnotations($pageno) { + public function importAnnotations($pageno) + { $fn = $this->current_filename; - $parser =& $this->parsers[$fn]; + $parser = & $this->parsers[$fn]; $parser->setPageno($pageno); $annots = $parser->getPageAnnotations(); @@ -297,7 +318,8 @@ public function importAnnotations($pageno) { } } - public function importAnnotation($annotation) { + public function importAnnotation($annotation) + { $fn = $this->current_filename; $old_id = $annotation[1]; $value = array(PDF_TYPE_OBJREF, $old_id, 0); @@ -310,6 +332,7 @@ public function importAnnotation($annotation) { $this->_importedAnnots[$this->page][] = $objid; } + /** * Get references to page annotations. * @param $n (int) page number @@ -318,44 +341,45 @@ public function importAnnotation($annotation) { * @author Nicola Asuni * @since 5.0.010 (2010-05-17) */ - protected function _getannotsrefs($n) { + protected function _getannotsrefs($n) + { if (!empty($this->_numTOCpages) && $n >= $this->_TOCpagenum) { // Offset page number to account for TOC being inserted before page containing annotations. $n -= $this->_numTOCpages; } - if (!(isset($this->_importedAnnots[$n]) OR isset($this->PageAnnots[$n]) OR ($this->sign AND isset($this->signature_data['cert_type'])))) { + if (!(isset($this->_importedAnnots[$n]) or isset($this->PageAnnots[$n]) or ($this->sign and isset($this->signature_data['cert_type'])))) { return ''; } $out = ' /Annots ['; if (isset($this->_importedAnnots[$n])) { foreach ($this->_importedAnnots[$n] as $key => $val) { - $out .= ' '.$val.' 0 R'; + $out .= ' ' . $val . ' 0 R'; } } if (isset($this->PageAnnots[$n])) { foreach ($this->PageAnnots[$n] as $key => $val) { if (!in_array($val['n'], $this->radio_groups)) { - $out .= ' '.$val['n'].' 0 R'; + $out .= ' ' . $val['n'] . ' 0 R'; } } // add radiobutton groups if (isset($this->radiobutton_groups[$n])) { foreach ($this->radiobutton_groups[$n] as $key => $data) { if (isset($data['n'])) { - $out .= ' '.$data['n'].' 0 R'; + $out .= ' ' . $data['n'] . ' 0 R'; } } } } - if ($this->sign AND ($n == $this->signature_appearance['page']) AND isset($this->signature_data['cert_type'])) { + if ($this->sign and ($n == $this->signature_appearance['page']) and isset($this->signature_data['cert_type'])) { // set reference for signature object - $out .= ' '.$this->sig_obj_id.' 0 R'; + $out .= ' ' . $this->sig_obj_id . ' 0 R'; } if (!empty($this->empty_signature_appearance)) { foreach ($this->empty_signature_appearance as $esa) { if ($esa['page'] == $n) { // set reference for empty signature objects - $out .= ' '.$esa['objid'].' 0 R'; + $out .= ' ' . $esa['objid'] . ' 0 R'; } } } @@ -363,17 +387,20 @@ protected function _getannotsrefs($n) { return $out; } + /** * Returns the last used page box * * @return string */ - public function getLastUsedPageBox() { + public function getLastUsedPageBox() + { return $this->lastUsedPageBox; } - public function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false) { + public function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false) + { if ($adjustPageSize == true && is_null($_x) && is_null($_y)) { $size = $this->getTemplateSize($tplidx, $_w, $_h); $orientation = $size['w'] > $size['h'] ? 'L' : 'P'; @@ -392,12 +419,13 @@ public function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $ /** * Private method, that rebuilds all needed objects of source files */ - public function _putimportedobjects() { + public function _putimportedobjects() + { if (is_array($this->parsers) && count($this->parsers) > 0) { - foreach($this->parsers AS $filename => $p) { - $this->current_parser =& $this->parsers[$filename]; + foreach ($this->parsers as $filename => $p) { + $this->current_parser = & $this->parsers[$filename]; if (isset($this->_obj_stack[$filename]) && is_array($this->_obj_stack[$filename])) { - while(($n = key($this->_obj_stack[$filename])) !== null) { + while (($n = key($this->_obj_stack[$filename])) !== null) { $nObj = $this->current_parser->getObjectVal($this->_obj_stack[$filename][$n][1]); $this->_newobj($this->_obj_stack[$filename][$n][0]); @@ -426,11 +454,12 @@ public function _putimportedobjects() { /** * Private Method that writes the form xobjects */ - public function _putformxobjects() { - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + public function _putformxobjects() + { + $filter = ($this->compress) ? '/Filter /FlateDecode ' : ''; reset($this->tpls); - foreach($this->tpls AS $tplidx => $tpl) { - $p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; + foreach ($this->tpls as $tplidx => $tpl) { + $p = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer']; $this->_newobj(); $cN = $this->n; // TCPDF/Protection: rem current "n" @@ -439,7 +468,8 @@ public function _putformxobjects() { $this->_out('/Subtype /Form'); $this->_out('/FormType 1'); - $this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]', + $this->_out(sprintf( + '/BBox [%.2F %.2F %.2F %.2F]', (isset($tpl['box']['llx']) ? $tpl['box']['llx'] : $tpl['x']) * $this->k, (isset($tpl['box']['lly']) ? $tpl['box']['lly'] : -$tpl['y']) * $this->k, (isset($tpl['box']['urx']) ? $tpl['box']['urx'] : $tpl['w'] + $tpl['x']) * $this->k, @@ -456,11 +486,11 @@ public function _putformxobjects() { $ty = -$tpl['box']['lly']; if ($tpl['_rotationAngle'] <> 0) { - $angle = $tpl['_rotationAngle'] * M_PI/180; - $c=cos($angle); - $s=sin($angle); + $angle = $tpl['_rotationAngle'] * M_PI / 180; + $c = cos($angle); + $s = sin($angle); - switch($tpl['_rotationAngle']) { + switch ($tpl['_rotationAngle']) { case -90: $tx = -$tpl['box']['lly']; $ty = $tpl['box']['urx']; @@ -484,35 +514,43 @@ public function _putformxobjects() { $ty *= $this->k; if ($c != 1 || $s != 0 || $tx != 0 || $ty != 0) { - $this->_out(sprintf('/Matrix [%.5F %.5F %.5F %.5F %.5F %.5F]', - $c, $s, -$s, $c, $tx, $ty + $this->_out(sprintf( + '/Matrix [%.5F %.5F %.5F %.5F %.5F %.5F]', + $c, + $s, + -$s, + $c, + $tx, + $ty )); } $this->_out('/Resources '); if (isset($tpl['resources'])) { - $this->current_parser =& $tpl['parser']; + $this->current_parser = & $tpl['parser']; $this->pdf_write_value($tpl['resources']); // "n" will be changed } else { $this->_out('<_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { $this->_out('/Font <<'); - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) + foreach ($this->_res['tpl'][$tplidx]['fonts'] as $font) { $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); + } $this->_out('>>'); } - if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || - isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) - { + if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || + isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { $this->_out('/XObject <<'); if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { - foreach($this->_res['tpl'][$tplidx]['images'] as $image) + foreach ($this->_res['tpl'][$tplidx]['images'] as $image) { $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); + } } if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) + foreach ($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); + } } $this->_out('>>'); } @@ -538,7 +576,8 @@ public function _putformxobjects() { /** * Rewritten to handle existing own defined objects */ - protected function _newobj($obj_id = false, $onlynewobj = false) { + public function _newobj($obj_id = false, $onlynewobj = false) + { if (!$obj_id) { $obj_id = ++$this->n; } @@ -592,9 +631,8 @@ public function pdf_write_value(&$value) } switch ($value[0]) { - case PDF_TYPE_TOKEN: - $this->_straightOut('/'.$value[1] . ' '); + $this->_straightOut('/' . $value[1] . ' '); break; case PDF_TYPE_NUMERIC: case PDF_TYPE_REAL: @@ -623,6 +661,8 @@ public function pdf_write_value(&$value) // A dictionary. $this->_straightOut('<<'); + reset($value[1]); + foreach ($value[1] as $k => $v) { $this->_straightOut($k . ' '); $this->pdf_write_value($v); @@ -635,7 +675,7 @@ public function pdf_write_value(&$value) // An indirect object reference // Fill the object stack if needed - $cpfn =& $this->current_parser->uniqueid; + $cpfn = & $this->current_parser->uniqueid; if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) { $this->_newobj(false, true); @@ -684,17 +724,18 @@ public function pdf_write_value(&$value) /** * Modified so not each call will add a newline to the output. */ - protected function _straightOut($s) { + public function _straightOut($s) + { if ($this->state == 2) { if ($this->inxobj) { // we are inside an XObject template $this->xobjects[$this->xobjid]['outdata'] .= $s; - } elseif ((!$this->InFooter) AND isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) { + } elseif ((!$this->InFooter) and isset($this->footerlen[$this->page]) and ($this->footerlen[$this->page] > 0)) { // puts data before page footer $pagebuff = $this->getPageBuffer($this->page); $page = substr($pagebuff, 0, -$this->footerlen[$this->page]); $footer = substr($pagebuff, -$this->footerlen[$this->page]); - $this->setPageBuffer($this->page, $page.$s.$footer); + $this->setPageBuffer($this->page, $page . $s . $footer); // update footer position $this->footerpos[$this->page] += strlen($s); } else { @@ -711,7 +752,8 @@ protected function _straightOut($s) { * rewritten to close opened parsers * */ - protected function _enddoc() { + public function _enddoc() + { parent::_enddoc(); $this->_closeParsers(); } @@ -719,8 +761,9 @@ protected function _enddoc() { /** * close all files opened by parsers */ - protected function _closeParsers() { - if ($this->state > 2 && count($this->parsers) > 0) { + public function _closeParsers() + { + if ($this->state > 2 && is_array($this->parsers) && count($this->parsers) > 0) { $this->cleanUp(); return true; } @@ -730,8 +773,9 @@ protected function _closeParsers() { /** * Removes cylced references and closes the file handles of the parser objects */ - public function cleanUp() { - foreach ($this->parsers as $k => $_){ + public function cleanUp() + { + foreach ($this->parsers as $k => $_) { $this->parsers[$k]->cleanUp(); $this->parsers[$k] = null; unset($this->parsers[$k]); @@ -739,14 +783,16 @@ public function cleanUp() { } // Functions from here on are taken from FPDI's fpdi2tcpdf_bridge.php to remove dependence on it - protected function _putstream($s, $n=0) { + public function _putstream($s, $n = 0) + { $this->_out($this->_getstream($s, $n)); } - protected function _getxobjectdict() { + public function _getxobjectdict() + { $out = parent::_getxobjectdict(); if (count($this->tpls)) { - foreach($this->tpls as $tplidx => $tpl) { + foreach ($this->tpls as $tplidx => $tpl) { $out .= sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']); } } @@ -760,10 +806,11 @@ protected function _getxobjectdict() { * @param string $s * @return string */ - protected function _unescape($s) { + public function _unescape($s) + { $out = ''; for ($count = 0, $n = strlen($s); $count < $n; $count++) { - if ($s[$count] != '\\' || $count == $n-1) { + if ($s[$count] != '\\' || $count == $n - 1) { $out .= $s[$count]; } else { switch ($s[++$count]) { @@ -788,8 +835,9 @@ protected function _unescape($s) { $out .= chr(0x0A); break; case "\r": - if ($count != $n-1 && $s[$count+1] == "\n") + if ($count != $n - 1 && $s[$count + 1] == "\n") { $count++; + } break; case "\n": break; @@ -797,14 +845,14 @@ protected function _unescape($s) { // Octal-Values if (ord($s[$count]) >= ord('0') && ord($s[$count]) <= ord('9')) { - $oct = ''. $s[$count]; + $oct = '' . $s[$count]; - if (ord($s[$count+1]) >= ord('0') && - ord($s[$count+1]) <= ord('9')) { + if (ord($s[$count + 1]) >= ord('0') && + ord($s[$count + 1]) <= ord('9')) { $oct .= $s[++$count]; - if (ord($s[$count+1]) >= ord('0') && - ord($s[$count+1]) <= ord('9')) { + if (ord($s[$count + 1]) >= ord('0') && + ord($s[$count + 1]) <= ord('9')) { $oct .= $s[++$count]; } } @@ -825,7 +873,8 @@ protected function _unescape($s) { * @param string $hex * @return string */ - public function hex2str($hex) { + public function hex2str($hex) + { return pack('H*', str_replace(array("\r", "\n", ' '), '', $hex)); } @@ -835,7 +884,8 @@ public function hex2str($hex) { * @param string $str * @return string */ - public function str2hex($str) { + public function str2hex($str) + { return current(unpack('H*', $str)); } } diff --git a/vendor/iio/libmergepdf/tcpdi/tcpdi_parser.php b/vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php similarity index 87% rename from vendor/iio/libmergepdf/tcpdi/tcpdi_parser.php rename to vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php index 2391934..5eb8c44 100644 --- a/vendor/iio/libmergepdf/tcpdi/tcpdi_parser.php +++ b/vendor/karriere/pdf-merge/tcpi/tcpdi_parser.php @@ -1,4 +1,5 @@ Error('Empty PDF data.'); } @@ -206,7 +222,8 @@ public function __construct($data, $uniqueid) { /** * Clean up when done, to free memory etc */ - public function cleanUp() { + public function cleanUp() + { unset($this->pdfdata); $this->pdfdata = ''; unset($this->objstreams); @@ -229,7 +246,8 @@ public function cleanUp() { * @public * @since 1.0.000 (2011-06-26) */ - public function getParsedData() { + public function getParsedData() + { return array($this->xref, $this->objects, $this->pages); } @@ -239,10 +257,12 @@ public function getParsedData() { * And reset the PDF Version used in FPDI if needed * @public */ - public function getPDFVersion() { + public function getPDFVersion() + { preg_match('/\d\.\d/', substr($this->pdfdata, 0, 16), $m); - if (isset($m[0])) + if (isset($m[0])) { $this->pdfVersion = $m[0]; + } return $this->pdfVersion; } @@ -250,15 +270,14 @@ public function getPDFVersion() { * Read all /Page(es) * */ - function readPages() { + public function readPages() + { $params = $this->getObjectVal($this->xref['trailer'][1]['/Root']); $objref = null; - if ($params && $params[1] && is_array($params[1][1])) { - foreach ($params[1][1] as $k=>$v) { - if ($k == '/Pages') { - $objref = $v; - break; - } + foreach ($params[1][1] as $k => $v) { + if ($k == '/Pages') { + $objref = $v; + break; } } if ($objref == null || $objref[0] !== PDF_TYPE_OBJREF) { @@ -294,7 +313,8 @@ function readPages() { * Read a single /Page element, recursing through /Kids if necessary * */ - private function readPage($page) { + private function readPage($page) + { if (isset($page[1][1]['/Kids'])) { // Nested pages! foreach ($page[1][1]['/Kids'][1] as $subref) { @@ -311,7 +331,8 @@ private function readPage($page) { * * @return int */ - function getPageCount() { + public function getPageCount() + { return $this->page_count; } @@ -323,7 +344,8 @@ function getPageCount() { * @protected * @since 1.0.000 (2011-05-24) */ - protected function getXrefData($offset=0, $xref=array()) { + protected function getXrefData($offset = 0, $xref = array()) + { if ($offset == 0) { // find last startxref if (preg_match('/.*[\r\n]startxref[\s\r\n]+([0-9]+)[\s\r\n]+%%EOF/is', $this->pdfdata, $matches) == 0) { @@ -369,7 +391,8 @@ protected function getXrefData($offset=0, $xref=array()) { * @protected * @since 1.0.000 (2011-06-20) */ - protected function decodeXref($startxref, $xref=array()) { + protected function decodeXref($startxref, $xref = array()) + { $this->xref_seen_offsets[] = $startxref; if (!isset($xref['xref_location'])) { $xref['xref_location'] = $startxref; @@ -385,7 +408,7 @@ protected function decodeXref($startxref, $xref=array()) { if ($matches[3][0] == 'n') { // create unique object index: [object number]_[generation number] $gen_num = intval($matches[2][0]); - $index = $obj_num.'_'.$gen_num; + $index = $obj_num . '_' . $gen_num; // check if object already exist if (!isset($xref['xref'][$obj_num][$gen_num])) { // store object offset position @@ -406,7 +429,7 @@ protected function decodeXref($startxref, $xref=array()) { // get trailer data if (preg_match('/trailer[\s]*<<(.*)>>[\s\r\n]+(?:[%].*[\r\n]+)*startxref[\s\r\n]+/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $xoffset) > 0) { $trailer_data = $matches[1][0]; - if (!isset($xref['trailer']) OR empty($xref['trailer'])) { + if (!isset($xref['trailer']) or empty($xref['trailer'])) { // get only the last updated version $xref['trailer'] = array(); $xref['trailer'][0] = PDF_TYPE_DICTIONARY; @@ -453,7 +476,8 @@ protected function decodeXref($startxref, $xref=array()) { * @protected * @since 1.0.003 (2013-03-16) */ - protected function decodeXrefStream($startxref, $xref=array()) { + protected function decodeXrefStream($startxref, $xref = array()) + { // try to read Cross-Reference Stream list($xrefobj, $unused) = $this->getRawObject($startxref); $xrefcrs = $this->getIndirectObject($xrefobj[1], $startxref, true); @@ -464,7 +488,7 @@ protected function decodeXrefStream($startxref, $xref=array()) { if (!isset($xref['xref'])) { $xref['xref'] = array(); } - if (!isset($xref['trailer']) OR empty($xref['trailer'])) { + if (!isset($xref['trailer']) or empty($xref['trailer'])) { // get only the last updated version $xref['trailer'] = array(); $xref['trailer'][0] = PDF_TYPE_DICTIONARY; @@ -478,35 +502,35 @@ protected function decodeXrefStream($startxref, $xref=array()) { $keys = array_keys($sarr); $columns = 1; // Default as per PDF 32000-1:2008. $predictor = 1; // Default as per PDF 32000-1:2008. - foreach ($keys as $k=>$key) { + foreach ($keys as $k => $key) { $v = $sarr[$key]; - if (($key == '/Type') AND ($v[0] == PDF_TYPE_TOKEN AND ($v[1] == 'XRef'))) { + if (($key == '/Type') and ($v[0] == PDF_TYPE_TOKEN and ($v[1] == 'XRef'))) { $valid_crs = true; - } elseif (($key == '/Index') AND ($v[0] == PDF_TYPE_ARRAY AND count($v[1]) >= 2)) { + } elseif (($key == '/Index') and ($v[0] == PDF_TYPE_ARRAY and count($v[1]) >= 2)) { // first object number in the subsection $index_first = intval($v[1][0][1]); // number of entries in the subsection $index_entries = intval($v[1][1][1]); - } elseif (($key == '/Prev') AND ($v[0] == PDF_TYPE_NUMERIC)) { + } elseif (($key == '/Prev') and ($v[0] == PDF_TYPE_NUMERIC)) { // get previous xref offset $prevxref = intval($v[1]); - } elseif (($key == '/W') AND ($v[0] == PDF_TYPE_ARRAY)) { + } elseif (($key == '/W') and ($v[0] == PDF_TYPE_ARRAY)) { // number of bytes (in the decoded stream) of the corresponding field $wb = array(); $wb[0] = intval($v[1][0][1]); $wb[1] = intval($v[1][1][1]); $wb[2] = intval($v[1][2][1]); - } elseif (($key == '/DecodeParms') AND ($v[0] == PDF_TYPE_DICTIONARY)) { + } elseif (($key == '/DecodeParms') and ($v[0] == PDF_TYPE_DICTIONARY)) { $decpar = $v[1]; foreach ($decpar as $kdc => $vdc) { - if (($kdc == '/Columns') AND ($vdc[0] == PDF_TYPE_NUMERIC)) { + if (($kdc == '/Columns') and ($vdc[0] == PDF_TYPE_NUMERIC)) { $columns = intval($vdc[1]); - } elseif (($kdc == '/Predictor') AND ($vdc[0] == PDF_TYPE_NUMERIC)) { + } elseif (($kdc == '/Predictor') and ($vdc[0] == PDF_TYPE_NUMERIC)) { $predictor = intval($vdc[1]); } } } elseif ($filltrailer) { - switch($key) { + switch ($key) { case '/Size': case '/Root': case '/Info': @@ -520,7 +544,7 @@ protected function decodeXrefStream($startxref, $xref=array()) { } // decode data $obj_num = 0; - if ($valid_crs AND isset($xrefcrs[1][3][0])) { + if ($valid_crs and isset($xrefcrs[1][3][0])) { // number of bytes in a row $rowlen = ($columns + 1); // convert the stream into an array of integers @@ -530,7 +554,7 @@ protected function decodeXrefStream($startxref, $xref=array()) { // initialize decoded array $ddata = array(); // initialize first row with zeros - $prev_row = array_fill (0, $rowlen, 0); + $prev_row = array_fill(0, $rowlen, 0); // for each row apply PNG unpredictor foreach ($sdata as $k => $row) { // initialize new row @@ -540,7 +564,7 @@ protected function decodeXrefStream($startxref, $xref=array()) { $predictor = (10 + $row[0]); } // for each byte on the row - for ($i=1; $i<=$columns; ++$i) { + for ($i = 1; $i <= $columns; ++$i) { if (!isset($row[$i])) { // No more data in this row - we're done here. break; @@ -644,7 +668,7 @@ protected function decodeXrefStream($startxref, $xref=array()) { } case 1: { // (n) objects that are in use but are not compressed // create unique object index: [object number]_[generation number] - $index = $obj_num.'_'.$row[2]; + $index = $obj_num . '_' . $row[2]; // check if object already exist if (!isset($xref['xref'][$obj_num][$row[2]])) { // store object offset position @@ -681,7 +705,8 @@ protected function decodeXrefStream($startxref, $xref=array()) { * @return string Steam content * @protected */ - protected function getRawStream($offset, $length) { + protected function getRawStream($offset, $length) + { $offset += strspn($this->pdfdata, "\x00\x09\x0a\x0c\x0d\x20", $offset); $offset += 6; // "stream" $offset += strspn($this->pdfdata, "\x20", $offset); @@ -691,7 +716,7 @@ protected function getRawStream($offset, $length) { $obj[] = PDF_TYPE_STREAM; $obj[] = substr($this->pdfdata, $offset, $length); - return array($obj, $offset+$length); + return array($obj, $offset + $length); } /** @@ -701,9 +726,10 @@ protected function getRawStream($offset, $length) { * @protected * @since 1.0.000 (2011-06-20) */ - protected function getRawObject($offset=0, $data=null) { + protected function getRawObject($offset = 0, $data = null) + { if ($data == null) { - $data =& $this->pdfdata; + $data = & $this->pdfdata; } $objtype = ''; // object type to be returned $objval = ''; // object value to be returned @@ -791,11 +817,11 @@ protected function getRawObject($offset=0, $data=null) { } case '<': // \x3C LESS-THAN SIGN case '>': { // \x3E GREATER-THAN SIGN - if (isset($data[($offset + 1)]) AND ($data[($offset + 1)] == $char)) { + if (isset($data[($offset + 1)]) and ($data[($offset + 1)] == $char)) { // dictionary object $objtype = PDF_TYPE_DICTIONARY; if ($char == '<') { - list ($objval, $offset) = $this->getDictValue($offset, $data); + list($objval, $offset) = $this->getDictValue($offset, $data); } else { $objtype = '>>'; $offset += 2; @@ -805,7 +831,7 @@ protected function getRawObject($offset=0, $data=null) { $objtype = PDF_TYPE_HEX; ++$offset; // The "Panose" entry in the FontDescriptor Style dict seems to have hex bytes separated by spaces. - if (($char == '<') AND (preg_match('/^([0-9A-Fa-f ]+)[>]/iU', substr($data, $offset), $matches) == 1)) { + if (($char == '<') and (preg_match('/^([0-9A-Fa-f ]+)[>]/iU', substr($data, $offset), $matches) == 1)) { $objval = $matches[1]; $offset += strlen($matches[0]); unset($matches); @@ -814,7 +840,7 @@ protected function getRawObject($offset=0, $data=null) { break; } default: { - $frag = $data[$offset] . @$data[$offset+1] . @$data[$offset+2] . @$data[$offset+3]; + $frag = $data[$offset] . @$data[$offset + 1] . @$data[$offset + 2] . @$data[$offset + 3]; switch ($frag) { case 'endo': // indirect object @@ -857,8 +883,8 @@ protected function getRawObject($offset=0, $data=null) { } elseif ($matches[3] == 'obj') { // object start $objtype = PDF_TYPE_OBJECT; - $objval = intval($matches[1]).'_'.intval($matches[2]); - $offset += strlen ($matches[0]); + $objval = intval($matches[1]) . '_' . intval($matches[2]); + $offset += strlen($matches[0]); } } elseif (($numlen = strspn($data, '+-.0123456789', $offset)) > 0) { // numeric object @@ -883,19 +909,20 @@ protected function getRawObject($offset=0, $data=null) { } return array($obj, $offset); } - private function getDictValue($offset, &$data) { + private function getDictValue($offset, &$data) + { $objval = array(); // Extract dict from data. - $i=1; + $i = 1; $dict = ''; $offset += 2; do { - if ($data[$offset] == '>' && $data[$offset+1] == '>') { + if ($data[$offset] == '>' && $data[$offset + 1] == '>') { $i--; $dict .= '>>'; $offset += 2; - } else if ($data[$offset] == '<' && $data[$offset+1] == '<') { + } elseif ($data[$offset] == '<' && $data[$offset + 1] == '<') { $i++; $dict .= '<<'; $offset += 2; @@ -903,7 +930,7 @@ private function getDictValue($offset, &$data) { $dict .= $data[$offset]; $offset++; } - } while ($i>0); + } while ($i > 0); // Now that we have just the dict, parse it. $dictoffset = 0; @@ -914,7 +941,7 @@ private function getDictValue($offset, &$data) { break; } list($element, $dictoffset) = $this->getRawObject($eloffset, $dict); - $objval['/'.$key[1]] = $element; + $objval['/' . $key[1]] = $element; unset($key); unset($element); } while (true); @@ -931,13 +958,14 @@ private function getDictValue($offset, &$data) { * @protected * @since 1.0.000 (2011-05-24) */ - protected function getIndirectObject($obj_ref, $offset=0, $decoding=true) { + protected function getIndirectObject($obj_ref, $offset = 0, $decoding = true) + { $obj = explode('_', $obj_ref); - if (($obj === false) OR (count($obj) != 2)) { - $this->Error('Invalid object reference: '.$obj); + if (($obj === false) or (count($obj) != 2)) { + $this->Error('Invalid object reference: ' . $obj); return; } - $objref = $obj[0].' '.$obj[1].' obj'; + $objref = $obj[0] . ' ' . $obj[1] . ' obj'; if (strpos($this->pdfdata, $objref, $offset) != $offset) { // an indirect reference to an undefined object shall be considered a reference to the null object @@ -949,9 +977,9 @@ protected function getIndirectObject($obj_ref, $offset=0, $decoding=true) { $objdata = array(); $i = 0; // object main index do { - if (($i > 0) AND (isset($objdata[($i - 1)][0])) AND ($objdata[($i - 1)][0] == PDF_TYPE_DICTIONARY) AND array_key_exists('/Length', $objdata[($i - 1)][1])) { + if (($i > 0) and (isset($objdata[($i - 1)][0])) and ($objdata[($i - 1)][0] == PDF_TYPE_DICTIONARY) and array_key_exists('/Length', $objdata[($i - 1)][1])) { // Stream - get using /Length in stream's dict - $lengthobj = $objdata[($i-1)][1]['/Length']; + $lengthobj = $objdata[($i - 1)][1]['/Length']; if ($lengthobj[0] === PDF_TYPE_OBJREF) { $lengthobj = $this->getObjectVal($lengthobj); if ($lengthobj[0] === PDF_TYPE_OBJECT) { @@ -965,7 +993,7 @@ protected function getIndirectObject($obj_ref, $offset=0, $decoding=true) { list($element, $offset) = $this->getRawObject($offset); } // decode stream using stream's dictionary information - if ($decoding AND ($element[0] == PDF_TYPE_STREAM) AND (isset($objdata[($i - 1)][0])) AND ($objdata[($i - 1)][0] == PDF_TYPE_DICTIONARY)) { + if ($decoding and ($element[0] == PDF_TYPE_STREAM) and (isset($objdata[($i - 1)][0])) and ($objdata[($i - 1)][0] == PDF_TYPE_DICTIONARY)) { $element[3] = $this->decodeStream($objdata[($i - 1)][1], $element[1]); } $objdata[$i] = $element; @@ -984,7 +1012,8 @@ protected function getIndirectObject($obj_ref, $offset=0, $decoding=true) { * @public * @since 1.0.000 (2011-06-26) */ - public function getObjectVal($obj) { + public function getObjectVal($obj) + { if ($obj[0] == PDF_TYPE_OBJREF) { if (strpos($obj[1], '_') !== false) { $key = explode('_', $obj[1]); @@ -992,7 +1021,7 @@ public function getObjectVal($obj) { $key = array($obj[1], $obj[2]); } - $ret = array(0=>PDF_TYPE_OBJECT, 'obj'=>$key[0], 'gen'=>$key[1]); + $ret = array(0 => PDF_TYPE_OBJECT, 'obj' => $key[0], 'gen' => $key[1]); // reference to indirect object $object = null; @@ -1001,7 +1030,7 @@ public function getObjectVal($obj) { $object = $this->objects[$key[0]][$key[1]]; } elseif (($offset = $this->findObjectOffset($key)) !== false) { // parse new object - $this->objects[$key[0]][$key[1]] = $this->getIndirectObject($key[0].'_'.$key[1], $offset, false); + $this->objects[$key[0]][$key[1]] = $this->getIndirectObject($key[0] . '_' . $key[1], $offset, false); $object = $this->objects[$key[0]][$key[1]]; } elseif (($key[1] == 0) && isset($this->objstreamobjs[$key[0]])) { // Object is in an object stream @@ -1009,7 +1038,8 @@ public function getObjectVal($obj) { $objs = $streaminfo[0]; if (!isset($this->objstreams[$objs[0]][$objs[1]])) { // Fetch and decode object stream - $offset = $this->findObjectOffset($objs);; + $offset = $this->findObjectOffset($objs); + ; $objstream = $this->getObjectVal(array(PDF_TYPE_OBJREF, $objs[0], $objs[1])); $decoded = $this->decodeStream($objstream[1][1], $objstream[2][1]); $this->objstreams[$objs[0]][$objs[1]] = $decoded[0]; // Store just the data, in case we need more from this objstream @@ -1036,7 +1066,8 @@ public function getObjectVal($obj) { * Extract object stream to find out what it contains. * */ - function extractObjectStream($key) { + public function extractObjectStream($key) + { $objref = array(PDF_TYPE_OBJREF, $key[0], $key[1]); $obj = $this->getObjectVal($objref); if ($obj[0] !== PDF_TYPE_STREAM || !isset($obj[1][1]['/First'][1])) { @@ -1046,9 +1077,9 @@ function extractObjectStream($key) { $stream = $this->decodeStream($obj[1][1], $obj[2][1]);// Decode object stream, as we need the first bit $first = intval($obj[1][1]['/First'][1]); $ints = preg_split('/\s/', substr($stream[0], 0, $first)); // Get list of object / offset pairs - for ($j=1; $jobjstreamobjs[$ints[$j-1]] = array($key, $ints[$j]+$first); + $this->objstreamobjs[$ints[$j - 1]] = array($key, $ints[$j] + $first); } } @@ -1061,12 +1092,13 @@ function extractObjectStream($key) { * Find all object offsets. Saves having to scour the file multiple times. * @private */ - private function findObjectOffsets() { + private function findObjectOffsets() + { $this->objoffsets = array(); if (preg_match_all('/(*ANYCRLF)^[\s]*([0-9]+)[\s]+([0-9]+)[\s]+obj/im', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE) >= 1) { $i = 0; $laststreamend = 0; - foreach($matches[0] as $match) { + foreach ($matches[0] as $match) { $offset = $match[1] + strspn($match[0], "\x00\x09\x0a\x0c\x0d\x20"); if ($offset < $laststreamend) { // Contained within another stream, skip it. @@ -1095,8 +1127,9 @@ private function findObjectOffsets() { * @return int Offset of the object in $this->pdfdata. * @private */ - private function findObjectOffset($key) { - $objref = $key[0].' '.$key[1].' obj'; + private function findObjectOffset($key) + { + $objref = $key[0] . ' ' . $key[1] . ' obj'; if (isset($this->xref['xref'][$key[0]][$key[1]])) { $offset = $this->xref['xref'][$key[0]][$key[1]]; if (strpos($this->pdfdata, $objref, $offset) === $offset) { @@ -1120,7 +1153,8 @@ private function findObjectOffset($key) { * @protected * @since 1.0.000 (2011-06-22) */ - protected function decodeStream($sdic, $stream) { + protected function decodeStream($sdic, $stream) + { // get stream lenght and filters $slength = strlen($stream); if ($slength <= 0) { @@ -1129,7 +1163,7 @@ protected function decodeStream($sdic, $stream) { $filters = array(); foreach ($sdic as $k => $v) { if ($v[0] == PDF_TYPE_TOKEN) { - if (($k == '/Length') AND ($v[0] == PDF_TYPE_NUMERIC)) { + if (($k == '/Length') and ($v[0] == PDF_TYPE_NUMERIC)) { // get declared stream lenght $declength = intval($v[1]); if ($declength < $slength) { @@ -1170,11 +1204,12 @@ protected function decodeStream($sdic, $stream) { * * @param int $pageno Pagenumber to use */ - public function setPageno($pageno) { + public function setPageno($pageno) + { $pageno = ((int) $pageno) - 1; if ($pageno < 0 || $pageno >= $this->getPageCount()) { - $this->error("Pagenumber is wrong! (Requested $pageno, max ".$this->getPageCount().")"); + $this->error("Pagenumber is wrong! (Requested $pageno, max " . $this->getPageCount() . ")"); } $this->pageno = $pageno; @@ -1185,7 +1220,8 @@ public function setPageno($pageno) { * * @return array */ - public function getPageResources() { + public function getPageResources() + { return $this->_getPageResources($this->pages[$this->pageno]); } @@ -1194,25 +1230,27 @@ public function getPageResources() { * * @param array $obj Array of pdf-data */ - private function _getPageResources ($obj) { // $obj = /Page + private function _getPageResources($obj) // $obj = /Page + { $obj = $this->getObjectVal($obj); - // If the current object has a resources // dictionary associated with it, we use // it. Otherwise, we move back to its // parent object. - if (isset ($obj[1][1]['/Resources'])) { + if (isset($obj[1][1]['/Resources'])) { $res = $obj[1][1]['/Resources']; - if ($res[0] == PDF_TYPE_OBJECT) + if ($res[0] == PDF_TYPE_OBJECT) { return $res[1]; + } return $res; } else { - if (!isset ($obj[1][1]['/Parent'])) { + if (!isset($obj[1][1]['/Parent'])) { return false; } else { $res = $this->_getPageResources($obj[1][1]['/Parent']); - if ($res[0] == PDF_TYPE_OBJECT) + if ($res[0] == PDF_TYPE_OBJECT) { return $res[1]; + } return $res; } } @@ -1223,7 +1261,8 @@ private function _getPageResources ($obj) { // $obj = /Page * * @return array */ - public function getPageAnnotations() { + public function getPageAnnotations() + { return $this->_getPageAnnotations($this->pages[$this->pageno]); } @@ -1232,25 +1271,26 @@ public function getPageAnnotations() { * * @param array $obj Array of pdf-data */ - private function _getPageAnnotations ($obj) { // $obj = /Page + private function _getPageAnnotations($obj) // $obj = /Page + { $obj = $this->getObjectVal($obj); - // If the current object has an annotations // dictionary associated with it, we use // it. Otherwise, we move back to its // parent object. - if (isset ($obj[1][1]['/Annots'])) { + if (isset($obj[1][1]['/Annots'])) { $annots = $obj[1][1]['/Annots']; } else { - if (!isset ($obj[1][1]['/Parent'])) { + if (!isset($obj[1][1]['/Parent'])) { return false; } else { $annots = $this->_getPageAnnotations($obj[1][1]['/Parent']); } } - if ($annots[0] == PDF_TYPE_OBJREF) + if ($annots[0] == PDF_TYPE_OBJREF) { return $this->getObjectVal($annots); + } return $annots; } @@ -1262,12 +1302,13 @@ private function _getPageAnnotations ($obj) { // $obj = /Page * * @return string */ - public function getContent() { + public function getContent() + { $buffer = ''; if (isset($this->pages[$this->pageno][1][1]['/Contents'])) { $contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']); - foreach($contents AS $tmp_content) { + foreach ($contents as $tmp_content) { $buffer .= $this->_rebuildContentStream($tmp_content) . ' '; } } @@ -1282,7 +1323,8 @@ public function getContent() { * @param array $content_ref * @return array */ - private function _getPageContent($content_ref) { + private function _getPageContent($content_ref) + { $contents = array(); if ($content_ref[0] == PDF_TYPE_OBJREF) { @@ -1293,8 +1335,8 @@ private function _getPageContent($content_ref) { $contents[] = $content; } } elseif ($content_ref[0] == PDF_TYPE_ARRAY) { - foreach ($content_ref[1] AS $tmp_content_ref) { - $contents = array_merge($contents,$this->_getPageContent($tmp_content_ref)); + foreach ($content_ref[1] as $tmp_content_ref) { + $contents = array_merge($contents, $this->_getPageContent($tmp_content_ref)); } } @@ -1308,7 +1350,8 @@ private function _getPageContent($content_ref) { * @param array $obj * @return string */ - private function _rebuildContentStream($obj) { + private function _rebuildContentStream($obj) + { $filters = array(); if (isset($obj[1][1]['/Filter'])) { @@ -1328,7 +1371,7 @@ private function _rebuildContentStream($obj) { $stream = $obj[2][1]; - foreach ($filters AS $_filter) { + foreach ($filters as $_filter) { $stream = $this->FilterDecoders->decodeFilter($_filter[1], $stream); } @@ -1345,11 +1388,13 @@ private function _rebuildContentStream($obj) { * @param float Scale factor from user space units to points * @return array */ - public function getPageBox($page, $box_index, $k) { + public function getPageBox($page, $box_index, $k) + { $page = $this->getObjectVal($page); $box = null; - if (isset($page[1][1][$box_index])) - $box =& $page[1][1][$box_index]; + if (isset($page[1][1][$box_index])) { + $box = & $page[1][1][$box_index]; + } if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) { $tmp_box = $this->getObjectVal($box); @@ -1357,7 +1402,7 @@ public function getPageBox($page, $box_index, $k) { } if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { - $b =& $box[1]; + $b = & $box[1]; return array('x' => $b[0][1] / $k, 'y' => $b[1][1] / $k, 'w' => abs($b[0][1] - $b[2][1]) / $k, @@ -1367,7 +1412,7 @@ public function getPageBox($page, $box_index, $k) { 'urx' => max($b[0][1], $b[2][1]) / $k, 'ury' => max($b[1][1], $b[3][1]) / $k, ); - } elseif (!isset ($page[1][1]['/Parent'])) { + } elseif (!isset($page[1][1]['/Parent'])) { return false; } else { return $this->getPageBox($this->getObjectVal($page[1][1]['/Parent']), $box_index, $k); @@ -1381,7 +1426,8 @@ public function getPageBox($page, $box_index, $k) { * @param float Scale factor from user space units to points * @return array */ - public function getPageBoxes($pageno, $k) { + public function getPageBoxes($pageno, $k) + { return $this->_getPageBoxes($this->pages[$pageno - 1], $k); } @@ -1391,10 +1437,11 @@ public function getPageBoxes($pageno, $k) { * @param array a /Page * @return array */ - private function _getPageBoxes($page, $k) { + private function _getPageBoxes($page, $k) + { $boxes = array(); - foreach($this->availableBoxes AS $box) { + foreach ($this->availableBoxes as $box) { if ($_box = $this->getPageBox($page, $box, $k)) { $boxes[$box] = $_box; } @@ -1409,24 +1456,29 @@ private function _getPageBoxes($page, $k) { * @param integer $pageno * @return array */ - public function getPageRotation($pageno) { + public function getPageRotation($pageno) + { return $this->_getPageRotation($this->pages[$pageno - 1]); } - private function _getPageRotation($obj) { // $obj = /Page + private function _getPageRotation($obj) // $obj = /Page + { $obj = $this->getObjectVal($obj); - if (isset ($obj[1][1]['/Rotate'])) { + if (isset($obj[1][1]['/Rotate'])) { $res = $this->getObjectVal($obj[1][1]['/Rotate']); - if ($res[0] == PDF_TYPE_OBJECT) + if ($res[0] == PDF_TYPE_OBJECT) { return $res[1]; + } return $res; } else { - if (!isset ($obj[1][1]['/Parent'])) { + if (!isset($obj[1][1]['/Parent'])) { return false; } else { - $res = (array)$this->_getPageRotation($obj[1][1]['/Parent']); - if ($res[0] == PDF_TYPE_OBJECT) + $res = $this->_getPageRotation($obj[1][1]['/Parent']); + + if (is_array($res) && $res[0] == PDF_TYPE_OBJECT) { return $res[1]; + } return $res; } } @@ -1438,13 +1490,9 @@ private function _getPageRotation($obj) { // $obj = /Page * @public * @since 1.0.000 (2011-05-23) */ - public function Error($msg) { + public function Error($msg) + { // exit program and print error - die("TCPDI_PARSER ERROR [{$this->uniqueid}]: ".$msg); + die("TCPDI_PARSER ERROR [{$this->uniqueid}]: " . $msg); } - } // END OF TCPDF_PARSER CLASS - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/karriere/pdf-merge/tests/PdfMergeTest.php b/vendor/karriere/pdf-merge/tests/PdfMergeTest.php new file mode 100644 index 0000000..8f11c39 --- /dev/null +++ b/vendor/karriere/pdf-merge/tests/PdfMergeTest.php @@ -0,0 +1,93 @@ +pdfMerge = new PdfMerge(); + $this->dummyFile = __DIR__ . '/files/dummy.pdf'; + $this->outputFile = __DIR__ . '/output.pdf'; +}); + +it('returns PDF instance', function () { + expect($this->pdfMerge)->getPdf()->toBeInstanceOf(TCPDI::class); +}); + +it('throws exception when trying to add not existing page', function () { + ($this->pdfMerge)->add('/foo.pdf'); +})->throws(FileNotFoundException::class); + +it('checks if file was already added', function () { + expect($this->pdfMerge)->contains($this->dummyFile)->toBeFalse(); + $this->pdfMerge->add($this->dummyFile); + expect($this->pdfMerge)->contains($this->dummyFile)->toBeTrue(); +}); + +it('resets files to merge', function () { + $this->pdfMerge->add($this->dummyFile); + $this->pdfMerge->reset(); + + expect($this->pdfMerge)->contains($this->dummyFile)->toBeFalse(); +}); + +it('generates merged file', function () { + $this->pdfMerge->add($this->dummyFile); + $this->pdfMerge->add($this->dummyFile); + + expect($this->pdfMerge)->merge($this->outputFile)->toBeEmptyString(); + expect($this->outputFile)->toEqualPDF(__DIR__ . '/files/expected/output.pdf'); +}); + +it('merges portrait and landscape files', function () { + $this->pdfMerge->add($this->dummyFile); + $this->pdfMerge->add(__DIR__ . '/files/dummy_landscape.pdf'); + + expect($this->pdfMerge)->merge($this->outputFile)->toBeEmptyString(); + expect($this->outputFile)->toEqualPDF(__DIR__ . '/files/expected/output_mixed_orientation.pdf'); +}); + +it('adds header to merged PDF', function () { + copy(__DIR__ . '/files/header_logo.jpg', K_PATH_IMAGES . 'header_logo.png'); + + $pdfMerge = new PdfMerge(new HeaderConfig(imagePath: 'header_logo.png', logoWidthMM: 20, title: 'Test')); + + $pdfMerge->add($this->dummyFile); + $pdfMerge->add($this->dummyFile); + + expect($pdfMerge)->merge($this->outputFile)->toBeEmptyString(); + expect($this->outputFile)->toEqualPDF(__DIR__ . '/files/expected/output_with_header.pdf'); +}); + +it('adds full header and full footer to merged PDF', function () { + copy(__DIR__ . '/files/header_logo.jpg', K_PATH_IMAGES . 'header_logo.png'); + + $pdfMerge = new PdfMerge( + new HeaderConfig( + imagePath: 'header_logo.png', + logoWidthMM: 20, + title: 'Header', + text: 'This is a header text', + textColor: new RGB(200, 200, 200), + lineColor: new RGB(0, 0, 255), + ), + new FooterConfig( + textColor: new RGB(100, 100, 100), + lineColor: new RGB(255, 0, 0), + margin: 20, + ), + ); + + $pdfMerge->add($this->dummyFile); + $pdfMerge->add($this->dummyFile); + + expect($pdfMerge)->merge($this->outputFile)->toBeEmptyString(); + expect($this->outputFile)->toEqualPDF(__DIR__ . '/files/expected/output_with_header_and_footer.pdf'); +}); + +it('throws exception when no files were added', function () { + $this->pdfMerge->merge('/foo.pdf'); +})->throws(NoFilesDefinedException::class); diff --git a/vendor/karriere/pdf-merge/tests/Pest.php b/vendor/karriere/pdf-merge/tests/Pest.php new file mode 100644 index 0000000..45a2057 --- /dev/null +++ b/vendor/karriere/pdf-merge/tests/Pest.php @@ -0,0 +1,22 @@ +extend('toEqualPDF', function (string $expected) { + if (filesize($expected) !== filesize($this->value)) { + throw new Exception('The file size of the PDF does not equal the file size from the expected output.'); + } + + $pdf = new TCPDI(); + + $expectedPageCount = $pdf->setSourceFile($expected); + $actualPageCount = $pdf->setSourceFile($this->value); + + if ($expectedPageCount !== $actualPageCount) { + throw new Exception('The page count of the PDF does not equal the page count from the expected output.'); + } + + return $this; +}); + +expect()->extend('toBeEmptyString', function () { + return expect($this->value)->toEqual(''); +}); diff --git a/vendor/karriere/pdf-merge/tests/files/dummy.pdf b/vendor/karriere/pdf-merge/tests/files/dummy.pdf new file mode 100644 index 0000000..c361b52 Binary files /dev/null and b/vendor/karriere/pdf-merge/tests/files/dummy.pdf differ diff --git a/vendor/karriere/pdf-merge/tests/files/dummy_landscape.pdf b/vendor/karriere/pdf-merge/tests/files/dummy_landscape.pdf new file mode 100644 index 0000000..e058185 Binary files /dev/null and b/vendor/karriere/pdf-merge/tests/files/dummy_landscape.pdf differ diff --git a/vendor/karriere/pdf-merge/tests/files/expected/output.pdf b/vendor/karriere/pdf-merge/tests/files/expected/output.pdf new file mode 100644 index 0000000..9cf3f63 Binary files /dev/null and b/vendor/karriere/pdf-merge/tests/files/expected/output.pdf differ diff --git a/vendor/karriere/pdf-merge/tests/files/expected/output_mixed_orientation.pdf b/vendor/karriere/pdf-merge/tests/files/expected/output_mixed_orientation.pdf new file mode 100644 index 0000000..e20c9c7 Binary files /dev/null and b/vendor/karriere/pdf-merge/tests/files/expected/output_mixed_orientation.pdf differ diff --git a/vendor/karriere/pdf-merge/tests/files/expected/output_with_header.pdf b/vendor/karriere/pdf-merge/tests/files/expected/output_with_header.pdf new file mode 100644 index 0000000..c36a76a Binary files /dev/null and b/vendor/karriere/pdf-merge/tests/files/expected/output_with_header.pdf differ diff --git a/vendor/karriere/pdf-merge/tests/files/expected/output_with_header_and_footer.pdf b/vendor/karriere/pdf-merge/tests/files/expected/output_with_header_and_footer.pdf new file mode 100644 index 0000000..6da8603 Binary files /dev/null and b/vendor/karriere/pdf-merge/tests/files/expected/output_with_header_and_footer.pdf differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/tcpdf_logo.jpg b/vendor/karriere/pdf-merge/tests/files/header_logo.jpg similarity index 100% rename from vendor/tecnickcom/tcpdf/examples/images/tcpdf_logo.jpg rename to vendor/karriere/pdf-merge/tests/files/header_logo.jpg diff --git a/vendor/phrity/comparison/composer.json b/vendor/phrity/comparison/composer.json new file mode 100644 index 0000000..9287317 --- /dev/null +++ b/vendor/phrity/comparison/composer.json @@ -0,0 +1,34 @@ +{ + "name": "phrity/comparison", + "type": "library", + "description": "Interfaces and helper trait for comparing objects. Comparator for sort and filter applications.", + "homepage": "https://phrity.sirn.se/comparison", + "keywords": ["comparison", "equalable", "comparable", "comparator", "sort", "filter"], + "license": "MIT", + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "autoload": { + "psr-4": { + "Phrity\\Comparison\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Mock\\": "tests/Mock/" + } + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "squizlabs/php_codesniffer": "^3.5" + } +} diff --git a/vendor/phrity/comparison/src/Comparable.php b/vendor/phrity/comparison/src/Comparable.php new file mode 100644 index 0000000..f84b0d4 --- /dev/null +++ b/vendor/phrity/comparison/src/Comparable.php @@ -0,0 +1,56 @@ + Comparison + */ + +namespace Phrity\Comparison; + +/** + * Interface for comparable instances. + */ +interface Comparable extends Equalable +{ + /** + * Compare $this and $that and return result as comparison identifier as integer. + * @param mixed $that The instance to compare with + * @return integer Must return 0 if $this is equal to $that + * Must return -1 if $this is less than $that + * Must return 1 if $this is greater than $that + * @throws IncomparableException Must throw if $this can not be compared with $that + */ + public function compare(mixed $that): int; + + /** + * If $this is greater than $that. + * @param mixed $that The instance to compare with + * @return boolean True if $this is greater than $that + * @throws IncomparableException Must throw if $this can not be compared with $that + */ + public function greaterThan(mixed $that): bool; + + /** + * If $this is greater than or equal to $that. + * @param mixed $that The instance to compare with + * @return boolean True if $this is greater than or equal to $that + * @throws IncomparableException Must throw if $this can not be compared with $that + */ + public function greaterThanOrEqual(mixed $that): bool; + + /** + * If $this is less than $that. + * @param mixed $that The instance to compare with + * @return boolean True if $this is less than $that + * @throws IncomparableException Must throw if $this can not be compared with $that + */ + public function lessThan(mixed $that): bool; + + /** + * If $this is less than or equal to $this. + * @param mixed $that The instance to compare with + * @return boolean True if $this is less than or equal to $this + * @throws IncomparableException Must throw if $this can not be compared with $that + */ + public function lessThanOrEqual(mixed $that): bool; +} diff --git a/vendor/phrity/comparison/src/Comparator.php b/vendor/phrity/comparison/src/Comparator.php new file mode 100644 index 0000000..722253b --- /dev/null +++ b/vendor/phrity/comparison/src/Comparator.php @@ -0,0 +1,200 @@ + Comparison + */ + +namespace Phrity\Comparison; + +/** + * Utility class for comparing and filtering. + */ +class Comparator +{ + /** @var array */ + private $comparables; + + /** + * If comparables supplied in constructor, they will be used as defaults an operations + * @param array $comparables List of objects implementing Comparable + */ + public function __construct(array $comparables = []) + { + $this->comparables = $comparables; + } + + // Sort methods + + /** + * Sorts array of comparable items, low to high + * @param array|null $comparables List of objects implementing Comparable + * @return array The sorted list + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + public function sort(array|null $comparables = null): array + { + $comparables = $comparables ?: $this->comparables; + usort($comparables, function ($item_1, $item_2) { + $this->verifyComparable($item_1); + return $item_1->compare($item_2); + }); + return $comparables; + } + + /** + * Sorts array of comparable items, high to low + * @param array|null $comparables List of objects implementing Comparable + * @return array The sorted list + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + public function rsort(array|null $comparables = null): array + { + $comparables = $comparables ?: $this->comparables; + usort($comparables, function ($item_1, $item_2) { + $this->verifyComparable($item_2); + return $item_2->compare($item_1); + }); + return $comparables; + } + + + // Filter methods + + /** + * Filter array of comparable items that equals condition + * @param Comparable $condition To compare against + * @param array|null $comparables List of objects implementing Comparable + * @return array The filtered list + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + public function equals(Comparable $condition, array|null $comparables = null): array + { + return $this->applyFilter('equals', $condition, $comparables); + } + + /** + * Filter array of comparable items that are greater than condition + * @param Comparable $condition To compare against + * @param array|null $comparables List of objects implementing Comparable + * @return array The filtered list + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + public function greaterThan(Comparable $condition, array|null $comparables = null): array + { + return $this->applyFilter('greaterThan', $condition, $comparables); + } + + /** + * Filter array of comparable items that are greater than or equals condition + * @param Comparable $condition To compare against + * @param array|null $comparables List of objects implementing Comparable + * @return array The filtered list + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + public function greaterThanOrEqual(Comparable $condition, array|null $comparables = null): array + { + return $this->applyFilter('greaterThanOrEqual', $condition, $comparables); + } + + /** + * Filter array of comparable items that are less than condition + * @param Comparable $condition To compare against + * @param array|null $comparables List of objects implementing Comparable + * @return array The filtered list + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + public function lessThan(Comparable $condition, array|null $comparables = null): array + { + return $this->applyFilter('lessThan', $condition, $comparables); + } + + /** + * Filter array of comparable items that are less than or equals condition + * @param Comparable $condition To compare against + * @param array|null $comparables List of objects implementing Comparable + * @return array The filtered list + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + public function lessThanOrEqual(Comparable $condition, array|null $comparables = null): array + { + return $this->applyFilter('lessThanOrEqual', $condition, $comparables); + } + + + // Select methods + + /** + * Get minimum item from array of comparable items + * @param array|null $comparables List of objects implementing Comparable + * @return Comparable|null The resolved instance + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + public function min(array|null $comparables = null): Comparable|null + { + return $this->applyReduction('lessThan', $comparables); + } + + /** + * Get maximum item from array of comparable items + * @param array|null $comparables List of objects implementing Comparable + * @return Comparable|null The resolved instance + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + public function max(array|null $comparables = null): Comparable|null + { + return $this->applyReduction('greaterThan', $comparables); + } + + + // Private internal methods + + /** + * Verify input implements Comparable + * @param mixed $item Item to verify + * @throws IncomparableException Thrown if item do not implement Comparable + */ + private function verifyComparable(mixed $item): void + { + if (!$item instanceof Comparable) { + throw new IncomparableException('All items must implement Comparable'); + } + } + + /** + * Filter array of comparable items according to condition instance and method + * @param string $method Comparison method to use + * @param Comparable $condition To compare against + * @param array|null $comparables List of objects implementing Comparable + * @return array The filtered list + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + private function applyFilter(string $method, Comparable $condition, array|null $comparables = null): array + { + $comparables = $comparables ?: $this->comparables; + $filtered = array_filter($comparables, function ($item) use ($method, $condition) { + $this->verifyComparable($item); + return $item->$method($condition); + }); + return array_values($filtered); + } + + /** + * Reduce array of comparable items according comparison method + * @param string $method Comparison method to use + * @param array|null $comparables List of objects implementing Comparable + * @return Comparable|null The resolved instance + * @throws IncomparableException Thrown if any item in the list can not be compared + */ + private function applyReduction(string $method, array|null $comparables = null): Comparable|null + { + $comparables = $comparables ?: $this->comparables; + return array_reduce($comparables, function ($item_1, $item_2) use ($method) { + if (is_null($item_1)) { + return $item_2; + } + $this->verifyComparable($item_1); + return $item_1->$method($item_2) ? $item_1 : $item_2; + }); + } +} diff --git a/vendor/phrity/comparison/src/ComparisonTrait.php b/vendor/phrity/comparison/src/ComparisonTrait.php new file mode 100644 index 0000000..dbea328 --- /dev/null +++ b/vendor/phrity/comparison/src/ComparisonTrait.php @@ -0,0 +1,69 @@ + Comparison + */ + +namespace Phrity\Comparison; + +/** + * Trait that enables comparison methods. + */ +trait ComparisonTrait +{ + /** + * If $this is equal to $that. + * @param mixed $that The instance to compare with + * @return boolean True if $this is equal to $that + * @throws IncomparableException Thrown if $this can not be compared with $that + */ + public function equals(mixed $that): bool + { + return $this->compare($that) == 0; + } + + /** + * If $this is greater than $that. + * @param mixed $that The instance to compare with + * @return boolean True if $this is greater than $that + * @throws IncomparableException Thrown if $this can not be compared with $that + */ + public function greaterThan(mixed $that): bool + { + return $this->compare($that) > 0; + } + + /** + * If $this is greater than or equal to $that. + * @param mixed $that The instance to compare with + * @return boolean True if $this is greater than or equal to $that + * @throws IncomparableException Thrown if $this can not be compared with $that + */ + public function greaterThanOrEqual(mixed $that): bool + { + return $this->compare($that) >= 0; + } + + /** + * If $this is less than $that. + * @param mixed $that The instance to compare with + * @return boolean True if $this is less than $that + * @throws IncomparableException Thrown if $this can not be compared with $that + */ + public function lessThan(mixed $that): bool + { + return $this->compare($that) < 0; + } + + /** + * If $this is less than or equal to $this. + * @param mixed $that The instance to compare with + * @return boolean True if $this is less than or equal to $this + * @throws IncomparableException Thrown if $this can not be compared with $that + */ + public function lessThanOrEqual(mixed $that): bool + { + return $this->compare($that) <= 0; + } +} diff --git a/vendor/phrity/comparison/src/Equalable.php b/vendor/phrity/comparison/src/Equalable.php new file mode 100644 index 0000000..8e207e3 --- /dev/null +++ b/vendor/phrity/comparison/src/Equalable.php @@ -0,0 +1,22 @@ + Comparison + */ + +namespace Phrity\Comparison; + +/** + * Interface for equalable instances. + */ +interface Equalable +{ + /** + * If $this is equal to $that. + * @param mixed $that The instance to compare with + * @return boolean True if $this is equal to $that + * @throws IncomparableException Must throw if $this can not be compared with $that + */ + public function equals(mixed $that): bool; +} diff --git a/vendor/phrity/comparison/src/IncomparableException.php b/vendor/phrity/comparison/src/IncomparableException.php new file mode 100644 index 0000000..fbc086f --- /dev/null +++ b/vendor/phrity/comparison/src/IncomparableException.php @@ -0,0 +1,17 @@ + Comparison + */ + +namespace Phrity\Comparison; + +use InvalidArgumentException; + +/** + * Exception that should be thrown when instances can not be compared. + */ +class IncomparableException extends InvalidArgumentException +{ +} diff --git a/vendor/phrity/http/LICENSE b/vendor/phrity/http/LICENSE new file mode 100644 index 0000000..09eaada --- /dev/null +++ b/vendor/phrity/http/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Sören Jensen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/phrity/http/composer.json b/vendor/phrity/http/composer.json new file mode 100644 index 0000000..9302b94 --- /dev/null +++ b/vendor/phrity/http/composer.json @@ -0,0 +1,40 @@ +{ + "name": "phrity/http", + "type": "library", + "description": "Utilities and interfaces for handling HTTP.", + "homepage": "https://phrity.sirn.se/http", + "keywords": ["HTTP", "HTTP Factories", "PSR-17"], + "license": "MIT", + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "autoload": { + "psr-4": { + "Phrity\\Http\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Phrity\\Http\\Test\\": "tests/" + } + }, + "require": { + "php": "^8.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 | ^2.0" + }, + "require-dev": { + "guzzlehttp/psr7": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "robiningelbrecht/phpunit-coverage-tools": "^1.9", + "squizlabs/php_codesniffer": "^3.5" + }, + "provides": { + "psr/http-factory-implementation": "*" + } +} diff --git a/vendor/phrity/http/docu.json b/vendor/phrity/http/docu.json new file mode 100644 index 0000000..e217c11 --- /dev/null +++ b/vendor/phrity/http/docu.json @@ -0,0 +1,10 @@ +[ + { + "name": "Overview", + "source": "README.md" + }, + { + "name": "License", + "source": "LICENSE" + } +] diff --git a/vendor/phrity/http/src/HttpFactory.php b/vendor/phrity/http/src/HttpFactory.php new file mode 100644 index 0000000..5e5ff6e --- /dev/null +++ b/vendor/phrity/http/src/HttpFactory.php @@ -0,0 +1,175 @@ +requestFactory)) { + throw new BadMethodCallException('HttpFactory.createRequest not implemented.'); + } + return $this->requestFactory->createRequest($method, $uri); + } + + /** + * @param int $code + * @param string $reasonPhrase + */ + public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface + { + if (is_null($this->responseFactory)) { + throw new BadMethodCallException('HttpFactory.createResponse not implemented.'); + } + return $this->responseFactory->createResponse($code, $reasonPhrase); + } + + /** + * @param string $method + * @param UriInterface|string $uri + * @param array $serverParams + */ + public function createServerRequest(string $method, mixed $uri, array $serverParams = []): ServerRequestInterface + { + if (is_null($this->serverRequestFactory)) { + throw new BadMethodCallException('HttpFactory.createServerRequest not implemented.'); + } + return $this->serverRequestFactory->createServerRequest($method, $uri); + } + + /** + * @param string $content + */ + public function createStream(string $content = ''): StreamInterface + { + if (is_null($this->streamFactory)) { + throw new BadMethodCallException('HttpFactory.createStream not implemented.'); + } + return $this->streamFactory->createStream($content); + } + + /** + * @param string $filename + * @param string $mode + */ + public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface + { + if (is_null($this->streamFactory)) { + throw new BadMethodCallException('HttpFactory.createStreamFromFile not implemented.'); + } + return $this->streamFactory->createStreamFromFile($filename, $mode); + } + + /** + * @param resource $resource + */ + public function createStreamFromResource($resource): StreamInterface + { + if (is_null($this->streamFactory)) { + throw new BadMethodCallException('HttpFactory.createStreamFromResource not implemented.'); + } + return $this->streamFactory->createStreamFromResource($resource); + } + + /** + * @param StreamInterface $stream + * @param int $size + * @param int $error + * @param string $clientFilename + * @param string $clientMediaType + */ + public function createUploadedFile( + StreamInterface $stream, + int|null $size = null, + int $error = UPLOAD_ERR_OK, + string|null $clientFilename = null, + string|null $clientMediaType = null + ): UploadedFileInterface { + if (is_null($this->uploadedFileFactory)) { + throw new BadMethodCallException('HttpFactory.createUploadedFile not implemented.'); + } + return $this->uploadedFileFactory->createUploadedFile( + $stream, + $size, + $error, + $clientFilename, + $clientMediaType + ); + } + + /** + * @param string $uri The URI to parse. + */ + public function createUri(string $uri = ''): UriInterface + { + if (is_null($this->uriFactory)) { + throw new BadMethodCallException('HttpFactory.createUri not implemented.'); + } + return $this->uriFactory->createUri($uri); + } + + public static function create(object ...$implementations): self + { + $created = new self(); + foreach ($implementations as $implementation) { + if ($implementation instanceof RequestFactoryInterface) { + $created->requestFactory = $implementation; + } + if ($implementation instanceof ResponseFactoryInterface) { + $created->responseFactory = $implementation; + } + if ($implementation instanceof ServerRequestFactoryInterface) { + $created->serverRequestFactory = $implementation; + } + if ($implementation instanceof StreamFactoryInterface) { + $created->streamFactory = $implementation; + } + if ($implementation instanceof UploadedFileFactoryInterface) { + $created->uploadedFileFactory = $implementation; + } + if ($implementation instanceof UriFactoryInterface) { + $created->uriFactory = $implementation; + } + } + return $created; + } +} diff --git a/vendor/phrity/net-stream/composer.json b/vendor/phrity/net-stream/composer.json new file mode 100644 index 0000000..d3778d4 --- /dev/null +++ b/vendor/phrity/net-stream/composer.json @@ -0,0 +1,38 @@ +{ + "name": "phrity/net-stream", + "type": "library", + "description": "Socket stream classes implementing PSR-7 Stream and PSR-17 StreamFactory", + "homepage": "https://phrity.sirn.se/net-stream", + "keywords": ["socket", "stream", "stream factory", "client", "server", "PSR-7", "PSR-17"], + "license": "MIT", + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "autoload": { + "psr-4": { + "Phrity\\Net\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Phrity\\Net\\Test\\": "tests/mock/" + } + }, + "require": { + "php": "^8.1", + "phrity/util-errorhandler": "^1.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 | ^2.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "phrity/net-uri": "^2.0", + "squizlabs/php_codesniffer": "^3.5" + } +} diff --git a/vendor/phrity/net-stream/src/Context.php b/vendor/phrity/net-stream/src/Context.php new file mode 100644 index 0000000..4376c69 --- /dev/null +++ b/vendor/phrity/net-stream/src/Context.php @@ -0,0 +1,214 @@ +, Closure> */ + protected array $notifiers = []; + + /** + * Create exception. + * @param open-resource|null $stream + * @throws InvalidArgumentException if not a resource + * @throws InvalidArgumentException if wrong resource type + */ + public function __construct(mixed $stream = null) + { + if (is_null($stream)) { + $stream = stream_context_create(); + } + $type = gettype($stream); + if ($type !== 'resource') { + throw new InvalidArgumentException("Invalid stream provided; got type '{$type}'."); + } + $rtype = get_resource_type($stream); + if (!in_array($rtype, ['stream', 'persistent stream', 'stream-context'])) { + throw new InvalidArgumentException("Invalid stream provided; got resource type '{$rtype}'."); + } + $this->stream = $stream; + stream_context_set_params($this->stream, ['notification' => function (...$input) { + $this->notifyCallback(...$input); + }]); + } + + public function getOption(string $wrapper, string $option): mixed + { + return stream_context_get_options($this->stream)[$wrapper][$option] ?? null; + } + + /** + * @return array> + */ + public function getOptions(): array + { + return stream_context_get_options($this->stream); + } + + /** + * @throws StreamException on failure + */ + public function setOption(string $wrapper, string $option, mixed $value): self + { + if (!is_resource($this->stream) || !stream_context_set_option($this->stream, $wrapper, $option, $value)) { + throw new StreamException(StreamException::CONTEXT_SET_ERR); + } + return $this; + } + + /** + * @param array> $options + */ + public function setOptions(array $options): self + { + foreach ($options as $wrapper => $wrapperOptions) { + foreach ($wrapperOptions as $option => $value) { + $this->setOption($wrapper, $option, $value); + } + } + return $this; + } + + /** + * @deprecated Use getOption. + */ + public function getParam(string $param): mixed + { + return stream_context_get_params($this->stream)[$param] ?? null; + } + + /** + * @return array + * @deprecated Use getOptions. + */ + public function getParams(): array + { + return stream_context_get_params($this->stream); + } + + /** + * @deprecated Use setOption and on- callbacks instead. + */ + public function setParam(string $param, mixed $value): self + { + $this->setParams([$param => $value]); + return $this; + } + + /** + * @param array $params + * @deprecated Use setOptions and on- callbacks instead. + * @throws StreamException on failure + */ + public function setParams(array $params): self + { + /** @phpstan-ignore booleanNot.alwaysFalse */ + if (!is_resource($this->stream) || !stream_context_set_params($this->stream, $params)) { + throw new StreamException(StreamException::CONTEXT_SET_ERR); + } + return $this; + } + + public function getResource(): mixed + { + return $this->stream; + } + + /** @param Closure(): void $closure */ + public function onResolve(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_RESOLVE] = $closure; + } + + /** @param Closure(): void $closure */ + public function onConnect(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_CONNECT] = $closure; + } + + /** @param Closure(): void $closure */ + public function onAuthRequired(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_AUTH_REQUIRED] = $closure; + } + + /** @param Closure(string $mimeType): void $closure */ + public function onMimeType(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_MIME_TYPE_IS] = $closure; + } + + /** @param Closure(int $fileSize): void $closure */ + public function onFileSize(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_FILE_SIZE_IS] = $closure; + } + + /** @param Closure(string $uri): void $closure */ + public function onRedirected(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_REDIRECTED] = $closure; + } + + /** @param Closure(int $transferred, int $max): void $closure */ + public function onProgress(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_PROGRESS] = $closure; + } + + /** @param Closure(): void $closure */ + public function onCompleted(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_COMPLETED] = $closure; + } + + /** @param Closure(string $message, int $code): void $closure */ + public function onFailure(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_FAILURE] = $closure; + } + + /** @param Closure(): void $closure */ + public function onAuthResult(Closure $closure): void + { + $this->notifiers[STREAM_NOTIFY_AUTH_RESULT] = $closure; + } + + protected function notifyCallback( + int $code, + int $severity, + string|null $message, + int $errorCode, + int $transferred, + int $max, + ): void { + if (!array_key_exists($code, $this->notifiers)) { + return; + } + $callback = $this->notifiers[$code]; + $params = match ($code) { + STREAM_NOTIFY_RESOLVE, + STREAM_NOTIFY_CONNECT, + STREAM_NOTIFY_AUTH_REQUIRED, + STREAM_NOTIFY_COMPLETED, + STREAM_NOTIFY_AUTH_RESULT => [], + STREAM_NOTIFY_MIME_TYPE_IS => ['mimeType' => $message], + STREAM_NOTIFY_FILE_SIZE_IS => ['fileSize' => $message], + STREAM_NOTIFY_REDIRECTED => ['uri' => $message], + STREAM_NOTIFY_PROGRESS => ['transferred' => $transferred, 'max' => $max], + STREAM_NOTIFY_FAILURE => ['message' => $message, 'code' => $errorCode], + }; + $callback(...$params); + } +} diff --git a/vendor/phrity/net-stream/src/SocketClient.php b/vendor/phrity/net-stream/src/SocketClient.php new file mode 100644 index 0000000..2a71c91 --- /dev/null +++ b/vendor/phrity/net-stream/src/SocketClient.php @@ -0,0 +1,108 @@ +|float|null */ + protected int|float|null $timeout = null; + protected Context $context; + + /** + * Create new socker server instance + * @param UriInterface $uri The URI to open socket on. + */ + public function __construct(UriInterface $uri, Context|null $context = null) + { + $this->uri = $uri; + $this->context = $context ?? new Context(); + $this->handler = new ErrorHandler(); + } + + + // ---------- Configuration --------------------------------------------------------------------------------------- + + /** + * Set stream context. + * @param Context|array>|null $options + * @param array|null $params + * @return SocketClient + */ + public function setContext(Context|array|null $options = null, array|null $params = null): self + { + if ($options instanceof Context) { + $this->context = $options; + return $this; + } + // @deprecated + // @todo Add deprecation warning + $this->context->setOptions($options ?? []); + $this->context->setParams($params ?? []); + return $this; + } + + public function getContext(): Context + { + return $this->context; + } + + /** + * Set connection persistency. + * @param bool $persistent + * @return SocketClient + */ + public function setPersistent(bool $persistent): self + { + $this->persistent = $persistent; + return $this; + } + + /** + * Set timeout in seconds. + * @param int<0, max>|float|null $timeout + * @return SocketClient + * @throws InvalidArgumentException if invalid timeout + */ + public function setTimeout(int|float|null $timeout): self + { + if (!is_null($timeout) && $timeout < 0) { + throw new InvalidArgumentException("Timeout must be 0 or more."); + } + $this->timeout = $timeout; + return $this; + } + + + // ---------- Operations ------------------------------------------------------------------------------------------ + + /** + * Create a connection on remote socket. + * @return SocketStream The stream for opened conenction. + */ + public function connect(): SocketStream + { + /** @throws StreamException if connection could not be created */ + $stream = $this->handler->with(function () { + $error_code = $error_message = ''; + return stream_socket_client( + $this->uri->__toString(), + $error_code, + $error_message, + $this->timeout, + $this->persistent ? STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT : STREAM_CLIENT_CONNECT, + $this->context->getResource() + ); + }, new StreamException(StreamException::CLIENT_CONNECT_ERR, ['uri' => $this->uri])); + return new SocketStream($stream); + } +} diff --git a/vendor/phrity/net-stream/src/SocketServer.php b/vendor/phrity/net-stream/src/SocketServer.php new file mode 100644 index 0000000..1b1dff5 --- /dev/null +++ b/vendor/phrity/net-stream/src/SocketServer.php @@ -0,0 +1,173 @@ + */ + private static array $internet_schemes = ['tcp', 'udp', 'tls', 'ssl']; + /** @var array */ + private static array $unix_schemes = ['unix', 'udg']; + + protected ErrorHandler $handler; + protected string $address; + /** @var resource */ + protected $stream; + protected Context $context; + + /** + * Create new socker server instance + * @param UriInterface $uri The URI to open socket on. + * @throws StreamException if invalid scheme. + * @throws StreamException if unsupported scheme. + * @throws StreamException if unable to create socket. + */ + public function __construct(UriInterface $uri, Context|null $context = null) + { + $this->handler = new ErrorHandler(); + if (!in_array($uri->getScheme(), $this->getTransports())) { + throw new StreamException(StreamException::SCHEME_TRANSPORT, ['scheme' => $uri->getScheme()]); + } + if (in_array(substr($uri->getScheme(), 0, 3), self::$internet_schemes)) { + $this->address = "{$uri->getScheme()}://{$uri->getAuthority()}"; + } elseif (in_array($uri->getScheme(), self::$unix_schemes)) { + $this->address = "{$uri->getScheme()}://{$uri->getPath()}"; + } else { + throw new StreamException(StreamException::SCHEME_HANDLER, ['scheme' => $uri->getScheme()]); + } + $this->context = $context ?? new Context(); + /** @throws StreamException on failure */ + $this->stream = $this->handler->with(function () { + $error_code = $error_message = ''; + return stream_socket_server( + $this->address, + $error_code, + $error_message, + STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, + $this->context->getResource() + ); + }, new StreamException(StreamException::SERVER_SOCKET_ERR, ['uri' => $uri->__toString()])); + $this->evalStream(); + } + + + // ---------- Configuration --------------------------------------------------------------------------------------- + + /** + * Set stream context. + * @param Context|array>|null $options + * @param array|null $params + * @return static + */ + public function setContext(Context|array|null $options = null, array|null $params = null): self + { + if ($options instanceof Context) { + $this->context = $options; + return $this; + } + // @deprecated + // @todo Add deprecation warning + $this->context->setOptions($options ?? []); + $this->context->setParams($params ?? []); + return $this; + } + + public function getContext(): Context + { + return $this->context; + } + + /** + * Retrieve list of registered socket transports. + * @return array List of registered transports. + */ + public function getTransports(): array + { + return stream_get_transports(); + } + + /** + * If server is in blocking mode. + * @return bool|null + */ + public function isBlocking(): bool|null + { + return $this->getMetadata('blocked'); + } + + /** + * Toggle blocking/non-blocking mode. + * @param bool $enable Blocking mode to set. + * @return bool If operation was succesful. + * @throws StreamException if socket is closed. + */ + public function setBlocking(bool $enable): bool + { + if (!is_resource($this->stream)) { + throw new StreamException(StreamException::SERVER_CLOSED); + } + return stream_set_blocking($this->stream, $enable); + } + + /** + * Get stream metadata as an associative array or retrieve a specific key. + * @param string $key Specific metadata to retrieve. + * @return array|mixed|null Returns an associative array if no key is + * provided. Returns a specific key value if a key is provided and the + * value is found, or null if the key is not found. + */ + public function getMetadata(string|null $key = null): mixed + { + if (!is_resource($this->stream)) { + return null; + } + // Add URI default for version compability + $meta = array_merge([ + 'uri' => $this->address, + ], stream_get_meta_data($this->stream)); + if (isset($key)) { + return array_key_exists($key, $meta) ? $meta[$key] : null; + } + return $meta; + } + + + // ---------- Operations ------------------------------------------------------------------------------------------ + + /** + * Accept a connection on a socket. + * @param int<0, max>|float|null $timeout Override the default socket accept timeout. + * @return SocketStream|null The stream for opened conenction. + * @throws InvalidArgumentException if invalid timeout + * @throws StreamException if socket is closed + */ + public function accept(int|float|null $timeout = null): SocketStream|null + { + if (!is_null($timeout) && $timeout < 0) { + throw new InvalidArgumentException("Timeout must be 0 or more."); + } + if (!is_resource($this->stream)) { + throw new StreamException(StreamException::SERVER_CLOSED); + } + /** @throws StreamException */ + $stream = $this->handler->with(function () use ($timeout) { + $peer_name = ''; + return stream_socket_accept($this->stream, $timeout, $peer_name); + }, function (ErrorException $e) { + // If non-blocking mode, don't throw error on time out + if ($this->getMetadata('blocked') === false && substr_count($e->getMessage(), 'timed out') > 0) { + return null; + } + throw new StreamException(StreamException::SERVER_ACCEPT_ERR); + }); + return $stream ? new SocketStream($stream) : null; + } +} diff --git a/vendor/phrity/net-stream/src/SocketStream.php b/vendor/phrity/net-stream/src/SocketStream.php new file mode 100644 index 0000000..d83dc98 --- /dev/null +++ b/vendor/phrity/net-stream/src/SocketStream.php @@ -0,0 +1,166 @@ +stream) && ($this->readable || $this->writable); + } + + /** + * Get name of remote socket, or null if not connected. + * @return string|null + */ + public function getRemoteName(): string|null + { + return is_resource($this->stream) ? (stream_socket_get_name($this->stream, true) ?: null) : null; + } + + /** + * Get name of local socket, or null if not connected. + * @return string|null + */ + public function getLocalName(): string|null + { + return is_resource($this->stream) ? (stream_socket_get_name($this->stream, false) ?: null) : null; + } + + /** + * Get type of stream resoucre. + * @return string + */ + public function getResourceType(): string + { + return $this->stream ? get_resource_type($this->stream) : ''; + } + + /** + * If stream is in blocking mode. + * @return bool|null + */ + public function isBlocking(): bool|null + { + return $this->getMetadata('blocked'); + } + + /** + * Toggle blocking/non-blocking mode. + * @param bool $enable Blocking mode to set. + * @return bool If operation was succesful. + * @throws StreamException if stream is closed. + */ + public function setBlocking(bool $enable): bool + { + if (!isset($this->stream)) { + throw new StreamException(StreamException::STREAM_DETACHED); + } + return stream_set_blocking($this->stream, $enable); + } + + /** + * If socket stream has unread content. + * @return bool If there is content to read. + * @throws StreamException if stream is unselectable. + */ + public function hasContents(): bool + { + if (!is_resource($this->stream)) { + return false; + } + /** @throws StreamException */ + return $this->handler->with(function () { + $read = [$this->getOpenResource()]; + $write = $oob = []; + return stream_select($read, $write, $oob, 0, 0) > 0; + }, new StreamException(StreamException::FAIL_SELECT)); + } + + /** + * Set timeout period on a stream. + * @param int<0, max>|float $timeout Seconds to be set. + * @param int|null $microseconds Microseconds to be set - deprecated + * @return bool If operation was succesful. + * @throws InvalidArgumentException if invalid timeout. + * @throws StreamException if stream is closed. + */ + public function setTimeout(int|float $timeout, int|null $microseconds = null): bool + { + // @deprecated Setting $microseconds is deprecated, use float value on $timeout instead + // @todo Add deprecation warning + if ($timeout < 0) { + throw new InvalidArgumentException("Timeout must be 0 or more."); + } + if (!isset($this->stream)) { + throw new StreamException(StreamException::STREAM_DETACHED); + } + $seconds = intval($timeout); + $microseconds = $microseconds ?? intval(round($timeout - $seconds, 6) * 1000000); + return stream_set_timeout($this->stream, $seconds, $microseconds); + } + + + // ---------- Operations ------------------------------------------------------------------------------------------ + + /** + * Read line from the stream. + * @param int<0, max> $length Read up to $length bytes from the object and return them. + * @return string|null Returns the data read from the stream, or null of eof. + * @throws StreamException if an error occurs. + */ + public function readLine(int $length): string|null + { + $stream = $this->getOpenResource(); + if (!$this->readable) { + throw new StreamException(StreamException::NOT_READABLE); + } + /** @throws StreamException */ + return $this->handler->with(function () use ($stream, $length) { + $result = fgets($stream, $length); + return $result === false ? null : $result; + }, new StreamException(StreamException::FAIL_GETS)); + } + + /** + * Closes the stream for further reading. + * @return void + */ + public function closeRead(): void + { + if (is_resource($this->stream)) { + if ($this->readable && $this->writable) { + stream_socket_shutdown($this->stream, STREAM_SHUT_RD); + $this->evalStream(); + } elseif (!$this->writable) { + $this->close(); + } + } + $this->readable = false; + } + /** + * Closes the stream for further writing. + * @return void + */ + public function closeWrite(): void + { + if ($this->readable && $this->writable) { + stream_socket_shutdown($this->getOpenResource(), STREAM_SHUT_WR); + $this->evalStream(); + } elseif (!$this->readable) { + $this->close(); + } + $this->writable = false; + } +} diff --git a/vendor/phrity/net-stream/src/Stream.php b/vendor/phrity/net-stream/src/Stream.php new file mode 100644 index 0000000..71fb8c1 --- /dev/null +++ b/vendor/phrity/net-stream/src/Stream.php @@ -0,0 +1,317 @@ + */ + private static array $readmodes = ['r', 'r+', 'w+', 'a+', 'x+', 'c+']; + /** @var array */ + private static array $writemodes = ['r+', 'w', 'w+', 'a', 'a+', 'x', 'x+', 'c', 'c+']; + + /** @var resource|null */ + protected $stream; + protected Context $context; + protected ErrorHandler $handler; + protected bool $readable = false; + protected bool $writable = false; + protected bool $seekable = false; + + /** + * Create new stream wrapper instance + * @param resource $stream A stream resource to wrap + * @throws InvalidArgumentException If not a valid stream resource + */ + public function __construct($stream) + { + $type = gettype($stream); + if ($type !== 'resource') { + throw new InvalidArgumentException("Invalid stream provided; got type '{$type}'."); + } + $rtype = get_resource_type($stream); + if (!in_array($rtype, ['stream', 'persistent stream'])) { + throw new InvalidArgumentException("Invalid stream provided; got resource type '{$rtype}'."); + } + $this->stream = $stream; + $this->context = new Context($this->stream); + $this->handler = new ErrorHandler(); + $this->evalStream(); + } + + + // ---------- PSR-7 methods --------------------------------------------------------------------------------------- + + /** + * Closes the stream and any underlying resources. + * @return void + */ + public function close(): void + { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->stream = null; + $this->evalStream(); + } + + /** + * Separates any underlying resources from the stream. + * After the stream has been detached, the stream is in an unusable state. + * @return resource|null Underlying stream, if any + */ + public function detach(): mixed + { + if (!isset($this->stream)) { + return null; + } + $stream = $this->stream; + $this->stream = null; + $this->evalStream(); + return $stream; + } + + /** + * Get stream metadata as an associative array or retrieve a specific key. + * @param string $key Specific metadata to retrieve. + * @return array|mixed|null Returns an associative array if no key is + * provided. Returns a specific key value if a key is provided and the + * value is found, or null if the key is not found. + */ + public function getMetadata(string|null $key = null): mixed + { + if (!isset($this->stream)) { + return null; + } + $meta = stream_get_meta_data($this->stream); + if (isset($key)) { + return array_key_exists($key, $meta) ? $meta[$key] : null; + } + return $meta; + } + + /** + * Returns the current position of the file read/write pointer + * @return int Position of the file pointer + * @throws StreamException on error. + */ + public function tell(): int + { + /** @throws StreamException */ + return $this->handler->with(function () { + return ftell($this->getOpenResource()); + }, new StreamException(StreamException::FAIL_TELL)); + } + + /** + * Returns true if the stream is at the end of the stream. + * @return bool + */ + public function eof(): bool + { + return empty($this->stream) || feof($this->stream); + } + + /** + * Read data from the stream. + * @param int<1, max> $length Read up to $length bytes from the object and return them. + * @return string Returns the data read from the stream, or an empty string. + * @throws StreamException if an error occurs. + */ + public function read(int $length): string + { + if ($length < 1) { + throw new InvalidArgumentException("Must read minimum 1 byte"); + } + $stream = $this->getOpenResource(); + if (!$this->readable) { + throw new StreamException(StreamException::NOT_READABLE); + } + /** @throws StreamException */ + return $this->handler->with(function () use ($stream, $length) { + return (string)fread($stream, $length); + }, new StreamException(StreamException::FAIL_READ)); + } + + /** + * Write data to the stream. + * @param string $string The string that is to be written. + * @return int Returns the number of bytes written to the stream. + * @throws StreamException on failure. + */ + public function write(string $string): int + { + $stream = $this->getOpenResource(); + if (!$this->writable) { + throw new StreamException(StreamException::NOT_WRITABLE); + } + /** @throws StreamException */ + return $this->handler->with(function () use ($stream, $string) { + return fwrite($stream, $string); + }, new StreamException(StreamException::FAIL_WRITE)); + } + + /** + * Get the size of the stream if known. + * @return int|null Returns the size in bytes if known, or null if unknown. + */ + public function getSize(): int|null + { + if (!is_resource($this->stream)) { + return null; + } + $stats = fstat($this->stream); + return $stats['size'] ?? null; + } + + /** + * Returns whether or not the stream is seekable. + * @return bool + */ + public function isSeekable(): bool + { + return $this->seekable; + } + + /** + * Seek to a position in the stream. + * @param int $offset Stream offset + * @param int $whence Specifies how the cursor position will be calculated based on the seek offset. + * @throws StreamException on failure. + */ + public function seek(int $offset, int $whence = SEEK_SET): void + { + $stream = $this->getOpenResource(); + if (!$this->seekable) { + throw new StreamException(StreamException::NOT_SEEKABLE); + } + $result = fseek($stream, $offset, $whence); + if ($result !== 0) { + throw new StreamException(StreamException::FAIL_SEEK); + } + } + + /** + * Seek to the beginning of the stream. + * If the stream is not seekable, this method will raise an exception; + * otherwise, it will perform a seek(0). + */ + public function rewind(): void + { + $this->seek(0); + } + + /** + * Returns whether or not the stream is writable. + * @return bool + */ + public function isWritable(): bool + { + return $this->writable; + } + + /** + * Returns whether or not the stream is readable. + * @return bool + */ + public function isReadable(): bool + { + return $this->readable; + } + + /** + * Returns the remaining contents in a string + * @return string + * @throws StreamException if unable to read. + * @throws StreamException if error occurs while reading. + */ + public function getContents(): string + { + $stream = $this->getOpenResource(); + if (!$this->readable) { + throw new StreamException(StreamException::NOT_READABLE); + } + /** @throws StreamException */ + return $this->handler->with(function () use ($stream) { + return stream_get_contents($stream); + }, new StreamException(StreamException::FAIL_CONTENTS)); + } + + /** + * Reads all data from the stream into a string, from the beginning to end. + * @return string + */ + public function __toString(): string + { + try { + if ($this->isSeekable()) { + $this->rewind(); + } + return $this->getContents(); + } catch (Throwable $e) { + trigger_error($e->getMessage(), E_USER_WARNING); + return ''; + } + } + + + // ---------- Extended methods ------------------------------------------------------------------------------------ + + /** + * Return context for stream. + * @return Context + */ + public function getContext(): Context + { + return $this->context; + } + + /** + * Return underlying resource. + * @return resource|null + */ + public function getResource(): mixed + { + return $this->stream; + } + + + // ---------- Protected helper methods ---------------------------------------------------------------------------- + + /** + * Evaluate stream state. + */ + protected function evalStream(): void + { + if ($this->stream && $meta = $this->getMetadata()) { + $mode = substr($meta['mode'], 0, 2); + $this->readable = in_array($mode, self::$readmodes); + $this->writable = in_array($mode, self::$writemodes); + $this->seekable = $meta['seekable']; + return; + } + $this->readable = $this->writable = $this->seekable = false; + } + + /** + * Return underlying resource. + * @return resource + * @throws StreamException if closed. + */ + protected function getOpenResource(): mixed + { + if (!is_resource($this->stream)) { + throw new StreamException(StreamException::STREAM_DETACHED); + } + return $this->stream; + } +} diff --git a/vendor/phrity/net-stream/src/StreamCollection.php b/vendor/phrity/net-stream/src/StreamCollection.php new file mode 100644 index 0000000..fd13154 --- /dev/null +++ b/vendor/phrity/net-stream/src/StreamCollection.php @@ -0,0 +1,215 @@ + + */ +class StreamCollection implements Countable, Iterator +{ + protected ErrorHandler $handler; + /** @var array */ + private array $streams = []; + + /** + * Create new stream collection instance. + */ + public function __construct() + { + $this->handler = new ErrorHandler(); + } + + + // ---------- Collectors and selectors ---------------------------------------------------------------------------- + + /** + * Attach stream to collection. + * @param Stream $attach Stream to attach. + * @param string|null $key Definable name of stream. + * @return string Name of stream. + * @throws StreamException If already attached. + */ + public function attach(Stream $attach, string|null $key = null): string + { + if ($key && array_key_exists($key, $this->streams)) { + throw new StreamException(StreamException::COLLECT_KEY_CONFLICT, ['key' => $key]); + } + $key = $key ?: $this->createKey(); + $this->streams[$key] = $attach; + return $key; + } + + /** + * Detach stream from collection. + * @param Stream|string $detach Stream or name of stream to detach. + * @return bool If a stream was detached. + */ + public function detach(Stream|string $detach): bool + { + if (is_string($detach)) { + if (array_key_exists($detach, $this->streams)) { + unset($this->streams[$detach]); + return true; + } + } + if ($detach instanceof Stream) { + foreach ($this->streams as $key => $stream) { + if ($stream === $detach) { + unset($this->streams[$key]); + return true; + } + } + } + return false; + } + + /** + * Collect all readable streams into new collection. + * @return self New collection instance. + */ + public function getReadable(): self + { + $readables = new self(); + foreach ($this->streams as $key => $stream) { + if ($stream->isReadable()) { + $readables->attach($stream, $key); + } + } + return $readables; + } + + /** + * Collect all writable streams into new collection. + * @return self New collection instance. + */ + public function getWritable(): self + { + $writables = new self(); + foreach ($this->streams as $key => $stream) { + if ($stream->isWritable()) { + $writables->attach($stream, $key); + } + } + return $writables; + } + + /** + * Wait for redable content in stream collection. + * @param int<0, max>|float $timeout Timeout in seconds. + * @return self New collection instance. + * @throws InvalidArgumentException If invalid timeout. + */ + public function waitRead(int|float $timeout = 60): self + { + if ($timeout < 0) { + throw new InvalidArgumentException("Timeout must be 0 or more."); + } + $seconds = intval($timeout); + $microseconds = intval(round($timeout - $seconds, 6) * 1000000); + + $read = []; + foreach ($this->streams as $key => $stream) { + if ($stream->isReadable()) { + $read[$key] = $stream->getResource(); + } + } + if (empty($read)) { + return new self(); // Nothing to select + } + + $changed = $this->handler->with(function () use ($read, $seconds, $microseconds) { + $write = $oob = []; + /** @phpstan-ignore argument.type */ + stream_select($read, $write, $oob, $seconds, $microseconds); + return $read; + }, function (ErrorException $error) { + return []; // Ignore, but don't use result + }); + + $ready = new self(); + foreach ($changed as $key => $resource) { + $ready->attach($this->streams[$key], $key); + } + return $ready; + } + + + // ---------- Countable interface implementation ------------------------------------------------------------------ + + /** + * Count contained streams. + * @return int Number of streams in collection. + */ + public function count(): int + { + return count($this->streams); + } + + + // ---------- Iterator interface implementation ------------------------------------------------------------------- + + /** + * Return the current stream. + * @return Stream|null Current stream. + */ + public function current(): Stream|null + { + return current($this->streams) ?: null; + } + + /** + * Return the key of the current stream. + * @return string Current key. + */ + public function key(): string|null + { + return key($this->streams); + } + + /** + * Move forward to next stream. + */ + public function next(): void + { + next($this->streams); + } + + /** + * Rewind the Iterator to the first stream. + */ + public function rewind(): void + { + reset($this->streams); + } + + /** + * Checks if current position is valid. + * @return bool True if valid. + */ + public function valid(): bool + { + return array_key_exists(key($this->streams) ?? -1, $this->streams); + } + + + // ---------- Protected helper methods ---------------------------------------------------------------------------- + + /** + * Create unique key. + * @return string Unique key. + */ + protected function createKey(): string + { + do { + $key = bin2hex(random_bytes(16)); + } while (array_key_exists($key, $this->streams)); + return $key; + } +} diff --git a/vendor/phrity/net-stream/src/StreamException.php b/vendor/phrity/net-stream/src/StreamException.php new file mode 100644 index 0000000..f5f0367 --- /dev/null +++ b/vendor/phrity/net-stream/src/StreamException.php @@ -0,0 +1,84 @@ + */ + private static array $messages = [ + self::STREAM_DETACHED => 'Stream is detached.', + self::NOT_READABLE => 'Stream is not readable.', + self::NOT_WRITABLE => 'Stream is not writable.', + self::NOT_SEEKABLE => 'Stream is not seekable.', + self::FAIL_READ => 'Failed read() on stream.', + self::FAIL_WRITE => 'Failed write() on stream.', + self::FAIL_SEEK => 'Failed seek() on stream.', + self::FAIL_TELL => 'Failed tell() on stream.', + self::FAIL_CONTENTS => 'Failed getContents() on stream.', + self::FAIL_GETS => 'Failed gets() on stream.', + self::FAIL_SELECT => 'Failed select() on stream.', + self::CLIENT_CONNECT_ERR => 'Client could not connect to "{uri}".', + self::SCHEME_TRANSPORT => 'Scheme "{scheme}" is not supported.', + self::SCHEME_HANDLER => 'Could not handle scheme "{scheme}".', + self::SERVER_SOCKET_ERR => 'Could not create socket for "{uri}".', + self::SERVER_CLOSED => 'Server is closed.', + self::SERVER_ACCEPT_ERR => 'Could not accept on socket.', + self::COLLECT_KEY_CONFLICT => 'Stream with name "{key}" already attached.', + self::COLLECT_SELECT_ERR => 'Failed to select streams for reading.', + self::CONTEXT_SET_ERR => 'Failed to set option/param on context.', + ]; + + /** + * Create exception. + * @param int $code Error code + * @param array $data Additional data + * @param Throwable|null $previous Previous exception + */ + public function __construct(int $code, array $data = [], Throwable|null $previous = null) + { + $message = self::$messages[$code]; + foreach ($data as $key => $content) { + $message = str_replace('{' . $key . '}', $content, $message); + } + if ($previous) { + $message .= " ({$previous->getMessage()})"; + } + parent::__construct($message, $code, $previous); + } +} diff --git a/vendor/phrity/net-stream/src/StreamFactory.php b/vendor/phrity/net-stream/src/StreamFactory.php new file mode 100644 index 0000000..d37ed32 --- /dev/null +++ b/vendor/phrity/net-stream/src/StreamFactory.php @@ -0,0 +1,133 @@ + */ + private static array $modes = ['r', 'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+', 'c', 'c+', 'e']; + + private ErrorHandler $handler; + + /** + * Create new stream wrapper instance. + */ + public function __construct() + { + $this->handler = new ErrorHandler(); + } + + + // ---------- PSR-17 methods -------------------------------------------------------------------------------------- + + /** + * Create a new stream from a string. + * @param string $content String content with which to populate the stream. + * @return Stream A stream instance. + */ + public function createStream(string $content = ''): Stream + { + $resource = $this->createResource('php://temp', 'r+'); + fwrite($resource, $content); + return $this->createStreamFromResource($resource); + } + + /** + * Create a stream from an existing file. + * @param string $filename The filename or stream URI to use as basis of stream. + * @param string $mode The mode with which to open the underlying filename/stream. + * @throws InvalidArgumentException If the mode is invalid. + * @return Stream A stream instance. + */ + public function createStreamFromFile(string $filename, string $mode = 'r'): Stream + { + if (!in_array($mode, self::$modes)) { + throw new InvalidArgumentException("Invalid mode '{$mode}'."); + } + $resource = $this->createResource($filename, $mode); + return $this->createStreamFromResource($resource); + } + + /** + * Create a new stream from an existing resource. + * The stream MUST be readable and may be writable. + * @param resource $resource The PHP resource to use as the basis for the stream. + * @return Stream A stream instance. + */ + public function createStreamFromResource($resource): Stream + { + return new Stream($resource); + } + + + // ---------- Extensions ------------------------------------------------------------------------------------------ + + /** + * Create a new socket client. + * @param UriInterface $uri The URI to connect to. + * @return SocketClient A socket client instance. + */ + public function createSocketClient(UriInterface $uri, Context|null $context = null): SocketClient + { + return new SocketClient($uri, $context); + } + + /** + * Create a new socket server. + * @param UriInterface $uri The URI to create server on. + * @return SocketServer A socket server instance. + */ + public function createSocketServer(UriInterface $uri, Context|null $context = null): SocketServer + { + return new SocketServer($uri, $context); + } + + /** + * Create a new ocket stream from an existing resource. + * The stream MUST be readable and may be writable. + * @param resource $resource The PHP resource to use as the basis for the stream. + * @return SocketStream A socket stream instance. + */ + public function createSocketStreamFromResource($resource): SocketStream + { + return new SocketStream($resource); + } + + /** + * Create a new stream collection. + * @return StreamCollection A stream collection. + */ + public function createStreamCollection(): StreamCollection + { + return new StreamCollection(); + } + + + // ---------- Helpers --------------------------------------------------------------------------------------------- + + /** + * @return resource + * @throws RuntimeException If fails to open resource + */ + private function createResource(string $filename, string $mode) + { + /** @throws RuntimeException */ + return $this->handler->with(function () use ($filename, $mode) { + /** @var resource $resource */ + $resource = fopen($filename, $mode); + return $resource; + }, new RuntimeException("Could not open '{$filename}'.")); + } +} diff --git a/vendor/phrity/net-uri/composer.json b/vendor/phrity/net-uri/composer.json new file mode 100644 index 0000000..c0f5294 --- /dev/null +++ b/vendor/phrity/net-uri/composer.json @@ -0,0 +1,37 @@ +{ + "name": "phrity/net-uri", + "type": "library", + "description": "PSR-7 Uri and PSR-17 UriFactory implementation", + "homepage": "https://phrity.sirn.se/net-uri", + "keywords": ["uri", "uri factory", "PSR-7", "PSR-17"], + "license": "MIT", + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "autoload": { + "psr-4": { + "Phrity\\Net\\": "src/" + } + }, + "require": { + "php": "^8.1", + "ext-mbstring": "*", + "phrity/comparison": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 | ^2.0" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "phrity/util-errorhandler": "^1.1", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggest": { + "ext-intl": "Enables IDN conversion for non-ASCII domains" + } +} diff --git a/vendor/phrity/net-uri/src/Uri.php b/vendor/phrity/net-uri/src/Uri.php new file mode 100644 index 0000000..5d28b03 --- /dev/null +++ b/vendor/phrity/net-uri/src/Uri.php @@ -0,0 +1,710 @@ + Net > Uri + * @see https://www.rfc-editor.org/rfc/rfc3986 + * @see https://www.php-fig.org/psr/psr-7/#35-psrhttpmessageuriinterface + */ + +namespace Phrity\Net; + +use InvalidArgumentException; +use JsonSerializable; +use Phrity\Comparison\{ + Equalable, + IncomparableException, +}; +use Psr\Http\Message\UriInterface; +use Stringable; + +/** + * Net\Uri class. + */ +class Uri implements Equalable, JsonSerializable, Stringable, UriInterface +{ + public const REQUIRE_PORT = 1; // Always include port, explicit or default + public const ABSOLUTE_PATH = 2; // Enforce absolute path + public const NORMALIZE_PATH = 4; // Normalize path + public const IDNA = 8; // @deprecated, replaced by IDN_ENCODE + public const IDN_ENCODE = 16; // IDN-encode host + public const IDN_DECODE = 32; // IDN-decode host + public const URI_DECODE = 64; // Decoded URI + public const URI_ENCODE = 128; // Minimal URI encoded + public const URI_ENCODE_3986 = 256; // URI encoded RFC 3986 + + private const RE_MAIN = '!^(?P(?P[^:/?#]+):)?(?P//(?P[^/?#]*))?' + . '(?P[^?#]*)(?P\?(?P[^#]*))?(?P#(?P.*))?$!'; + private const RE_AUTH = '!^(?P(?P[^:/?#]+)(?P:(?P[^:/?#]+))?@)?' + . '(?P[^:/?#]*|\[[^/?#]*\])(?P:(?P[0-9]*))?$!'; + + /** @var array $portDefaults */ + private static array $portDefaults = [ + 'acap' => 674, + 'afp' => 548, + 'dict' => 2628, + 'dns' => 53, + 'ftp' => 21, + 'git' => 9418, + 'gopher' => 70, + 'http' => 80, + 'https' => 443, + 'imap' => 143, + 'ipp' => 631, + 'ipps' => 631, + 'irc' => 194, + 'ircs' => 6697, + 'ldap' => 389, + 'ldaps' => 636, + 'mms' => 1755, + 'msrp' => 2855, + 'mtqp' => 1038, + 'nfs' => 111, + 'nntp' => 119, + 'nntps' => 563, + 'pop' => 110, + 'prospero' => 1525, + 'redis' => 6379, + 'rsync' => 873, + 'rtsp' => 554, + 'rtsps' => 322, + 'rtspu' => 5005, + 'sftp' => 22, + 'smb' => 445, + 'snmp' => 161, + 'ssh' => 22, + 'svn' => 3690, + 'telnet' => 23, + 'ventrilo' => 3784, + 'vnc' => 5900, + 'wais' => 210, + 'ws' => 80, + 'wss' => 443, + ]; + + private string $scheme = ''; + private bool $authority = false; + private string $host = ''; + private int|null $port = null; + private string $user = ''; + private string|null $pass = null; + private string $path = ''; + private string $query = ''; + private string $fragment = ''; + + /** + * Create new URI instance using a string + * @param string $uriString URI as string + * @throws InvalidArgumentException If the given URI cannot be parsed + */ + public function __construct(string $uriString = '') + { + $this->parse($uriString); + } + + + // ---------- PSR-7 getters --------------------------------------------------------------------------------------- + + /** + * Retrieve the scheme component of the URI. + * @param int $flags Optional modifier flags + * @return string The URI scheme + */ + public function getScheme(int $flags = 0): string + { + return $this->scheme; + } + + /** + * Retrieve the authority component of the URI. + * @param int $flags Optional modifier flags + * @return string The URI authority, in "[user-info@]host[:port]" format + */ + public function getAuthority(int $flags = 0): string + { + $host = $this->formatComponent($this->getHost($flags)); + if ($host === '') { + return ''; + } + $userinfo = $this->formatComponent($this->getUserInfo($flags), '', '@'); + $port = $this->formatComponent($this->getPort($flags), ':'); + return "{$userinfo}{$host}{$port}"; + } + + /** + * Retrieve the user information component of the URI. + * @param int $flags Optional modifier flags + * @return string The URI user information, in "username[:password]" format + */ + public function getUserInfo(int $flags = 0): string + { + $user = $this->formatComponent($this->uriEncode($this->user, $flags)); + $pass = $this->formatComponent($this->uriEncode($this->pass ?? '', $flags), ':'); + return $user === '' ? '' : "{$user}{$pass}"; + } + + /** + * Retrieve the host component of the URI. + * @param int $flags Optional modifier flags + * @return string The URI host + */ + public function getHost(int $flags = 0): string + { + if ($flags & self::IDNA) { + trigger_error("Flag IDNA is deprecated; use IDN_ENCODE instead", E_USER_DEPRECATED); + return $this->idnEncode($this->host); + } + if ($flags & self::IDN_ENCODE) { + return $this->idnEncode($this->host); + } + if ($flags & self::IDN_DECODE) { + return $this->idnDecode($this->host); + } + return $this->host; + } + + /** + * Retrieve the port component of the URI. + * @param int $flags Optional modifier flags + * @return null|int The URI port + */ + public function getPort(int $flags = 0): int|null + { + $default = self::$portDefaults[$this->scheme] ?? null; + if ($flags & self::REQUIRE_PORT) { + return $this->port !== null ? $this->port : $default; + } + return $this->port === $default ? null : $this->port; + } + + /** + * Retrieve the path component of the URI. + * @param int $flags Optional modifier flags + * @return string The URI path + */ + public function getPath(int $flags = 0): string + { + $path = $this->path; + if ($flags & self::NORMALIZE_PATH) { + $path = $this->normalizePath($path); + } + if ($flags & self::ABSOLUTE_PATH && substr($path, 0, 1) !== '/') { + $path = "/{$path}"; + } + return $this->uriEncode($path, $flags, '\/:@'); + } + + /** + * Retrieve the query string of the URI. + * @param int $flags Optional modifier flags + * @return string The URI query string + */ + public function getQuery(int $flags = 0): string + { + return $this->uriEncode($this->query, $flags, '\/:@?'); + } + + /** + * Retrieve the fragment component of the URI. + * @param int $flags Optional modifier flags + * @return string The URI fragment + */ + public function getFragment(int $flags = 0): string + { + return $this->uriEncode($this->fragment, $flags, '\/:@?'); + } + + + // ---------- PSR-7 setters --------------------------------------------------------------------------------------- + + /** + * Return an instance with the specified scheme. + * @param string $scheme The scheme to use with the new instance + * @param int $flags Optional modifier flags + * @return self A new instance with the specified scheme + * @throws InvalidArgumentException for invalid schemes + * @throws InvalidArgumentException for unsupported schemes + */ + public function withScheme(string $scheme, int $flags = 0): self + { + $clone = $this->clone($flags); + $clone->setScheme($scheme, $flags); + return $clone; + } + + /** + * Return an instance with the specified user information. + * @param string $user The user name to use for authority + * @param null|string $password The password associated with $user + * @param int $flags Optional modifier flags + * @return self A new instance with the specified user information + */ + public function withUserInfo(string $user, string|null $password = null, int $flags = 0): self + { + $clone = $this->clone($flags); + $clone->setUserInfo($user, $password); + return $clone; + } + + /** + * Return an instance with the specified host. + * @param string $host The hostname to use with the new instance + * @param int $flags Optional modifier flags + * @return self A new instance with the specified host + * @throws InvalidArgumentException for invalid hostnames + */ + public function withHost(string $host, int $flags = 0): self + { + $clone = $this->clone($flags); + $clone->setHost($host, $flags); + return $clone; + } + + /** + * Return an instance with the specified port. + * @param null|int $port The port to use with the new instance + * @param int $flags Optional modifier flags + * @return self A new instance with the specified port + * @throws InvalidArgumentException for invalid ports + */ + public function withPort(int|null $port, int $flags = 0): self + { + $clone = $this->clone($flags); + $clone->setPort($port, $flags); + return $clone; + } + + /** + * Return an instance with the specified path. + * @param string $path The path to use with the new instance + * @param int $flags Optional modifier flags + * @return self A new instance with the specified path + * @throws InvalidArgumentException for invalid paths + */ + public function withPath(string $path, int $flags = 0): self + { + $clone = $this->clone($flags); + $clone->setPath($path, $flags); + return $clone; + } + + /** + * Return an instance with the specified query string. + * @param string $query The query string to use with the new instance + * @param int $flags Optional modifier flags + * @return self A new instance with the specified query string + * @throws InvalidArgumentException for invalid query strings + */ + public function withQuery(string $query, int $flags = 0): self + { + $clone = $this->clone($flags); + $clone->setQuery($query, $flags); + return $clone; + } + + /** + * Return an instance with the specified URI fragment. + * @param string $fragment The fragment to use with the new instance + * @param int $flags Optional modifier flags + * @return self A new instance with the specified fragment + */ + public function withFragment(string $fragment, int $flags = 0): self + { + $clone = $this->clone($flags); + $clone->setFragment($fragment, $flags); + return $clone; + } + + + // ---------- PSR-7 string & Stringable --------------------------------------------------------------------------- + + /** + * Return the string representation as a URI reference. + * @return string + */ + public function __toString(): string + { + return $this->toString(); + } + + + // ---------- JsonSerializable ------------------------------------------------------------------------------------ + + /** + * Return JSON encode value as URI reference. + * @return string + */ + public function jsonSerialize(): string + { + return $this->toString(); + } + + + // ---------- Equalable ------------------------------------------------------------------------------------------ + + /** + * Return JSON encode value as URI reference. + * @param UriInterface|string $compareWith + * @return bool + */ + public function equals(mixed $compareWith): bool + { + if (!$compareWith instanceof UriInterface && !is_string($compareWith)) { + throw new IncomparableException(sprintf("Can not compare with type '%s'", get_debug_type($compareWith))); + } + $flags = self::REQUIRE_PORT | self::NORMALIZE_PATH | self::IDN_ENCODE; + $them = $compareWith instanceof self ? $compareWith : new self((string)$compareWith); + return $this->toString($flags) == $them->toString($flags); + } + + + // ---------- Extensions ------------------------------------------------------------------------------------------ + + /** + * Return the string representation as a URI reference. + * @param int $flags Optional modifier flags + * @param string $format Optional format specification + * @return string + */ + public function toString(int $flags = 0, string $format = '{scheme}{authority}{path}{query}{fragment}'): string + { + $pathFlags = ($this->authority && $this->path ? self::ABSOLUTE_PATH : 0) | $flags; + return str_replace([ + '{scheme}', + '{authority}', + '{path}', + '{query}', + '{fragment}', + ], [ + $this->formatComponent($this->getScheme($flags), '', ':'), + $this->authority ? "//{$this->formatComponent($this->getAuthority($flags))}" : '', + $this->formatComponent($this->getPath($pathFlags)), + $this->formatComponent($this->getQuery(), '?'), + $this->formatComponent($this->getFragment(), '#'), + ], $format); + } + + /** + * Get compontsns as array; as parse_url() method + * @param int $flags Optional modifier flags + * @return array + */ + public function getComponents(int $flags = 0): array + { + return array_filter([ + 'scheme' => $this->getScheme($flags), + 'host' => $this->getHost($flags), + 'port' => $this->getPort($flags | self::REQUIRE_PORT), + 'user' => $this->user, + 'pass' => $this->pass, + 'path' => $this->getPath($flags), + 'query' => $this->getQuery($flags), + 'fragment' => $this->getFragment($flags), + ]); + } + + /** + * Return an instance with the specified compontents set. + * @param array $components + * @param int<0, 256> $flags + * @return self A new instance with the specified components + */ + public function withComponents(array $components, int $flags = 0): self + { + $clone = $this->clone($flags); + foreach ($components as $component => $value) { + switch ($component) { + case 'port': + $clone->setPort($value, $flags); + break; + case 'scheme': + $clone->setScheme($value, $flags); + break; + case 'host': + $clone->setHost($value, $flags); + break; + case 'path': + $clone->setPath($value, $flags); + break; + case 'query': + $clone->setQuery($value, $flags); + break; + case 'fragment': + $clone->setFragment($value, $flags); + break; + case 'userInfo': + $clone->setUserInfo(...$value); + break; + default: + throw new InvalidArgumentException("Invalid URI component: '{$component}'"); + } + } + return $clone; + } + + /** + * Return all query items (if any) as associative array. + * @param int $flags Optional modifier flags + * @return array Query items + */ + public function getQueryItems(int $flags = 0): array + { + parse_str($this->getQuery(), $result); + return $result; + } + + /** + * Return query item value for named query item, or null if not present. + * @param string $name Name of query item to retrieve + * @param int $flags Optional modifier flags + * @return string|null|array Query item value + */ + public function getQueryItem(string $name, int $flags = 0): array|string|null + { + parse_str($this->getQuery(), $result); + return $result[$name] ?? null; + } + + /** + * Add query items as associative array that will be merged qith current items. + * @param array $items Array of query items to add + * @param int $flags Optional modifier flags + * @return self A new instance with the added query items + */ + public function withQueryItems(array $items, int $flags = 0): self + { + $clone = $this->clone($flags); + $clone->setQuery(http_build_query( + $this->queryMerge($this->getQueryItems($flags), $items), + '', + null, + PHP_QUERY_RFC3986 + ), $flags); + return $clone; + } + + /** + * Add query item value for named query item + * @param string $name Name of query item to add + * @param string|null|array $value Value of query item to add + * @param int $flags Optional modifier flags + * @return self A new instance with the added query items + */ + public function withQueryItem(string $name, array|string|null $value, int $flags = 0): self + { + return $this->withQueryItems([$name => $value], $flags); + } + + + // ---------- Protected helper methods ---------------------------------------------------------------------------- + + protected function setPort(int|null $port, int $flags = 0): void + { + if ($port !== null && ($port < 0 || $port > 65535)) { + throw new InvalidArgumentException("Invalid port '{$port}'"); + } + $this->port = $port; + } + + protected function setScheme(string $scheme, int $flags = 0): void + { + $pattern = '/^[a-z][a-z0-9-+.]*$/i'; + if ($scheme !== '' && preg_match($pattern, $scheme) == 0) { + throw new InvalidArgumentException("Invalid scheme '{$scheme}': Should match {$pattern}"); + } + $this->scheme = mb_strtolower($scheme); + } + + protected function setHost(string $host, int $flags = 0): void + { + $this->authority = $this->authority || $host !== ''; + if ($flags & self::IDNA) { + trigger_error("Flag IDNA is deprecated; use IDN_ENCODE instead", E_USER_DEPRECATED); + $host = $this->idnEncode($host); + } + if ($flags & self::IDN_ENCODE) { + $host = $this->idnEncode($host); + } + if ($flags & self::IDN_DECODE) { + $host = $this->idnDecode($host); + } + $this->host = mb_strtolower($host); + } + + protected function setPath(string $path, int $flags = 0): void + { + if ($flags & self::NORMALIZE_PATH) { + $path = $this->normalizePath($path); + } + if ($flags & self::ABSOLUTE_PATH && substr($path, 0, 1) !== '/') { + $path = "/{$path}"; + } + $this->path = $this->uriDecode($path); + } + + protected function setQuery(string $query, int $flags = 0): void + { + $this->query = $this->uriDecode($query); + } + + protected function setFragment(string $fragment, int $flags = 0): void + { + $this->fragment = $this->uriDecode($fragment); + } + + protected function setUser(string $user, int $flags = 0): void + { + $this->user = $this->uriDecode($user); + } + + protected function setPassword(string|null $pass, int $flags = 0): void + { + $this->pass = $pass === null ? null : $this->uriDecode($pass); + } + + protected function setUserInfo(string $user = '', string|null $pass = null, int $flags = 0): void + { + $this->setUser($user); + $this->setPassword($pass); + } + + + // ---------- Private helper methods ------------------------------------------------------------------------------ + + private function parse(string $uriString = ''): void + { + if ($uriString === '') { + return; + } + preg_match(self::RE_MAIN, $uriString, $main); + $this->authority = !empty($main['authorityc']); + $this->setScheme($main['scheme'] ?? ''); + $this->setPath($main['path'] ?? ''); + $this->setQuery($main['query'] ?? ''); + $this->setFragment($main['fragment'] ?? ''); + if ($this->authority && !empty($main['authority'])) { + preg_match(self::RE_AUTH, $main['authority'], $auth); + if (empty($auth)) { + throw new InvalidArgumentException("Invalid 'authority'."); + } + if ($auth['host'] === '' && $auth['user'] !== '') { + throw new InvalidArgumentException("Invalid 'authority'."); + } + $this->setUser($auth['user'] ?? ''); + $this->setPassword($auth['pass'] ?? null); + $this->setHost($auth['host'] ?? ''); + $this->setPort(isset($auth['port']) ? (int)$auth['port'] : null); + } + } + + private function clone(int $flags = 0): self + { + $clone = clone $this; + if ($flags & self::REQUIRE_PORT) { + $clone->setPort($this->getPort(self::REQUIRE_PORT), $flags); + } + return $clone; + } + + private function uriEncode(string $source, int $flags = 0, string $keep = ''): string + { + if ($flags & self::URI_DECODE) { + return $source; + } + + $unreserved = 'a-zA-Z0-9_\-\.~'; + $subdelim = '!\$&\'\(\)\*\+,;='; + $char = '\pL'; + $pct = '%(?![A-Fa-f0-9]{2}))'; + + $re = "/(?:[^%{$unreserved}{$subdelim}{$keep}]+|{$pct}/u"; + + if ($flags & self::URI_ENCODE) { + $re = "/(?:[^%{$unreserved}{$subdelim}{$keep}{$char}]+|{$pct}/u"; + } + return preg_replace_callback($re, function ($matches) { + return rawurlencode($matches[0]); + }, $source) ?? $source; + } + + private function uriDecode(string $source): string + { + $re = "/(%[A-Fa-f0-9]{2})/u"; + return preg_replace_callback($re, function ($matches) { + return rawurldecode($matches[0]); + }, $source) ?? $source; + } + + private function formatComponent(string|int|null $value, string $before = '', string $after = ''): string + { + $string = strval($value); + return $string === '' ? '' : "{$before}{$string}{$after}"; + } + + private function normalizePath(string $path): string + { + $result = []; + preg_match_all('!([^/]*/|[^/]*$)!', $path, $items); + foreach ($items[0] as $item) { + switch ($item) { + case '': + case './': + case '.': + break; // just skip + case '/': + if (empty($result)) { + array_push($result, $item); // add + } + break; + case '..': + case '../': + if (empty($result) || end($result) == '../') { + array_push($result, $item); // add + } else { + array_pop($result); // remove previous + } + break; + default: + array_push($result, $item); // add + } + } + return implode('', $result); + } + + private function idnEncode(string $value): string + { + if ($value === '' || !function_exists('idn_to_ascii')) { + return $value; // Can't convert, but don't cause exception + } + return idn_to_ascii($value, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46) ?: $value; + } + + private function idnDecode(string $value): string + { + if ($value === '' || !function_exists('idn_to_utf8')) { + return $value; // Can't convert, but don't cause exception + } + return idn_to_utf8($value, IDNA_NONTRANSITIONAL_TO_UNICODE, INTL_IDNA_VARIANT_UTS46) ?: $value; + } + + /** + * @param array $a + * @param array $b + * @return array + */ + private function queryMerge(array $a, array $b): array + { + foreach ($b as $key => $value) { + if (is_int($key)) { + $a[] = $value; + } elseif (is_array($value)) { + $a[$key] = $this->queryMerge($a[$key] ?? [], $b[$key] ?? []); + } elseif (is_scalar($value)) { + $a[$key] = $this->uriDecode($b[$key]); + } else { + unset($a[$key]); + } + } + return $a; + } +} diff --git a/vendor/phrity/net-uri/src/UriFactory.php b/vendor/phrity/net-uri/src/UriFactory.php new file mode 100644 index 0000000..4b9b91d --- /dev/null +++ b/vendor/phrity/net-uri/src/UriFactory.php @@ -0,0 +1,47 @@ + Net > Uri + * @see https://www.rfc-editor.org/rfc/rfc3986 + * @see https://www.php-fig.org/psr/psr-17/#26-urifactoryinterface + */ + +namespace Phrity\Net; + +use InvalidArgumentException; +use Psr\Http\Message\{ + UriFactoryInterface, + UriInterface +}; + +/** + * Net\UriFactory class. + */ +class UriFactory implements UriFactoryInterface +{ + // ---------- PSR-7 methods --------------------------------------------------------------------------------------- + + /** + * Create a new URI. + * @param string $uri The URI to parse. + * @throws InvalidArgumentException If the given URI cannot be parsed + */ + public function createUri(string $uri = ''): UriInterface + { + return new Uri($uri); + } + + + // ---------- Extensions ------------------------------------------------------------------------------------------ + + /** + * Create a new URI from existing. + * @param UriInterface $uri A URI instance to create from. + * @throws InvalidArgumentException If the given URI cannot be parsed + */ + public function createUriFromInterface(UriInterface $uri): UriInterface + { + return new Uri($uri->__toString()); + } +} diff --git a/vendor/phrity/util-errorhandler/composer.json b/vendor/phrity/util-errorhandler/composer.json new file mode 100644 index 0000000..29a7ae2 --- /dev/null +++ b/vendor/phrity/util-errorhandler/composer.json @@ -0,0 +1,34 @@ +{ + "name": "phrity/util-errorhandler", + "type": "library", + "description": "Inline error handler; catch and resolve errors for code block.", + "homepage": "https://phrity.sirn.se/util-errorhandler", + "keywords": ["error", "warning"], + "license": "MIT", + "authors": [ + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "autoload": { + "psr-4": { + "Phrity\\Util\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Phrity\\Util\\Tests\\": "tests/" + } + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "squizlabs/php_codesniffer": "^3.5" + } +} diff --git a/vendor/phrity/util-errorhandler/src/ErrorHandler.php b/vendor/phrity/util-errorhandler/src/ErrorHandler.php new file mode 100644 index 0000000..70534db --- /dev/null +++ b/vendor/phrity/util-errorhandler/src/ErrorHandler.php @@ -0,0 +1,131 @@ + Util > ErrorHandler + */ + +namespace Phrity\Util; + +use Closure; +use ErrorException; +use Throwable; + +/** + * ErrorHandler utility class. + * Allows catching and resolving errors inline. + */ +class ErrorHandler +{ + /* ----------------- Public methods ---------------------------------------------- */ + + /** + * Set error handler to run until removed. + * @param Closure|Throwable|null $handling + * - If null, handler will throw ErrorException + * - If Throwable $t, throw $t with ErrorException attached as previous + * - If callable, will invoke callback with ErrorException as argument + * @param int $levels Error levels to catch, all errors by default + * @return (callable(): mixed)|null Previously registered error handler, if any + */ + public function set(Closure|Throwable|null $handling = null, int $levels = E_ALL): callable|null + { + return set_error_handler($this->getHandler($handling), $levels); + } + + /** + * Remove error handler. + * @return bool True if removed + */ + public function restore(): bool + { + return restore_error_handler(); + } + + /** + * Run code with error handling, breaks on first encountered error. + * @param callable $callback The code to run + * @param Closure|Throwable|null $handling + * - If null, handler will throw ErrorException + * - If Throwable $t, throw $t with ErrorException attached as previous + * - If callable, will invoke callback with ErrorException as argument + * @param int $levels Error levels to catch, all errors by default + * @return mixed Return what $callback returns, or what $handling retuns on error + */ + public function with(callable $callback, Closure|Throwable|null $handling = null, int $levels = E_ALL): mixed + { + $error = null; + $result = null; + try { + $this->set(null, $levels); + $result = $callback(); + } catch (ErrorException $e) { + $error = $this->handle($handling, $e); + } finally { + $this->restore(); + } + return $error ?? $result; + } + + /** + * Run code with error handling, comletes code before handling errors + * @param callable $callback The code to run + * @param Closure|Throwable|null $handling + * - If null, handler will throw ErrorException + * - If Throwable $t, throw $t with ErrorException attached as previous + * - If callable, will invoke callback with ErrorException as argument + * @param int $levels Error levels to catch, all errors by default + * @return mixed Return what $callback returns, or what $handling retuns on error + */ + public function withAll(callable $callback, Closure|Throwable|null $handling = null, int $levels = E_ALL): mixed + { + $errors = []; + $this->set(function (ErrorException $e) use (&$errors) { + $errors[] = $e; + }, $levels); + $result = $callback(); + $this->restore(); + $error = empty($errors) ? null : $this->handle($handling, $errors, $result); + return $error ?? $result; + } + + + /* ----------------- Private helpers --------------------------------------------- */ + + // Get handler function + private function getHandler(Closure|Throwable|null $handling): Closure + { + return function ($severity, $message, $file, $line) use ($handling) { + $error = new ErrorException($message, 0, $severity, $file, $line); + $this->handle($handling, $error); + }; + } + + /** + * Handle error according to $handlig type + * @param Closure|Throwable|null $handling + * @param ErrorException|non-empty-array $error + * @mixed $result + * @return mixed + * @throws Throwable + */ + private function handle(Closure|Throwable|null $handling, ErrorException|array $error, mixed $result = null): mixed + { + if (is_callable($handling)) { + return $handling($error, $result); + } + if (is_array($error)) { + $error = array_shift($error); + } + if ($handling instanceof Throwable) { + try { + /* @phpstan-ignore finally.exitPoint */ + throw $error; + } finally { + /* @phpstan-ignore finally.exitPoint */ + throw $handling; + } + } + throw $error; + } +} diff --git a/vendor/textalk/websocket/COPYING.md b/vendor/phrity/websocket/LICENSE.md similarity index 100% rename from vendor/textalk/websocket/COPYING.md rename to vendor/phrity/websocket/LICENSE.md diff --git a/vendor/phrity/websocket/composer.json b/vendor/phrity/websocket/composer.json new file mode 100644 index 0000000..62b3164 --- /dev/null +++ b/vendor/phrity/websocket/composer.json @@ -0,0 +1,50 @@ +{ + "name": "phrity/websocket", + "type": "library", + "description": "WebSocket client and server", + "homepage": "https://phrity.sirn.se/websocket", + "keywords": ["websocket", "client", "server"], + "license": "ISC", + "authors": [ + { + "name": "Fredrik Liljegren" + }, + { + "name": "Sören Jensen", + "email": "sirn@sirn.se", + "homepage": "https://phrity.sirn.se" + } + ], + "autoload": { + "psr-4": { + "WebSocket\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "WebSocket\\Test\\": "tests/mock/" + } + }, + "require": { + "php": "^8.1", + "phrity/http": "^1.0", + "phrity/net-uri": "^2.1", + "phrity/net-stream": "^2.3", + "psr/http-message": "^1.1 | ^2.0", + "psr/log": "^1.0 | ^2.0 | ^3.0" + }, + "require-dev": { + "guzzlehttp/psr7": "^2.0", + "php-coveralls/php-coveralls": "^2.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^10.0 | ^11.0 | ^12.0", + "phrity/logger-console": "^1.0", + "phrity/net-mock": "^2.3", + "phrity/util-errorhandler": "^1.1", + "robiningelbrecht/phpunit-coverage-tools": "^1.9", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggests": { + "ext-zlib": "Required for per-message deflate compression" + } +} diff --git a/vendor/phrity/websocket/docu.json b/vendor/phrity/websocket/docu.json new file mode 100644 index 0000000..4331769 --- /dev/null +++ b/vendor/phrity/websocket/docu.json @@ -0,0 +1,102 @@ +[ + { + "name": "Overview", + "source": "README.md" + }, + { + "name": "Entry points", + "content": [ + { + "name": "Client", + "source": "docs/Client.md" + }, + { + "name": "Server", + "source": "docs/Server.md" + }, + ], + "name": "Resources", + "content": [ + { + "name": "Connection", + "source": "docs/Connection.md" + }, + { + "name": "Listener", + "source": "docs/Listener.md" + }, + { + "name": "Message", + "source": "docs/Message.md" + }, + { + "name": "Middleware", + "source": "docs/Middleware.md", + "content": [ + { + "name": "Callback", + "source": "docs/Middleware/Callback.md" + }, + { + "name": "Close Handler", + "source": "docs/Middleware/CloseHandler.md" + }, + { + "name": "Compression Extension", + "source": "docs/Middleware/CompressionExtension.md" + }, + { + "name": "Follow Redirect", + "source": "docs/Middleware/FollowRedirect.md" + }, + { + "name": "Ping Interval", + "source": "docs/Middleware/PingInterval.md" + }, + { + "name": "Ping Responder", + "source": "docs/Middleware/PingResponder.md" + }, + { + "name": "Subprotocol Negotiation", + "source": "docs/Middleware/SubprotocolNegotiation.md" + }, + { + "name": "Creating your own middleware", + "source": "docs/Middleware/Creating.md" + }, + ] + }, + ], + "name": "Developer resources", + "content": [ + { + "name": "Changelog", + "source": "docs/Changelog.md" + }, + { + "name": "Contributing", + "source": "docs/Contributing.md" + }, + { + "name": "Examples", + "source": "docs/Examples.md" + }, + { + "name": "Class synopsis", + "source": "docs/Class_Synopsis.md" + }, + ], + "name": "Migration", + "content": [ + { + "name": "Migration v2 -> v3", + "source": "docs/Migrate_2_3.md" + }, + ] + }, + { + "name": "License", + "source": "LICENSE.md" + } +] \ No newline at end of file diff --git a/vendor/phrity/websocket/src/Client.php b/vendor/phrity/websocket/src/Client.php new file mode 100644 index 0000000..95be629 --- /dev/null +++ b/vendor/phrity/websocket/src/Client.php @@ -0,0 +1,667 @@ + */ + use ListenerTrait; + use LoggerAwareTrait; + use SendMethodsTrait; + use StringableTrait; + + // Settings + /** @var int<0, max>|float $timeout */ + private int|float $timeout = 60; + /** @var int<1, max> $frameSize */ + private int $frameSize = 4096; + private bool $persistent = false; + private Context $context; + /** @var array $headers */ + private array $headers = []; + + // Internal resources + private StreamFactory $streamFactory; + private Uri $socketUri; + private Connection|null $connection = null; + /** @var array $middlewares */ + private array $middlewares = []; + private StreamCollection|null $streams = null; + private bool $running = false; + private HttpFactory $httpFactory; + + + /* ---------- Magic methods ------------------------------------------------------------------------------------ */ + + /** + * @param UriInterface|string $uri A ws/wss-URI + */ + public function __construct(UriInterface|string $uri) + { + $this->socketUri = $this->parseUri($uri); + $this->initLogger(); + $this->context = new Context(); + $this->setStreamFactory(new StreamFactory()); + $this->httpFactory = new DefaultHttpFactory(); + } + + /** + * Get string representation of instance. + * @return string String representation + */ + public function __toString(): string + { + return $this->stringable('%s', $this->connection ? $this->socketUri->__toString() : 'closed'); + } + + + /* ---------- Configuration ------------------------------------------------------------------------------------ */ + + /** + * Set stream factory to use. + * @param StreamFactory $streamFactory + * @return self + */ + public function setStreamFactory(StreamFactory $streamFactory): self + { + $this->streamFactory = $streamFactory; + return $this; + } + + /** + * Set HTTP factory to use. + * @param HttpFactory $httpFactory + * @return self + */ + public function setHttpFactory(HttpFactory $httpFactory): self + { + $this->httpFactory = $httpFactory; + return $this; + } + + /** + * Set logger. + * @param LoggerInterface $logger Logger implementation + */ + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $logger; + if ($this->connection) { + $this->connection->setLogger($this->logger); + } + } + + /** + * Set timeout. + * @param int<0, max>|float $timeout Timeout in seconds + * @return self + * @throws InvalidArgumentException If invalid timeout provided + */ + public function setTimeout(int|float $timeout): self + { + if ($timeout < 0) { + throw new InvalidArgumentException("Invalid timeout '{$timeout}' provided"); + } + $this->timeout = $timeout; + if ($this->connection) { + $this->connection->setTimeout($timeout); + } + return $this; + } + + /** + * Get timeout. + * @return int<0, max>|float Timeout in seconds + */ + public function getTimeout(): int|float + { + return $this->timeout; + } + + /** + * Set frame size. + * @param int<1, max> $frameSize Max frame payload size in bytes + * @return self + * @throws InvalidArgumentException If invalid frameSize provided + */ + public function setFrameSize(int $frameSize): self + { + if ($frameSize < 1) { + throw new InvalidArgumentException("Invalid frameSize '{$frameSize}' provided"); + } + $this->frameSize = $frameSize; + if ($this->connection) { + $this->connection->setFrameSize($frameSize); + } + return $this; + } + + /** + * Get frame size. + * @return int Frame size in bytes + */ + public function getFrameSize(): int + { + return $this->frameSize; + } + + /** + * Set connection persistence. + * @param bool $persistent True for persistent connection. + * @return self + */ + public function setPersistent(bool $persistent): self + { + $this->persistent = $persistent; + return $this; + } + + /** + * Set stream context. + * @param Context|array $context Context or options as array + * @see https://www.php.net/manual/en/context.php + * @return self + */ + public function setContext(Context|array $context): self + { + if ($context instanceof Context) { + $this->context = $context; + } else { + $this->context->setOptions($context); + trigger_error('Calling Client.setContext with array is deprecated, use Context class.', E_USER_DEPRECATED); + } + return $this; + } + + /** + * Get current stream context. + * @return Context + */ + public function getContext(): Context + { + return $this->context; + } + + /** + * Add header for handshake. + * @param string $name Header name + * @param string $content Header content + * @return self + */ + public function addHeader(string $name, string $content): self + { + $this->headers[$name] = $content; + return $this; + } + + /** + * Add a middleware. + * @param MiddlewareInterface $middleware + * @return self + */ + public function addMiddleware(MiddlewareInterface $middleware): self + { + $this->middlewares[] = $middleware; + if ($this->connection) { + $this->connection->addMiddleware($middleware); + } + return $this; + } + + + /* ---------- Messaging operations ----------------------------------------------------------------------------- */ + + /** + * Send message. + * @template T of Message + * @param T $message + * @return T + */ + public function send(Message $message): Message + { + return $this->connection()->pushMessage($message); + } + + /** + * Receive message. + * Note that this operation will block reading. + * @return Message + */ + public function receive(): Message + { + return $this->connection()->pullMessage(); + } + + + /* ---------- Listener operations ------------------------------------------------------------------------------ */ + + /** + * Start client listener. + * @throws ExceptionInterface On high level error + * @throws Throwable On low level error + */ + public function start(int|float|null $timeout = null): void + { + // Check if running + if ($this->running) { + $this->logger->warning("[client] Client is already running"); + return; + } + $this->running = true; + $reconnect = false; + $this->logger->info("[client] Client is running"); + + $connection = $this->connection(); + + // Run handler + while ($this->running) { + /** @var StreamCollection */ + $streams = $this->streams; + try { + // Get streams with readable content + $readables = $streams->waitRead($timeout ?? $this->timeout); + foreach ($readables as $key => $readable) { + try { + // Read from connection + $message = $connection->pullMessage(); + $this->dispatch($message->getOpcode(), [$this, $connection, $message]); + } catch (MessageLevelInterface $e) { + // Error, but keep connection open + $this->logger->error("[client] {$e->getMessage()}", ['exception' => $e]); + $this->dispatch('error', [$this, $connection, $e]); + } catch (ConnectionLevelInterface $e) { + // Error, disconnect connection + $this->disconnect(); + $this->logger->error("[client] {$e->getMessage()}", ['exception' => $e]); + $this->dispatch('error', [$this, $connection, $e]); + } + } + if (!$connection->isConnected()) { + $this->running = false; + } + $connection->tick(); + $this->dispatch('tick', [$this]); + } catch (CloseException $e) { + // Close connection + $connection->close($e->getCloseStatus(), $e->getMessage()); + $this->logger->error("[server] {$e->getMessage()}", ['exception' => $e]); + $this->dispatch('error', [$this, $connection, $e]); + } catch (ReconnectException $e) { + // Reconnect connection + $reconnect = true; + if ($uri = $e->getUri()) { + $this->socketUri = $uri; + } + $connection->close(); + $this->logger->error("[server] {$e->getMessage()}", ['exception' => $e]); + $this->dispatch('error', [$this, $connection, $e]); + } catch (ExceptionInterface $e) { + $this->disconnect(); + $this->running = false; + + // Low-level error + $this->logger->error("[client] {$e->getMessage()}", ['exception' => $e]); + $this->dispatch('error', [$this, null, $e]); + } catch (Throwable $e) { + $this->disconnect(); + $this->running = false; + + // Crash it + $this->logger->error("[client] {$e->getMessage()}", ['exception' => $e]); + throw $e; + } + gc_collect_cycles(); // Collect garbage + + if ($reconnect && !$connection->isConnected()) { + $reconnect = false; + $this->running = true; + } + } + } + + /** + * Stop client listener (resumable). + */ + public function stop(): void + { + $this->running = false; + $this->logger->info("[client] Client is stopped"); + } + + /** + * If client is running (accepting messages). + * @return bool + */ + public function isRunning(): bool + { + return $this->running; + } + + + /* ---------- Connection management ---------------------------------------------------------------------------- */ + + /** + * If Client has active connection. + * @return bool True if active connection. + */ + public function isConnected(): bool + { + return $this->connection && $this->connection->isConnected(); + } + + /** + * If Client is readable. + * @return bool + */ + public function isReadable(): bool + { + return $this->connection && $this->connection->isReadable(); + } + + /** + * If Client is writable. + * @return bool + */ + public function isWritable(): bool + { + return $this->connection && $this->connection->isWritable(); + } + + + /** + * Connect to server and perform upgrade. + * @throws ClientException On failed connection + */ + public function connect(): void + { + $this->disconnect(); + $this->streams = $this->streamFactory->createStreamCollection(); + + $hostUri = (new Uri()) + ->withScheme(match ($this->socketUri->getScheme()) { + 'ws', 'http' => 'tcp', + 'wss', 'https' => 'ssl', + default => throw new ClientException("Invalid socket scheme: {$this->socketUri->getScheme()}") + }) + ->withHost($this->socketUri->getHost(Uri::IDN_ENCODE)) + ->withPort($this->socketUri->getPort(Uri::REQUIRE_PORT)); + + $stream = null; + + try { + $client = $this->streamFactory->createSocketClient($hostUri, $this->context); + $client->setPersistent($this->persistent); + $client->setTimeout($this->timeout); + $stream = $client->connect(); + } catch (Throwable $e) { + $error = "Could not open socket to \"{$hostUri}\": {$e->getMessage()}"; + $this->logger->error("[client] {$error}", ['exception' => $e]); + throw new ClientException($error); + } + $name = $stream->getRemoteName(); + $this->streams->attach($stream, $name); + $this->connection = new Connection( + $stream, + true, + false, + $hostUri->getScheme() === 'ssl', + $this->httpFactory + ); + $this->connection->setFrameSize($this->frameSize); + $this->connection->setTimeout($this->timeout); + $this->connection->setLogger($this->logger); + foreach ($this->middlewares as $middleware) { + $this->connection->addMiddleware($middleware); + } + + if (!$this->isConnected()) { + $error = "Invalid stream on \"{$hostUri}\"."; + $this->logger->error("[client] {$error}"); + throw new ClientException($error); + } + try { + if (!$this->persistent || $stream->tell() == 0) { + /** @throws ReconnectException */ + $response = $this->performHandshake($this->socketUri, $this->connection); + } + } catch (ReconnectException $e) { + $this->logger->info("[client] {$e->getMessage()}", ['exception' => $e]); + if ($uri = $e->getUri()) { + $this->socketUri = $uri; + } + $this->connect(); + return; + } + $this->logger->info("[client] Client connected to {$this->socketUri}"); + $this->dispatch('handshake', [ + $this, + $this->connection, + $this->connection->getHandshakeRequest(), + $this->connection->getHandshakeResponse(), + ]); + $this->dispatch('connect', [$this, $this->connection, $this->connection?->getHandshakeResponse()]); + } + + /** + * Disconnect from server. + */ + public function disconnect(): void + { + if ($this->connection && $this->isConnected()) { + $this->connection->disconnect(); + $this->logger->info('[client] Client disconnected'); + $this->dispatch('disconnect', [$this, $this->connection]); + } + } + + + /* ---------- Connection wrapper methods ----------------------------------------------------------------------- */ + + /** + * Get name of local socket, or null if not connected. + * @return string|null + */ + public function getName(): string|null + { + return $this->isConnected() ? $this->connection?->getName() : null; + } + + /** + * Get name of remote socket, or null if not connected. + * @return string|null + */ + public function getRemoteName(): string|null + { + return $this->isConnected() ? $this->connection?->getRemoteName() : null; + } + + /** + * Get meta value on connection. + * @param string $key Meta key + * @return mixed Meta value + * @deprecated Will be removed in v4 + */ + public function getMeta(string $key): mixed + { + trigger_error('Client.getMeta is deprecated and will be removed in v4.', E_USER_DEPRECATED); + return $this->isConnected() ? $this->connection?->getMeta($key) : null; + } + + /** + * Get Response for handshake procedure. + * @return ResponseInterface|null Handshake. + */ + public function getHandshakeResponse(): ResponseInterface|null + { + return $this->connection ? $this->connection->getHandshakeResponse() : null; + } + + + /* ---------- Internal helper methods -------------------------------------------------------------------------- */ + + /** + * Perform upgrade handshake on new connections. + * @throws HandshakeException On failed handshake + */ + protected function performHandshake(Uri $uri, Connection $connection): ResponseInterface + { + // Generate the WebSocket key. + $key = $this->generateKey(); + + $request = $this->httpFactory->createRequest('GET', $uri); + + $request = $request + ->withHeader('User-Agent', 'websocket-client-php') + ->withHeader('Connection', 'Upgrade') + ->withHeader('Upgrade', 'websocket') + ->withHeader('Sec-WebSocket-Key', $key) + ->withHeader('Sec-WebSocket-Version', '13'); + + // Handle basic authentication. + if ($userinfo = $uri->getUserInfo(Uri::URI_DECODE)) { + $request = $request->withHeader('Authorization', 'Basic ' . base64_encode($userinfo)); + } + + // Add and override with headers. + foreach ($this->headers as $name => $content) { + $request = $request->withHeader($name, $content); + } + + try { + /** @var RequestInterface */ + $request = $connection->pushHttp($request); + /** @var ResponseInterface */ + $response = $connection->pullHttp(); + + if ($response->getStatusCode() != 101) { + throw new HandshakeException("Invalid status code {$response->getStatusCode()}.", $response); + } + + if (empty($response->getHeaderLine('Sec-WebSocket-Accept'))) { + throw new HandshakeException( + "Connection to '{$uri}' failed: Server sent invalid upgrade response.", + $response + ); + } + + $responseKey = trim($response->getHeaderLine('Sec-WebSocket-Accept')); + $expectedKey = base64_encode( + pack('H*', sha1($key . Constant::GUID)) + ); + + if ($responseKey !== $expectedKey) { + throw new HandshakeException("Server sent bad upgrade response.", $response); + } + } catch (HandshakeException $e) { + $this->logger->error("[client] {$e->getMessage()}", ['exception' => $e]); + throw $e; + } + + $this->logger->debug("[client] Handshake on {$uri->getPath()}"); + $connection->setHandshakeRequest($request); + $connection->setHandshakeResponse($response); + + return $response; + } + + /** + * Generate a random string for WebSocket key. + * @return string Random string + */ + protected function generateKey(): string + { + $key = ''; + for ($i = 0; $i < 16; $i++) { + $key .= chr(rand(33, 126)); + } + return base64_encode($key); + } + + /** + * Ensure URI instance to use in client. + * @param UriInterface|string $uri A ws/wss-URI + * @return Uri + * @throws BadUriException On invalid URI + */ + protected function parseUri(UriInterface|string $uri): Uri + { + try { + if ($uri instanceof Uri) { + $uriInstance = $uri; + } elseif ($uri instanceof UriInterface) { + $uriInstance = new Uri("{$uri}"); + } else { + $uriInstance = new Uri($uri); + } + } catch (InvalidArgumentException $e) { + throw new BadUriException("Invalid URI '{$uri}' provided."); + } + + + if (!in_array($uriInstance->getScheme(), ['ws', 'wss'])) { + throw new BadUriException("Invalid URI scheme, must be 'ws' or 'wss'."); + } + if (!$uriInstance->getHost()) { + throw new BadUriException("Invalid URI host."); + } + return $uriInstance; + } + + protected function connection(): Connection + { + if (!$this->isConnected()) { + $this->connect(); + } + /** @var Connection */ + $connection = $this->connection; + return $connection; + } +} diff --git a/vendor/phrity/websocket/src/Connection.php b/vendor/phrity/websocket/src/Connection.php new file mode 100644 index 0000000..227270d --- /dev/null +++ b/vendor/phrity/websocket/src/Connection.php @@ -0,0 +1,435 @@ + $frameSize */ + private int $frameSize = 4096; + /** @var int<0, max>|float $timeout */ + private int|float $timeout = 60; + private string $localName; + private string $remoteName; + private RequestInterface|null $handshakeRequest = null; + private ResponseInterface|null $handshakeResponse = null; + /** @var array $meta */ + private array $meta = []; + private bool $closed = false; + + + /* ---------- Magic methods ------------------------------------------------------------------------------------ */ + + public function __construct( + SocketStream $stream, + bool $pushMasked, + bool $pullMaskedRequired, + bool $ssl = false, + HttpFactory|null $httpFactory = null + ) { + $this->stream = $stream; + $this->httpHandler = new HttpHandler($this->stream, $ssl, $httpFactory); + $this->messageHandler = new MessageHandler(new FrameHandler($this->stream, $pushMasked, $pullMaskedRequired)); + $this->middlewareHandler = new MiddlewareHandler($this->messageHandler, $this->httpHandler); + $this->localName = $this->stream->getLocalName() ?? ''; + $this->remoteName = $this->stream->getRemoteName() ?? ''; + $this->initLogger(); + } + + public function __destruct() + { + if (!$this->closed && $this->isConnected()) { + $this->stream->close(); + } + } + + public function __toString(): string + { + return $this->stringable('%s:%s', $this->localName, $this->remoteName); + } + + + /* ---------- Configuration ------------------------------------------------------------------------------------ */ + + /** + * Set logger. + * @param LoggerInterface $logger Logger implementation + */ + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $logger; + $this->messageHandler->setLogger($logger); + $this->middlewareHandler->setLogger($logger); + $this->logger->debug("[connection] Setting logger: " . get_class($logger)); + } + + /** + * Set time out on connection. + * @param int<0, max>|float $timeout Timeout part in seconds + * @return self + * @throws InvalidArgumentException + */ + public function setTimeout(int|float $timeout): self + { + if ($timeout < 0) { + throw new InvalidArgumentException("Invalid timeout '{$timeout}' provided"); + } + $this->timeout = $timeout; + $this->stream->setTimeout($timeout); + $this->logger->debug("[connection] Setting timeout: {$timeout} seconds"); + return $this; + } + + /** + * Get timeout. + * @return int<0, max>|float Timeout in seconds. + */ + public function getTimeout(): int|float + { + return $this->timeout; + } + + /** + * Set frame size. + * @param int<1, max> $frameSize Frame size in bytes. + * @return self + * @throws InvalidArgumentException + */ + public function setFrameSize(int $frameSize): self + { + if ($frameSize < 1) { + throw new InvalidArgumentException("Invalid frameSize '{$frameSize}' provided"); + } + $this->frameSize = $frameSize; + return $this; + } + + /** + * Get frame size. + * @return int<1, max> Frame size in bytes + */ + public function getFrameSize(): int + { + return max(1, $this->frameSize); + } + + /** + * Get current stream context. + * @return Context + */ + public function getContext(): Context + { + return $this->stream->getContext(); + } + + /** + * Add a middleware. + * @param MiddlewareInterface $middleware + * @return self + */ + public function addMiddleware(MiddlewareInterface $middleware): self + { + $this->middlewareHandler->add($middleware); + $this->logger->debug("[connection] Added middleware: {$middleware}"); + return $this; + } + + + /* ---------- Connection management ---------------------------------------------------------------------------- */ + + /** + * If connected to stream. + * @return bool + */ + public function isConnected(): bool + { + return $this->stream->isConnected(); + } + + /** + * If connection is readable. + * @return bool + */ + public function isReadable(): bool + { + return $this->stream->isReadable(); + } + + /** + * If connection is writable. + * @return bool + */ + public function isWritable(): bool + { + return $this->stream->isWritable(); + } + + /** + * Close connection stream. + * @return self + */ + public function disconnect(): self + { + $this->logger->info('[connection] Closing connection'); + $this->stream->close(); + $this->closed = true; + return $this; + } + + /** + * Close connection stream reading. + * @return self + */ + public function closeRead(): self + { + $this->logger->info('[connection] Closing further reading'); + $this->stream->closeRead(); + return $this; + } + + /** + * Close connection stream writing. + * @return self + */ + public function closeWrite(): self + { + $this->logger->info('[connection] Closing further writing'); + $this->stream->closeWrite(); + return $this; + } + + + /* ---------- Connection state --------------------------------------------------------------------------------- */ + + /** + * Get name of local socket, or null if not connected. + * @return string|null + */ + public function getName(): string|null + { + return $this->localName; + } + + /** + * Get name of remote socket, or null if not connected. + * @return string|null + */ + public function getRemoteName(): string|null + { + return $this->remoteName; + } + + /** + * Set meta value on connection. + * @param string $key Meta key + * @param mixed $value Meta value + */ + public function setMeta(string $key, mixed $value): void + { + $this->meta[$key] = $value; + } + + /** + * Get meta value on connection. + * @param string $key Meta key + * @return mixed Meta value + */ + public function getMeta(string $key): mixed + { + return $this->meta[$key] ?? null; + } + + /** + * Tick operation on connection. + */ + public function tick(): void + { + $this->middlewareHandler->processTick($this); + } + + + /* ---------- WebSocket Message methods ------------------------------------------------------------------------ */ + + /** + * Send message. + * @template T of Message + * @param T $message + * @return T + */ + public function send(Message $message): Message + { + return $this->pushMessage($message); + } + + /** + * Push a message to stream. + * @template T of Message + * @param T $message + * @return T + */ + public function pushMessage(Message $message): Message + { + try { + /** @throws Throwable */ + return $this->middlewareHandler->processOutgoing($this, $message); + } catch (Throwable $e) { + $this->throwException($e); + } + } + + /** + * Pull a message from stream + * @throws ExceptionInterface + */ + public function pullMessage(): Message + { + try { + /** @throws Throwable */ + return $this->middlewareHandler->processIncoming($this); + } catch (Throwable $e) { + $this->throwException($e); + } + } + + + /* ---------- HTTP Message methods ----------------------------------------------------------------------------- */ + + public function pushHttp(MessageInterface $message): MessageInterface + { + try { + /** @throws Throwable */ + return $this->middlewareHandler->processHttpOutgoing($this, $message); + } catch (Throwable $e) { + $this->throwException($e); + } + } + + public function pullHttp(): MessageInterface + { + try { + /** @throws Throwable */ + return $this->middlewareHandler->processHttpIncoming($this); + } catch (Throwable $e) { + $this->throwException($e); + } + } + + public function setHandshakeRequest(RequestInterface $request): self + { + $this->handshakeRequest = $request; + return $this; + } + + public function getHandshakeRequest(): RequestInterface|null + { + return $this->handshakeRequest; + } + + public function setHandshakeResponse(ResponseInterface $response): self + { + $this->handshakeResponse = $response; + return $this; + } + + public function getHandshakeResponse(): ResponseInterface|null + { + return $this->handshakeResponse; + } + + + /* ---------- Internal helper methods -------------------------------------------------------------------------- */ + + /** + * @throws ReconnectException + * @throws ExceptionInterface + * @throws ConnectionTimeoutException + * @throws ConnectionClosedException + * @throws ConnectionFailureException + */ + protected function throwException(Throwable $e): never + { + // Internal exceptions are handled and re-thrown + if ($e instanceof ReconnectException) { + $this->logger->info("[connection] {$e->getMessage()}", ['exception' => $e]); + throw $e; + } + if ($e instanceof ExceptionInterface) { + $this->logger->error("[connection] {$e->getMessage()}", ['exception' => $e]); + throw $e; + } + // External exceptions are converted to internal + if ($this->isConnected()) { + $meta = $this->stream->getMetadata(); + $json = json_encode($meta); + if (!empty($meta['timed_out'])) { + $this->logger->error("[connection] {$e->getMessage()}", ['exception' => $e, 'meta' => $meta]); + throw new ConnectionTimeoutException(); + } + if (!empty($meta['eof'])) { + $this->logger->error("[connection] {$e->getMessage()}", ['exception' => $e, 'meta' => $meta]); + throw new ConnectionClosedException(); + } + } + $this->logger->error("[connection] {$e->getMessage()}", ['exception' => $e]); + throw new ConnectionFailureException(); + } +} diff --git a/vendor/phrity/websocket/src/Constant.php b/vendor/phrity/websocket/src/Constant.php new file mode 100644 index 0000000..f9b997a --- /dev/null +++ b/vendor/phrity/websocket/src/Constant.php @@ -0,0 +1,17 @@ +status = $status; + parent::__construct($content); + } + + public function getCloseStatus(): int + { + return $this->status ?? 1000; + } +} diff --git a/vendor/phrity/websocket/src/Exception/ConnectionClosedException.php b/vendor/phrity/websocket/src/Exception/ConnectionClosedException.php new file mode 100644 index 0000000..bac2240 --- /dev/null +++ b/vendor/phrity/websocket/src/Exception/ConnectionClosedException.php @@ -0,0 +1,20 @@ +response = $response; + } + + public function getResponse(): ResponseInterface + { + return $this->response; + } +} diff --git a/vendor/phrity/websocket/src/Exception/MessageLevelInterface.php b/vendor/phrity/websocket/src/Exception/MessageLevelInterface.php new file mode 100644 index 0000000..5451fd1 --- /dev/null +++ b/vendor/phrity/websocket/src/Exception/MessageLevelInterface.php @@ -0,0 +1,16 @@ +uri = $uri; + parent::__construct("Reconnect requested" . ($uri ? ": {$uri}" : '')); + } + + public function getUri(): Uri|null + { + return $this->uri; + } +} diff --git a/vendor/phrity/websocket/src/Exception/ServerException.php b/vendor/phrity/websocket/src/Exception/ServerException.php new file mode 100644 index 0000000..43d69f5 --- /dev/null +++ b/vendor/phrity/websocket/src/Exception/ServerException.php @@ -0,0 +1,16 @@ +opcode = $opcode; + $this->payload = $payload; + $this->final = $final; + $this->rsv1 = $rsv1; + $this->rsv2 = $rsv2; + $this->rsv3 = $rsv3; + } + + public function isFinal(): bool + { + return $this->final; + } + + public function getRsv1(): bool + { + return $this->rsv1; + } + + public function setRsv1(bool $rsv1): void + { + $this->rsv1 = $rsv1; + } + + public function getRsv2(): bool + { + return $this->rsv2; + } + + public function getRsv3(): bool + { + return $this->rsv3; + } + + public function isContinuation(): bool + { + return $this->opcode === 'continuation'; + } + + public function getOpcode(): string + { + return $this->opcode; + } + + public function getPayload(): string + { + return $this->payload; + } + + public function getPayloadLength(): int + { + return strlen($this->payload); + } + + public function __toString(): string + { + return $this->stringable('%s', $this->opcode); + } +} diff --git a/vendor/phrity/websocket/src/Frame/FrameHandler.php b/vendor/phrity/websocket/src/Frame/FrameHandler.php new file mode 100644 index 0000000..755dc27 --- /dev/null +++ b/vendor/phrity/websocket/src/Frame/FrameHandler.php @@ -0,0 +1,212 @@ +stream = $stream; + $this->pushMasked = $pushMasked; + $this->pullMaskedRequired = $pullMaskedRequired; + $this->initLogger(); + } + + /** + * Pull frame from stream + * @throws CloseException + */ + public function pull(): Frame + { + // Read the frame "header" first, two bytes. + $data = $this->read(2); + list ($byte1, $byte2) = array_values($this->unpack('C*', $data)); + $final = (bool)($byte1 & 0b10000000); // Final fragment marker. + $rsv1 = (bool)($byte1 & 0b01000000); + $rsv2 = (bool)($byte1 & 0b00100000); + $rsv3 = (bool)($byte1 & 0b00010000); + + // Parse opcode + $opcodeInt = $byte1 & 0b00001111; + $opcodeInts = array_flip(self::$opcodes); + $opcode = array_key_exists($opcodeInt, $opcodeInts) ? $opcodeInts[$opcodeInt] : strval($opcodeInt); + + // Masking bit + $masked = (bool)($byte2 & 0b10000000); + + $payload = ''; + + // Payload length + $payloadLength = $byte2 & 0b01111111; + + if ($payloadLength > 125) { + if ($payloadLength === 126) { + $data = $this->read(2); // 126: Payload length is a 16-bit unsigned int + $payloadLength = current($this->unpack('n', $data)); + } else { + $data = $this->read(8); // 127: Payload length is a 64-bit unsigned int + $payloadLength = current($this->unpack('J', $data)); + } + } + + // Get masking key. + if ($masked) { + $maskingKey = $this->stream->read(4); + } + + // Get the actual payload, if any (might not be for e.g. close frames). + if ($payloadLength > 0) { + $data = $this->read($payloadLength); + if ($masked) { + // Unmask payload. + for ($i = 0; $i < $payloadLength; $i++) { + $payload .= ($data[$i] ^ $maskingKey[$i % 4]); + } + } else { + $payload = $data; + } + } + + $frame = new Frame($opcode, $payload, $final, $rsv1, $rsv2, $rsv3); + $this->logger->debug("[frame-handler] Pulled '{$opcode}' frame", [ + 'opcode' => $frame->getOpcode(), + 'final' => $frame->isFinal(), + 'content-length' => $frame->getPayloadLength(), + ]); + + if ($this->pullMaskedRequired && !$masked) { + $this->logger->error("[frame-handler] Masking required, but frame was unmasked"); + throw new CloseException(1002, 'Masking required'); + } + + return $frame; + } + + // Push frame to stream + public function push(Frame $frame): int + { + $payload = $frame->getPayload(); + $payloadLength = $frame->getPayloadLength(); + + $data = ''; + $byte1 = $frame->isFinal() ? 0b10000000 : 0b00000000; // Final fragment marker. + $byte1 |= $frame->getRsv1() ? 0b01000000 : 0b00000000; // RSV1 bit. + $byte1 |= $frame->getRsv2() ? 0b00100000 : 0b00000000; // RSV2 bit. + $byte1 |= $frame->getRsv3() ? 0b00010000 : 0b00000000; // RSV3 bit. + $byte1 |= self::$opcodes[$frame->getOpcode()]; // Set opcode. + $data .= pack('C', $byte1); + + $byte2 = $this->pushMasked ? 0b10000000 : 0b00000000; // Masking bit marker. + + // 7 bits of payload length + if ($payloadLength > 65535) { + $data .= pack('C', $byte2 | 0b01111111); + $data .= pack('J', $payloadLength); + } elseif ($payloadLength > 125) { + $data .= pack('C', $byte2 | 0b01111110); + $data .= pack('n', $payloadLength); + } else { + $data .= pack('C', $byte2 | $payloadLength); + } + + // Handle masking. + if ($this->pushMasked) { + // Generate a random mask. + $mask = ''; + for ($i = 0; $i < 4; $i++) { + $mask .= chr(rand(0, 255)); + } + $data .= $mask; + + // Append masked payload to frame. + for ($i = 0; $i < $payloadLength; $i++) { + $data .= $payload[$i] ^ $mask[$i % 4]; + } + } else { + // Append payload as-is to frame. + $data .= $payload; + } + + // Write to stream. + $written = $this->write($data); + + $this->logger->debug("[frame-handler] Pushed '{opcode}' frame", [ + 'opcode' => $frame->getOpcode(), + 'final' => $frame->isFinal(), + 'content-length' => $frame->getPayloadLength(), + ]); + return $written; + } + + /** + * Secured read op + * @param int<1, max> $length + * @throws RuntimeException + */ + private function read(int $length): string + { + $data = ''; + $read = 0; + while ($read < $length) { + /** @var int<1, max> $readLength */ + $readLength = $length - $read; + $got = $this->stream->read($readLength); + if (empty($got)) { + throw new RuntimeException('Empty read; connection dead?'); + } + $data .= $got; + $read = strlen($data); + } + return $data; + } + + /** + * Secured write op + * @throws RuntimeException + */ + private function write(string $data): int + { + $length = strlen($data); + $written = $this->stream->write($data); + if ($written < $length) { + throw new RuntimeException("Could only write {$written} out of {$length} bytes."); + } + return $written; + } + + /** @return array */ + private function unpack(string $format, string $string): array + { + /** @var array $result */ + $result = unpack($format, $string); + return $result; + } +} diff --git a/vendor/phrity/websocket/src/Http/DefaultHttpFactory.php b/vendor/phrity/websocket/src/Http/DefaultHttpFactory.php new file mode 100644 index 0000000..fd0e5c3 --- /dev/null +++ b/vendor/phrity/websocket/src/Http/DefaultHttpFactory.php @@ -0,0 +1,72 @@ +uriFactory = new UriFactory(); + } + + /** + * Create a new request. + * @param string $method + * @param UriInterface|string $uri + */ + public function createRequest(string $method, mixed $uri): RequestInterface + { + return new Request($method, $uri); + } + + /** + * @param int $code + * @param string $reasonPhrase + */ + public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface + { + return new Response($code, $reasonPhrase); + } + + /** + * @param string $method + * @param UriInterface|string $uri + * @param array $serverParams + */ + public function createServerRequest(string $method, mixed $uri, array $serverParams = []): ServerRequestInterface + { + return new ServerRequest($method, $uri); + } + + /** + * @param string $uri The URI to parse. + */ + public function createUri(string $uri = ''): UriInterface + { + return $this->uriFactory->createUri($uri); + } +} diff --git a/vendor/phrity/websocket/src/Http/HttpHandler.php b/vendor/phrity/websocket/src/Http/HttpHandler.php new file mode 100644 index 0000000..41f4307 --- /dev/null +++ b/vendor/phrity/websocket/src/Http/HttpHandler.php @@ -0,0 +1,140 @@ +stream = $stream; + $this->ssl = $ssl; + $this->httpFactory = $httpFactory ?? new DefaultHttpFactory(); + } + + /** + * @deprecated Remove in v4 + */ + public function setLogger(LoggerInterface $logger): void + { + trigger_error('HttpHandler.setLogger is deprecated and will be removed in v4.', E_USER_DEPRECATED); + } + + /** + * @throws RuntimeException + */ + public function pull(): MessageInterface + { + $status = $this->readLine(); + $path = $version = null; + + // Pulling server request + preg_match('!^(?P[A-Z]+) (?P[^ ]*) HTTP/(?P[0-9/.]+)!', $status, $matches); + if (!empty($matches)) { + $message = $this->httpFactory->createServerRequest($matches['method'], ''); + $path = $matches['path']; + $version = $matches['version']; + } + + // Pulling response + preg_match('!^HTTP/(?P[0-9/.]+) (?P[0-9]*)($|\s(?P.*))!', $status, $matches); + if (!empty($matches)) { + $message = $this->httpFactory->createResponse((int)$matches['code'], $matches['reason'] ?? ''); + $version = $matches['version']; + } + + if (empty($message)) { + throw new RuntimeException('Invalid Http request.'); + } + + if ($version) { + $message = $message->withProtocolVersion($version); + } + + while ($header = $this->readLine()) { + $parts = explode(':', $header, 2); + if (count($parts) == 2) { + if ($message->getheaderLine($parts[0]) === '') { + $message = $message->withHeader($parts[0], trim($parts[1])); + } else { + $message = $message->withAddedHeader($parts[0], trim($parts[1])); + } + } + } + if ($message instanceof Request) { + $scheme = $this->ssl ? 'wss' : 'ws'; + $uri = $this->httpFactory->createUri("{$scheme}://{$message->getHeaderLine('Host')}{$path}"); + $message = $message->withUri($uri, true); + } + + return $message; + } + + /** + * @param MessageInterface $message + * @return MessageInterface + * @throws RuntimeException + */ + public function push(MessageInterface $message): MessageInterface + { + if (!$message instanceof Message) { + throw new RuntimeException('Generic MessageInterface currently not supported.'); + } + $data = implode("\r\n", $message->getAsArray()) . "\r\n\r\n"; + $this->stream->write($data); + return $message; + } + + /** + * @throws RuntimeException + */ + private function readLine(): string + { + $data = ''; + do { + $buffer = $this->stream->readLine(1024); + if (is_null($buffer)) { + throw new RuntimeException('Could not read Http request.'); + } + $data .= $buffer; + } while (!str_ends_with($data, "\n")); + return trim($data); + } +} diff --git a/vendor/phrity/websocket/src/Http/Message.php b/vendor/phrity/websocket/src/Http/Message.php new file mode 100644 index 0000000..837e665 --- /dev/null +++ b/vendor/phrity/websocket/src/Http/Message.php @@ -0,0 +1,185 @@ +> $headers */ + private array $headers = []; + + /** + * Retrieves the HTTP protocol version as a string. + * @return string HTTP protocol version. + */ + public function getProtocolVersion(): string + { + return $this->version; + } + + /** + * Return an instance with the specified HTTP protocol version. + * @param string $version HTTP protocol version + * @return static + */ + public function withProtocolVersion(string $version): self + { + $new = clone $this; + $new->version = $version; + return $new; + } + + /** + * Retrieves all message header values. + * @return string[][] Returns an associative array of the message's headers. + */ + public function getHeaders(): array + { + return array_merge(...array_values($this->headers)); + } + + /** + * Checks if a header exists by the given case-insensitive name. + * @param string $name Case-insensitive header field name. + * @return bool Returns true if any header names match the given header. + */ + public function hasHeader(string $name): bool + { + return array_key_exists(strtolower($name), $this->headers); + } + + /** + * Retrieves a message header value by the given case-insensitive name. + * @param string $name Case-insensitive header field name. + * @return string[] An array of string values as provided for the given header. + */ + public function getHeader(string $name): array + { + return $this->hasHeader($name) + ? array_merge(...array_values($this->headers[strtolower($name)] ?: [])) + : []; + } + + /** + * Retrieves a comma-separated string of the values for a single header. + * @param string $name Case-insensitive header field name. + * @return string A string of values as provided for the given header. + */ + public function getHeaderLine(string $name): string + { + return implode(',', $this->getHeader($name)); + } + + /** + * Return an instance with the provided value replacing the specified header. + * @param string $name Case-insensitive header field name. + * @param string|string[] $value Header value(s). + * @return static + */ + public function withHeader(string $name, mixed $value): self + { + $new = clone $this; + $new->removeHeader($name); + $new->handleHeader($name, $value); + return $new; + } + + /** + * Return an instance with the specified header appended with the given value. + * @param string $name Case-insensitive header field name to add. + * @param string|string[] $value Header value(s). + * @return static + */ + public function withAddedHeader(string $name, mixed $value): self + { + $new = clone $this; + $new->handleHeader($name, $value); + return $new; + } + + /** + * Return an instance without the specified header. + * @param string $name Case-insensitive header field name to remove. + * @return static + */ + public function withoutHeader(string $name): self + { + $new = clone $this; + $new->removeHeader($name); + return $new; + } + + /** + * Not implemented, WebSocket only use headers. + * @throws BadMethodCallException + */ + public function getBody(): StreamInterface + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Not implemented, WebSocket only use headers. + * @throws BadMethodCallException + */ + public function withBody(StreamInterface $body): self + { + throw new BadMethodCallException("Not implemented."); + } + + /** @return array */ + public function getAsArray(): array + { + $lines = []; + foreach ($this->getHeaders() as $name => $values) { + foreach ($values as $value) { + $lines[] = "{$name}: {$value}"; + } + } + return $lines; + } + + /** + * @throws InvalidArgumentException + */ + protected function handleHeader(string $name, mixed $value): void + { + if (!preg_match('|^[0-9a-zA-Z#_-]+$|', $name)) { + throw new InvalidArgumentException("'{$name}' is not a valid header field name."); + } + $value = is_array($value) ? $value : [$value]; + foreach ($value as $content) { + if (!is_string($content) && !is_numeric($content)) { + throw new InvalidArgumentException("Invalid header value(s) provided."); + } + $this->headers[strtolower($name)][$name][] = trim((string)$content); + } + } + + protected function removeHeader(string $name): void + { + if ($this->hasHeader($name)) { + unset($this->headers[strtolower($name)]); + } + } +} diff --git a/vendor/phrity/websocket/src/Http/Request.php b/vendor/phrity/websocket/src/Http/Request.php new file mode 100644 index 0000000..37d7c6a --- /dev/null +++ b/vendor/phrity/websocket/src/Http/Request.php @@ -0,0 +1,137 @@ + $methods */ + private static array $methods = ['GET', 'HEAD', 'OPTIONS', 'TRACE', 'PUT', 'DELETE', 'POST', 'PATCH', 'CONNECT']; + + private string $target = ''; + private string $method; + private UriInterface $uri; + + public function __construct(string $method = 'GET', UriInterface|string $uri = '') + { + if (!in_array($method, self::$methods)) { + throw new InvalidArgumentException("Invalid method '{$method}' provided."); + } + $this->uri = $uri instanceof UriInterface ? $uri : new Uri($uri); + $this->method = $method; + $this->handleHeader('Host', $this->formatHostHeader($this->uri)); + } + + /** + * Retrieves the message's request target. + * @return string + */ + public function getRequestTarget(): string + { + if ($this->target) { + return $this->target; + } + $uri = (new Uri())->withPath($this->uri->getPath())->withQuery($this->uri->getQuery()); + return $uri->toString(Uri::ABSOLUTE_PATH); + } + + /** + * Return an instance with the specific request-target. + * @param mixed $requestTarget + * @return static + */ + public function withRequestTarget(mixed $requestTarget): self + { + $new = clone $this; + $new->target = $requestTarget; + return $new; + } + + /** + * Retrieves the HTTP method of the request. + * @return string Returns the request method. + */ + public function getMethod(): string + { + return $this->method; + } + + /** + * Return an instance with the provided HTTP method. + * @param string $method Case-sensitive method. + * @return static + * @throws InvalidArgumentException for invalid HTTP methods. + */ + public function withMethod(string $method): self + { + if (!in_array($method, self::$methods)) { + throw new InvalidArgumentException("Invalid method '{$method}' provided."); + } + $new = clone $this; + $new->method = $method; + return $new; + } + + /** + * Retrieves the URI instance. + * This method MUST return a UriInterface instance. + * @return UriInterface Returns a UriInterface instance representing the URI of the request. + */ + public function getUri(): UriInterface + { + return $this->uri; + } + + /** + * Returns an instance with the provided URI. + * @param UriInterface $uri New request URI to use. + * @param bool $preserveHost Preserve the original state of the Host header. + * @return static + */ + public function withUri(UriInterface $uri, bool $preserveHost = false): self + { + $new = clone $this; + $new->uri = $uri instanceof Uri ? $uri : new Uri((string)$uri); + if (!$preserveHost || !$new->hasHeader('host')) { + $new->removeHeader('host'); + $new->handleHeader('Host', $this->formatHostHeader($uri)); + } + return $new; + } + + public function __toString(): string + { + return $this->stringable('%s %s', $this->getMethod(), $this->getUri()); + } + + /** @return array */ + public function getAsArray(): array + { + return array_merge([ + "{$this->getMethod()} {$this->getRequestTarget()} HTTP/{$this->getProtocolVersion()}", + ], parent::getAsArray()); + } + + private function formatHostHeader(UriInterface $uri): string + { + $host = $uri->getHost(); + $port = $uri->getPort(); + return $host && $port ? "{$host}:{$port}" : $host; + } +} diff --git a/vendor/phrity/websocket/src/Http/Response.php b/vendor/phrity/websocket/src/Http/Response.php new file mode 100644 index 0000000..15d7ec2 --- /dev/null +++ b/vendor/phrity/websocket/src/Http/Response.php @@ -0,0 +1,150 @@ + $codes */ + private static array $codes = [ + 100 => 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 103 => 'Early Hints', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-Status', + 208 => 'Already Reported', + 226 => 'IM Used', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 307 => 'Temporary Redirect', + 308 => 'Permanent Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Timeout', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Content Too Large', + 414 => 'URI Too Long', + 415 => 'Unsupported Media Type', + 416 => 'Range Not Satisfiable', + 417 => 'Expectation Failed', + 421 => 'Misdirected Request', + 422 => 'Unprocessable Content', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Too Early', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 451 => 'Unavailable For Legal Reasons', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Timeout', + 505 => 'HTTP Version Not Supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 510 => 'Not Extended', + 511 => 'Network Authentication Required', + ]; + + private int $code; + private string $reason; + + public function __construct(int $code = 200, string $reasonPhrase = '') + { + if ($code < 100 || $code > 599) { + throw new InvalidArgumentException("Invalid status code '{$code}' provided."); + } + $this->code = $code; + $this->reason = $reasonPhrase; + } + + /** + * Gets the response status code. + * @return int Status code. + */ + public function getStatusCode(): int + { + return $this->code; + } + + /** + * Return an instance with the specified status code and, optionally, reason phrase. + * @param int $code The 3-digit integer result code to set. + * @param string $reasonPhrase The reason phrase to use. + * @return static + * @throws InvalidArgumentException For invalid status code arguments. + */ + public function withStatus(int $code, string $reasonPhrase = ''): self + { + if ($code < 100 || $code > 599) { + throw new InvalidArgumentException("Invalid status code '{$code}' provided."); + } + $new = clone $this; + $new->code = $code; + $new->reason = $reasonPhrase; + return $new; + } + + /** + * Gets the response reason phrase associated with the status code. + * @return string Reason phrase; must return an empty string if none present. + */ + public function getReasonPhrase(): string + { + $d = self::$codes[$this->code]; + return $this->reason ?: $d; + } + + public function __toString(): string + { + return $this->stringable('%s', $this->getStatusCode()); + } + + /** @return array */ + public function getAsArray(): array + { + return array_merge([ + "HTTP/{$this->getProtocolVersion()} {$this->getStatusCode()} {$this->getReasonPhrase()}", + ], parent::getAsArray()); + } +} diff --git a/vendor/phrity/websocket/src/Http/ServerRequest.php b/vendor/phrity/websocket/src/Http/ServerRequest.php new file mode 100644 index 0000000..7478c61 --- /dev/null +++ b/vendor/phrity/websocket/src/Http/ServerRequest.php @@ -0,0 +1,153 @@ + + */ + public function getServerParams(): array + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Retrieves cookies sent by the client to the server. + * @return array + */ + public function getCookieParams(): array + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Return an instance with the specified cookies. + * @param array $cookies Array of key/value pairs representing cookies. + * @return static + */ + public function withCookieParams(array $cookies): self + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Retrieves the deserialized query string arguments, if any. + * @return array + */ + public function getQueryParams(): array + { + parse_str($this->getUri()->getQuery(), $result); + return $result; + } + + /** + * Return an instance with the specified query string arguments. + * @param array $query Array of query string arguments + * @return static + */ + public function withQueryParams(array $query): self + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Retrieve normalized file upload data. + * @return array An array tree of UploadedFileInterface instances. + */ + public function getUploadedFiles(): array + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Create a new instance with the specified uploaded files. + * @param array $uploadedFiles An array tree of UploadedFileInterface instances. + * @return static + */ + public function withUploadedFiles(array $uploadedFiles): self + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Retrieve any parameters provided in the request body. + * @return null|array|object The deserialized body parameters, if any. + */ + public function getParsedBody() + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Return an instance with the specified body parameters. + * @param null|array|object $data The deserialized body data. + * @return static + */ + public function withParsedBody($data): self + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Retrieve attributes derived from the request. + * @return mixed[] Attributes derived from the request. + */ + public function getAttributes(): array + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Retrieve a single derived request attribute. + * @param string $name The attribute name. + * @param mixed $default Default value to return if the attribute does not exist. + * @return mixed + */ + public function getAttribute(string $name, $default = null) + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Return an instance with the specified derived request attribute. + * @param string $name The attribute name. + * @param mixed $value The value of the attribute. + * @return static + */ + public function withAttribute(string $name, $value): self + { + throw new BadMethodCallException("Not implemented."); + } + + /** + * Return an instance that removes the specified derived request attribute. + * @param string $name The attribute name. + * @return static + */ + public function withoutAttribute(string $name): self + { + throw new BadMethodCallException("Not implemented."); + } + + public function __toString(): string + { + return $this->stringable('%s %s', $this->getMethod(), $this->getRequestTarget()); + } +} diff --git a/vendor/phrity/websocket/src/Message/Binary.php b/vendor/phrity/websocket/src/Message/Binary.php new file mode 100644 index 0000000..29c049f --- /dev/null +++ b/vendor/phrity/websocket/src/Message/Binary.php @@ -0,0 +1,27 @@ +compress; + } + + public function setCompress(bool $compress): void + { + $this->compress = $compress; + } +} diff --git a/vendor/phrity/websocket/src/Message/Close.php b/vendor/phrity/websocket/src/Message/Close.php new file mode 100644 index 0000000..7727d6b --- /dev/null +++ b/vendor/phrity/websocket/src/Message/Close.php @@ -0,0 +1,56 @@ +status = $status; + parent::__construct($content); + } + + public function getCloseStatus(): int|null + { + return $this->status; + } + + public function setCloseStatus(int|null $status): void + { + $this->status = $status; + } + + public function getPayload(): string + { + $statusBinstr = sprintf('%016b', $this->status); + $statusStr = ''; + foreach (str_split($statusBinstr, 8) as $binstr) { + $statusStr .= chr((int)bindec($binstr)); + } + return $statusStr . $this->content; + } + + public function setPayload(string $payload = ''): void + { + $this->status = 0; + $this->content = ''; + if (strlen($payload) > 0) { + $this->status = current(unpack('n', $payload) ?: []); + } + if (strlen($payload) > 2) { + $this->content = substr($payload, 2); + } + } +} diff --git a/vendor/phrity/websocket/src/Message/Message.php b/vendor/phrity/websocket/src/Message/Message.php new file mode 100644 index 0000000..c4db070 --- /dev/null +++ b/vendor/phrity/websocket/src/Message/Message.php @@ -0,0 +1,113 @@ +content = $content; + $this->timestamp = new DateTimeImmutable(); + } + + public function getOpcode(): string + { + return $this->opcode; + } + + public function getLength(): int + { + return strlen($this->content); + } + + public function getTimestamp(): DateTimeInterface + { + return $this->timestamp; + } + + public function getContent(): string + { + return $this->content; + } + + public function setContent(string $content = ''): void + { + $this->content = $content; + } + + public function hasContent(): bool + { + return $this->content != ''; + } + + public function getPayload(): string + { + return $this->content; + } + + public function setPayload(string $payload = ''): void + { + $this->content = $payload; + } + + public function isCompressed(): bool + { + return false; + } + + /** @throws ConnectionFailureException */ + public function setCompress(bool $compress): void + { + if ($compress) { + throw new ConnectionFailureException('Must not compress control message.'); + } + } + + /** + * Split messages into frames + * @param int<1, max> $frameSize + * @return array + */ + public function getFrames(int $frameSize = 4096): array + { + $frames = []; + $split = str_split($this->getPayload(), $frameSize); + if (empty($split)) { + $split = ['']; + } + foreach ($split as $i => $payload) { + $frames[] = new Frame( + $i === 0 ? $this->opcode : 'continuation', + $payload, + $i === array_key_last($split) + ); + } + if ($this->isCompressed()) { + $frames[0]->setRsv1(true); + } + return $frames; + } +} diff --git a/vendor/phrity/websocket/src/Message/MessageHandler.php b/vendor/phrity/websocket/src/Message/MessageHandler.php new file mode 100644 index 0000000..87be81c --- /dev/null +++ b/vendor/phrity/websocket/src/Message/MessageHandler.php @@ -0,0 +1,118 @@ + $frameBuffer */ + private array $frameBuffer = []; + + public function __construct(FrameHandler $frameHandler) + { + $this->frameHandler = $frameHandler; + $this->initLogger(); + } + + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $logger; + $this->frameHandler->setLogger($logger); + } + + /** + * Push message + * @template T of Message + * @param T $message + * @param int<1, max> $size + * @return T + */ + public function push(Message $message, int $size = self::DEFAULT_SIZE): Message + { + $frames = $message->getFrames($size); + foreach ($frames as $frame) { + $this->frameHandler->push($frame); + } + $this->logger->info("[message-handler] Pushed {$message}", [ + 'opcode' => $message->getOpcode(), + 'content-length' => $message->getLength(), + 'frames' => count($frames), + ]); + return $message; + } + + // Pull message + public function pull(): Message + { + do { + $frame = $this->frameHandler->pull(); + if ($frame->isFinal()) { + if ($frame->isContinuation()) { + $frames = array_merge($this->frameBuffer, [$frame]); + $this->frameBuffer = []; // Clear buffer + } else { + $frames = [$frame]; + } + return $this->createMessage($frames); + } + // Non-final frame - add to buffer for continuous reading + $this->frameBuffer[] = $frame; + } while (true); + } + + /** + * @param non-empty-array $frames + * @throws BadOpcodeException + */ + private function createMessage(array $frames): Message + { + $opcode = $frames[0]->getOpcode() ?? null; + $message = match ($opcode) { + 'text' => new Text(), + 'binary' => new Binary(), + 'ping' => new Ping(), + 'pong' => new Pong(), + 'close' => new Close(), + default => throw new BadOpcodeException("Invalid opcode '{$opcode}' provided"), + }; + $message->setPayload(array_reduce($frames, function (string $carry, Frame $item) { + return $carry . $item->getPayload(); + }, '')); + $message->setCompress($frames[0]->getRsv1() ?? false); + $this->logger->info("[message-handler] Pulled {$message}", [ + 'opcode' => $message->getOpcode(), + 'content-length' => $message->getLength(), + 'frames' => count($frames), + ]); + return $message; + } +} diff --git a/vendor/phrity/websocket/src/Message/Ping.php b/vendor/phrity/websocket/src/Message/Ping.php new file mode 100644 index 0000000..8192003 --- /dev/null +++ b/vendor/phrity/websocket/src/Message/Ping.php @@ -0,0 +1,17 @@ +compress; + } + + public function setCompress(bool $compress): void + { + $this->compress = $compress; + } +} diff --git a/vendor/phrity/websocket/src/Middleware/Callback.php b/vendor/phrity/websocket/src/Middleware/Callback.php new file mode 100644 index 0000000..2162c26 --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/Callback.php @@ -0,0 +1,100 @@ +incoming = $incoming; + $this->outgoing = $outgoing; + $this->httpIncoming = $httpIncoming; + $this->httpOutgoing = $httpOutgoing; + $this->tick = $tick; + $this->initLogger(); + } + + public function processIncoming(ProcessStack $stack, Connection $connection): Message + { + if (is_callable($this->incoming)) { + return call_user_func($this->incoming, $stack, $connection); + } + return $stack->handleIncoming(); + } + + public function processOutgoing(ProcessStack $stack, Connection $connection, Message $message): Message + { + if (is_callable($this->outgoing)) { + return call_user_func($this->outgoing, $stack, $connection, $message); + } + return $stack->handleOutgoing($message); + } + + public function processHttpIncoming(ProcessHttpStack $stack, Connection $connection): MessageInterface + { + if (is_callable($this->httpIncoming)) { + return call_user_func($this->httpIncoming, $stack, $connection); + } + return $stack->handleHttpIncoming(); + } + + public function processHttpOutgoing( + ProcessHttpStack $stack, + Connection $connection, + MessageInterface $message + ): MessageInterface { + if (is_callable($this->httpOutgoing)) { + return call_user_func($this->httpOutgoing, $stack, $connection, $message); + } + return $stack->handleHttpOutgoing($message); + } + + public function processTick(ProcessTickStack $stack, Connection $connection): void + { + if (is_callable($this->tick)) { + call_user_func($this->tick, $stack, $connection); + } + $stack->handleTick(); + } +} diff --git a/vendor/phrity/websocket/src/Middleware/CloseHandler.php b/vendor/phrity/websocket/src/Middleware/CloseHandler.php new file mode 100644 index 0000000..c5eafb5 --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/CloseHandler.php @@ -0,0 +1,73 @@ +initLogger(); + } + + public function processIncoming(ProcessStack $stack, Connection $connection): Message + { + $message = $stack->handleIncoming(); // Proceed before logic + if (!$message instanceof Close) { + return $message; + } + if ($connection->isWritable()) { + // Remote sent Close; acknowledge and close for further reading + $this->logger->debug("[close-handler] Received 'close', status: {$message->getCloseStatus()}"); + $ack = "Close acknowledged: {$message->getCloseStatus()}"; + $connection->closeRead(); + $connection->send(new Close($message->getCloseStatus(), $ack)); + } else { + // Remote sent Close/Ack: disconnect + $this->logger->debug("[close-handler] Received 'close' acknowledge, disconnecting"); + $connection->disconnect(); + } + return $message; + } + + public function processOutgoing(ProcessStack $stack, Connection $connection, Message $message): Message + { + $message = $stack->handleOutgoing($message); // Proceed before logic + if (!$message instanceof Close) { + return $message; + } + if ($connection->isReadable()) { + // Local sent Close: close for further writing, expect remote acknowledge + $this->logger->debug("[close-handler] Sent 'close', status: {$message->getCloseStatus()}"); + $connection->closeWrite(); + } else { + // Local sent Close/Ack: disconnect + $this->logger->debug("[close-handler] Sent 'close' acknowledge, disconnecting"); + $connection->disconnect(); + } + return $message; + } +} diff --git a/vendor/phrity/websocket/src/Middleware/CompressionExtension.php b/vendor/phrity/websocket/src/Middleware/CompressionExtension.php new file mode 100644 index 0000000..a8f8027 --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/CompressionExtension.php @@ -0,0 +1,163 @@ + $compressors */ + private array $compressors = []; + + public function __construct(CompressorInterface ...$compressors) + { + $this->compressors = $compressors; + $this->initLogger(); + } + + public function processHttpOutgoing( + ProcessHttpStack $stack, + Connection $connection, + MessageInterface $message + ): MessageInterface { + if ($message instanceof RequestInterface) { + // Outgoing requests on Client + $connection->setMeta('compressionExtension.compressor', null); + $connection->setMeta('compressionExtension.configuration', null); + $headerValues = []; + foreach ($this->compressors as $compressor) { + $headerValues[] = $compressor->getRequestHeaderValue(); + } + $message = $message->withAddedHeader('Sec-WebSocket-Extensions', implode(', ', $headerValues)); + } elseif ($message instanceof ResponseInterface) { + // Outgoing Response on Server + if ($compressor = $connection->getMeta('compressionExtension.compressor')) { + $configuration = $connection->getMeta('compressionExtension.configuration'); + $message = $message->withHeader( + 'Sec-WebSocket-Extensions', + $compressor->getResponseHeaderValue($configuration) + ); + } + } + return $stack->handleHttpOutgoing($message); + } + + public function processHttpIncoming(ProcessHttpStack $stack, Connection $connection): MessageInterface + { + $message = $stack->handleHttpIncoming(); + if ($message instanceof ServerRequestInterface) { + // Incoming requests on Server + $connection->setMeta('compressionExtension.compressor', null); + $connection->setMeta('compressionExtension.configuration', null); + if ($preferred = $this->getPreferred($message)) { + $connection->setMeta('compressionExtension.compressor', $preferred->compressor); + $connection->setMeta('compressionExtension.configuration', $preferred->configuration); + $this->logger->debug( + "[permessage-compression] Using {$preferred->compressor}", + (array)$preferred->configuration + ); + } + } elseif ($message instanceof ResponseInterface) { + // Incoming Response on Client + if ($preferred = $this->getPreferred($message)) { + $connection->setMeta('compressionExtension.compressor', $preferred->compressor); + $connection->setMeta('compressionExtension.configuration', $preferred->configuration); + $this->logger->debug( + "[permessage-compression] Using {$preferred->compressor}", + (array)$preferred->configuration + ); + } + // @todo: If not found? + } + return $message; + } + + public function processIncoming(ProcessStack $stack, Connection $connection): Message + { + $message = $stack->handleIncoming(); + if ( + ($message instanceof Text || $message instanceof Binary) + && $message->isCompressed() + && $compressor = $connection->getMeta('compressionExtension.compressor') + ) { + $message = $compressor->decompress($message, $connection->getMeta('compressionExtension.configuration')); + } + return $message; + } + + /** + * @template T of Message + * @param T $message + * @return T|Text|Binary + */ + public function processOutgoing(ProcessStack $stack, Connection $connection, Message $message): Message + { + if ( + ($message instanceof Text || $message instanceof Binary) + && !$message->isCompressed() + && $compressor = $connection->getMeta('compressionExtension.compressor') + ) { + /** @var Text|Binary $message */ + $message = $compressor->compress($message, $connection->getMeta('compressionExtension.configuration')); + } + return $stack->handleOutgoing($message); + } + + /** + * @return object{compressor: CompressorInterface, configuration: object}|null + */ + protected function getPreferred(MessageInterface $request): object|null + { + $isServer = $request instanceof ServerRequestInterface; + foreach ($request->getHeader('Sec-WebSocket-Extensions') as $header) { + foreach (explode(',', $header) as $element) { + foreach ($this->compressors as $compressor) { + $configuration = $compressor->getConfiguration(trim($element), $isServer); + if ($compressor->isEligable($configuration)) { + return (object)['compressor' => $compressor, 'configuration' => $configuration]; + } + } + } + } + return null; + } +} diff --git a/vendor/phrity/websocket/src/Middleware/CompressionExtension/CompressorInterface.php b/vendor/phrity/websocket/src/Middleware/CompressionExtension/CompressorInterface.php new file mode 100644 index 0000000..f15fe71 --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/CompressionExtension/CompressorInterface.php @@ -0,0 +1,39 @@ +, + * clientMaxWindowBits: int, + * } + */ +class DeflateCompressor implements CompressorInterface, Stringable +{ + use StringableTrait; + + private const MIN_WINDOW_SIZE = 9; + private const MAX_WINDOW_SIZE = 15; + + private bool $serverNoContextTakeover; + private bool $clientNoContextTakeover; + /** @var int $serverMaxWindowBits */ + private int $serverMaxWindowBits; + /** @var int $clientMaxWindowBits */ + private int $clientMaxWindowBits; + + /** + * @throws RuntimeException + * @throws RangeException + */ + public function __construct( + bool $serverNoContextTakeover = false, + bool $clientNoContextTakeover = false, + int $serverMaxWindowBits = self::MAX_WINDOW_SIZE, + int $clientMaxWindowBits = self::MAX_WINDOW_SIZE, + string $extension = 'zlib', + ) { + if (!extension_loaded($extension)) { + throw new RuntimeException("DeflateCompressor require {$extension} extension."); + } + if ($serverMaxWindowBits < self::MIN_WINDOW_SIZE || $serverMaxWindowBits > self::MAX_WINDOW_SIZE) { + throw new RangeException("DeflateCompressor serverMaxWindowBits must be in range 9-15."); + } + if ($clientMaxWindowBits < self::MIN_WINDOW_SIZE || $clientMaxWindowBits > self::MAX_WINDOW_SIZE) { + throw new RangeException("DeflateCompressor clientMaxWindowBits must be in range 9-15."); + } + $this->serverNoContextTakeover = $serverNoContextTakeover; + $this->clientNoContextTakeover = $clientNoContextTakeover; + $this->serverMaxWindowBits = $serverMaxWindowBits; + $this->clientMaxWindowBits = $clientMaxWindowBits; + } + + public function getRequestHeaderValue(): string + { + $header = "permessage-deflate"; + if ($this->serverNoContextTakeover) { + $header .= "; server_no_context_takeover"; + } + if ($this->clientNoContextTakeover) { + $header .= "; client_no_context_takeover"; + } + if ($this->serverMaxWindowBits != self::MAX_WINDOW_SIZE) { + $header .= "; server_max_window_bits={$this->serverMaxWindowBits}"; + } + if ($this->clientMaxWindowBits != self::MAX_WINDOW_SIZE) { + $header .= "; client_max_window_bits={$this->clientMaxWindowBits}"; + } + return $header; + } + + /** + * @param Config $configuration + */ + public function getResponseHeaderValue(object $configuration): string + { + // @todo: throw HandshakeException or bad config + $header = "permessage-deflate"; + if ($configuration->serverNoContextTakeover) { + $header .= "; server_no_context_takeover"; + } + if ($configuration->clientNoContextTakeover) { + $header .= "; client_no_context_takeover"; + } + $serverMaxWindowBits = min($configuration->serverMaxWindowBits, $this->serverMaxWindowBits); + if ($serverMaxWindowBits != self::MAX_WINDOW_SIZE) { + $header .= "; server_max_window_bits={$serverMaxWindowBits}"; + } + $clientMaxWindowBits = min($configuration->clientMaxWindowBits, $this->clientMaxWindowBits); + if ($clientMaxWindowBits != self::MAX_WINDOW_SIZE) { + $header .= "; client_max_window_bits={$clientMaxWindowBits}"; + } + return $header; + } + + /** + * @param Config $configuration + */ + public function isEligable(object $configuration): bool + { + return + $configuration->compressor == 'permessage-deflate' + && $configuration->serverMaxWindowBits <= $this->serverMaxWindowBits + && $configuration->clientMaxWindowBits <= $this->clientMaxWindowBits + ; + } + + /** + * @return Config + */ + public function getConfiguration(string $element, bool $isServer): object + { + $configuration = (object)[ + 'compressor' => null, + 'isServer' => $isServer, + 'serverNoContextTakeover' => $this->serverNoContextTakeover, + 'clientNoContextTakeover' => $this->clientNoContextTakeover, + 'serverMaxWindowBits' => $this->serverMaxWindowBits, + 'clientMaxWindowBits' => $this->clientMaxWindowBits, + 'deflator' => null, + 'inflator' => null, + ]; + foreach (explode(';', $element) as $parameter) { + $parts = explode('=', $parameter); + $key = trim($parts[0]); + // @todo: Error handling when parsing + switch ($key) { + case 'permessage-deflate': + $configuration->compressor = $key; + break; + case 'server_no_context_takeover': + $configuration->serverNoContextTakeover = true; + break; + case 'client_no_context_takeover': + $configuration->clientNoContextTakeover = true; + break; + case 'server_max_window_bits': + $bits = intval($parts[1] ?? self::MAX_WINDOW_SIZE); + $configuration->serverMaxWindowBits = min($bits, $this->serverMaxWindowBits); + break; + case 'client_max_window_bits': + $bits = intval($parts[1] ?? self::MAX_WINDOW_SIZE); + $configuration->clientMaxWindowBits = min($bits, $this->clientMaxWindowBits); + break; + } + } + return $configuration; + } + + /** + * @template T of Binary|Text + * @param T $message + * @param Config $configuration + * @return T + */ + public function compress(Binary|Text $message, object $configuration): Binary|Text + { + $windowBits = $configuration->isServer + ? $configuration->serverMaxWindowBits + : $configuration->clientMaxWindowBits; + $noContextTakeover = $configuration->isServer + ? $configuration->serverNoContextTakeover + : $configuration->clientNoContextTakeover; + + if (is_null($configuration->deflator) || $noContextTakeover) { + $configuration->deflator = deflate_init(ZLIB_ENCODING_RAW, [ + 'level' => -1, + 'window' => $windowBits, + 'strategy' => ZLIB_DEFAULT_STRATEGY + ]) ?: null; + } + /** @var DeflateContext $deflator */ + $deflator = $configuration->deflator; + /** @var string $deflated */ + $deflated = deflate_add($deflator, $message->getPayload(), ZLIB_SYNC_FLUSH); + $deflated = substr($deflated, 0, -4); // Remove 4 last chars + $message->setCompress(true); + $message->setPayload($deflated); + return $message; + } + + /** + * @param Config $configuration + */ + public function decompress(Binary|Text $message, object $configuration): Binary|Text + { + $windowBits = $configuration->isServer + ? $configuration->clientMaxWindowBits + : $configuration->serverMaxWindowBits; + $noContextTakeover = $configuration->isServer + ? $configuration->clientNoContextTakeover + : $configuration->serverNoContextTakeover; + + if (is_null($configuration->inflator) || $noContextTakeover) { + $configuration->inflator = inflate_init(ZLIB_ENCODING_RAW, [ + 'level' => -1, + 'window' => $windowBits, + 'strategy' => ZLIB_DEFAULT_STRATEGY + ]) ?: null; + } + /** @var InflateContext $inflator */ + $inflator = $configuration->inflator; + /** @var string $inflated */ + $inflated = inflate_add($inflator, $message->getPayload() . "\x00\x00\xff\xff"); + $message->setCompress(false); + $message->setPayload($inflated); + return $message; + } +} diff --git a/vendor/phrity/websocket/src/Middleware/FollowRedirect.php b/vendor/phrity/websocket/src/Middleware/FollowRedirect.php new file mode 100644 index 0000000..addc826 --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/FollowRedirect.php @@ -0,0 +1,71 @@ +limit = $limit; + $this->initLogger(); + } + + /** + * @throws HandshakeException + * @throws ReconnectException + */ + public function processHttpIncoming(ProcessHttpStack $stack, Connection $connection): MessageInterface + { + $message = $stack->handleHttpIncoming(); + if ( + $message instanceof ResponseInterface + && $message->getStatusCode() >= 300 + && $message->getStatusCode() < 400 + && $locationHeader = $message->getHeaderLine('Location') + ) { + $note = "{$this->attempts} of {$this->limit} redirect attempts"; + if ($this->attempts > $this->limit) { + $this->logger->debug("[follow-redirect] Too many redirect attempts, giving up"); + throw new HandshakeException("Too many redirect attempts, giving up", $message); + } + $this->attempts++; + $this->logger->debug("[follow-redirect] {$message->getStatusCode()} {$locationHeader} ($note)"); + throw new ReconnectException(new Uri($locationHeader)); + } + return $message; + } +} diff --git a/vendor/phrity/websocket/src/Middleware/MiddlewareHandler.php b/vendor/phrity/websocket/src/Middleware/MiddlewareHandler.php new file mode 100644 index 0000000..59ba495 --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/MiddlewareHandler.php @@ -0,0 +1,172 @@ + */ + private array $middlewares = []; + /** @var array */ + private array $incoming = []; + /** @var array */ + private array $outgoing = []; + /** @var array */ + private array $httpIncoming = []; + /** @var array */ + private array $httpOutgoing = []; + /** @var array */ + private array $tick = []; + + // Handlers + private HttpHandler $httpHandler; + private MessageHandler $messageHandler; + + /** + * Create MiddlewareHandler. + * @param MessageHandler $messageHandler + * @param HttpHandler $httpHandler + */ + public function __construct(MessageHandler $messageHandler, HttpHandler $httpHandler) + { + $this->messageHandler = $messageHandler; + $this->httpHandler = $httpHandler; + $this->initLogger(); + } + + /** + * Set logger on MiddlewareHandler and all LoggerAware middlewares. + * @param LoggerInterface $logger + */ + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $logger; + foreach ($this->middlewares as $middleware) { + $this->attachLogger($middleware); + } + } + + /** + * Add a middleware. + * @param MiddlewareInterface $middleware + * @return $this + */ + public function add(MiddlewareInterface $middleware): self + { + if ($middleware instanceof ProcessIncomingInterface) { + $this->logger->info("[middleware-handler] Added incoming: {$middleware}"); + $this->incoming[] = $middleware; + } + if ($middleware instanceof ProcessOutgoingInterface) { + $this->logger->info("[middleware-handler] Added outgoing: {$middleware}"); + $this->outgoing[] = $middleware; + } + if ($middleware instanceof ProcessHttpIncomingInterface) { + $this->logger->info("[middleware-handler] Added http incoming: {$middleware}"); + $this->httpIncoming[] = $middleware; + } + if ($middleware instanceof ProcessHttpOutgoingInterface) { + $this->logger->info("[middleware-handler] Added http outgoing: {$middleware}"); + $this->httpOutgoing[] = $middleware; + } + if ($middleware instanceof ProcessTickInterface) { + $this->logger->info("[middleware-handler] Added tick: {$middleware}"); + $this->tick[] = $middleware; + } + $this->attachLogger($middleware); + $this->middlewares[] = $middleware; + return $this; + } + + /** + * Process middlewares for incoming messages. + * @param Connection $connection + * @return Message + */ + public function processIncoming(Connection $connection): Message + { + $this->logger->info("[middleware-handler] Processing incoming"); + $stack = new ProcessStack($connection, $this->messageHandler, $this->incoming); + return $stack->handleIncoming(); + } + + /** + * Process middlewares for outgoing messages. + * @template T of Message + * @param Connection $connection + * @param T $message + * @return T + */ + public function processOutgoing(Connection $connection, Message $message): Message + { + $this->logger->info("[middleware-handler] Processing outgoing"); + $stack = new ProcessStack($connection, $this->messageHandler, $this->outgoing); + return $stack->handleOutgoing($message); + } + + /** + * Process middlewares for http requests. + * @param Connection $connection + * @return MessageInterface + */ + public function processHttpIncoming(Connection $connection): MessageInterface + { + $this->logger->info("[middleware-handler] Processing http incoming"); + $stack = new ProcessHttpStack($connection, $this->httpHandler, $this->httpIncoming); + return $stack->handleHttpIncoming(); + } + + /** + * Process middlewares for http requests. + * @param Connection $connection + * @param MessageInterface $message + * @return MessageInterface + */ + public function processHttpOutgoing(Connection $connection, MessageInterface $message): MessageInterface + { + $this->logger->info("[middleware-handler] Processing http outgoing"); + $stack = new ProcessHttpStack($connection, $this->httpHandler, $this->httpOutgoing); + return $stack->handleHttpOutgoing($message); + } + + /** + * Process middlewares for tick. + * @param Connection $connection + */ + public function processTick(Connection $connection): void + { + $this->logger->info("[middleware-handler] Processing tick"); + $stack = new ProcessTickStack($connection, $this->tick); + $stack->handleTick(); + } +} diff --git a/vendor/phrity/websocket/src/Middleware/MiddlewareInterface.php b/vendor/phrity/websocket/src/Middleware/MiddlewareInterface.php new file mode 100644 index 0000000..4f5ce43 --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/MiddlewareInterface.php @@ -0,0 +1,18 @@ +interval = $interval; + $this->initLogger(); + } + + public function processOutgoing(ProcessStack $stack, Connection $connection, Message $message): Message + { + $this->setNext($connection); // Update timestamp for next ping + return $stack->handleOutgoing($message); + } + + public function processTick(ProcessTickStack $stack, Connection $connection): void + { + // Push if time exceeds timestamp for next ping + if ($connection->isWritable() && microtime(true) >= $this->getNext($connection)) { + $this->logger->debug("[ping-interval] Auto-pushing ping"); + $connection->send(new Ping()); + $this->setNext($connection); // Update timestamp for next ping + } + $stack->handleTick(); + } + + private function getNext(Connection $connection): float + { + return $connection->getMeta('pingInterval.next') ?? $this->setNext($connection); + } + + private function setNext(Connection $connection): float + { + $next = microtime(true) + ($this->interval ?? $connection->getTimeout()); + $connection->setMeta('pingInterval.next', $next); + return $next; + } +} diff --git a/vendor/phrity/websocket/src/Middleware/PingResponder.php b/vendor/phrity/websocket/src/Middleware/PingResponder.php new file mode 100644 index 0000000..482465e --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/PingResponder.php @@ -0,0 +1,45 @@ +initLogger(); + } + + public function processIncoming(ProcessStack $stack, Connection $connection): Message + { + $message = $stack->handleIncoming(); + if ($message instanceof Ping && $connection->isWritable()) { + $connection->send(new Pong($message->getContent())); + } + return $message; + } +} diff --git a/vendor/phrity/websocket/src/Middleware/ProcessHttpIncomingInterface.php b/vendor/phrity/websocket/src/Middleware/ProcessHttpIncomingInterface.php new file mode 100644 index 0000000..a986b3b --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/ProcessHttpIncomingInterface.php @@ -0,0 +1,20 @@ + $processors */ + private array $processors; + + /** + * Create ProcessStack. + * @param Connection $connection + * @param HttpHandler $httpHandler + * @param array $processors + */ + public function __construct(Connection $connection, HttpHandler $httpHandler, array $processors) + { + $this->connection = $connection; + $this->httpHandler = $httpHandler; + $this->processors = $processors; + } + + /** + * Process middleware for incoming http message. + * @return MessageInterface + */ + public function handleHttpIncoming(): MessageInterface + { + /** @var ProcessHttpIncomingInterface|null $processor */ + $processor = array_shift($this->processors); + if ($processor) { + return $processor->processHttpIncoming($this, $this->connection); + } + return $this->httpHandler->pull(); + } + + /** + * Process middleware for outgoing http message. + * @param MessageInterface $message + * @return MessageInterface + */ + public function handleHttpOutgoing(MessageInterface $message): MessageInterface + { + /** @var ProcessHttpOutgoingInterface|null $processor */ + $processor = array_shift($this->processors); + if ($processor) { + return $processor->processHttpOutgoing($this, $this->connection, $message); + } + return $this->httpHandler->push($message); + } +} diff --git a/vendor/phrity/websocket/src/Middleware/ProcessIncomingInterface.php b/vendor/phrity/websocket/src/Middleware/ProcessIncomingInterface.php new file mode 100644 index 0000000..495ed4e --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/ProcessIncomingInterface.php @@ -0,0 +1,20 @@ + $processors */ + private array $processors; + + /** + * Create ProcessStack. + * @param Connection $connection + * @param MessageHandler $messageHandler + * @param array $processors + */ + public function __construct(Connection $connection, MessageHandler $messageHandler, array $processors) + { + $this->connection = $connection; + $this->messageHandler = $messageHandler; + $this->processors = $processors; + } + + /** + * Process middleware for incoming message. + * @return Message + */ + public function handleIncoming(): Message + { + /** @var ProcessIncomingInterface|null $processor */ + $processor = array_shift($this->processors); + if ($processor) { + return $processor->processIncoming($this, $this->connection); + } + return $this->messageHandler->pull(); + } + + /** + * Process middleware for outgoing message. + * @template T of Message + * @param T $message + * @return T + */ + public function handleOutgoing(Message $message): Message + { + /** @var ProcessOutgoingInterface|null $processor */ + $processor = array_shift($this->processors); + if ($processor) { + return $processor->processOutgoing($this, $this->connection, $message); + } + return $this->messageHandler->push($message, $this->connection->getFrameSize()); + } +} diff --git a/vendor/phrity/websocket/src/Middleware/ProcessTickInterface.php b/vendor/phrity/websocket/src/Middleware/ProcessTickInterface.php new file mode 100644 index 0000000..0a37f77 --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/ProcessTickInterface.php @@ -0,0 +1,19 @@ + $processors */ + private array $processors; + + /** + * Create ProcessStack. + * @param Connection $connection + * @param array $processors + */ + public function __construct(Connection $connection, array $processors) + { + $this->connection = $connection; + $this->processors = $processors; + } + + /** + * Process middleware for tick. + */ + public function handleTick(): void + { + $processor = array_shift($this->processors); + if ($processor) { + $processor->processTick($this, $this->connection); + } + } +} diff --git a/vendor/phrity/websocket/src/Middleware/SubprotocolNegotiation.php b/vendor/phrity/websocket/src/Middleware/SubprotocolNegotiation.php new file mode 100644 index 0000000..dcaacfe --- /dev/null +++ b/vendor/phrity/websocket/src/Middleware/SubprotocolNegotiation.php @@ -0,0 +1,113 @@ + $subprotocols */ + private array $subprotocols; + private bool $require; + + /** @param array $subprotocols */ + public function __construct(array $subprotocols, bool $require = false) + { + $this->subprotocols = $subprotocols; + $this->require = $require; + $this->initLogger(); + } + + public function processHttpOutgoing( + ProcessHttpStack $stack, + Connection $connection, + MessageInterface $message + ): MessageInterface { + if ($message instanceof RequestInterface) { + // Outgoing requests on Client + foreach ($this->subprotocols as $subprotocol) { + $message = $message->withAddedHeader('Sec-WebSocket-Protocol', $subprotocol); + } + if ($supported = implode(', ', $this->subprotocols)) { + $this->logger->debug("[subprotocol-negotiation] Requested subprotocols: {$supported}"); + } + } elseif ($message instanceof ResponseInterface) { + // Outgoing Response on Server + if ($selected = $connection->getMeta('subprotocolNegotiation.selected')) { + $message = $message->withHeader('Sec-WebSocket-Protocol', $selected); + $this->logger->info("[subprotocol-negotiation] Selected subprotocol: {$selected}"); + } elseif ($this->require) { + // No matching subprotocol, fail handshake + $message = $message->withStatus(426); + } + } + return $stack->handleHttpOutgoing($message); + } + + /** + * @throws HandshakeException + */ + public function processHttpIncoming(ProcessHttpStack $stack, Connection $connection): MessageInterface + { + $connection->setMeta('subprotocolNegotiation.selected', null); + $message = $stack->handleHttpIncoming(); + + if ($message instanceof ServerRequestInterface) { + // Incoming requests on Server + if ($requested = $message->getHeaderLine('Sec-WebSocket-Protocol')) { + $this->logger->debug("[subprotocol-negotiation] Requested subprotocols: {$requested}"); + } + if ($supported = implode(', ', $this->subprotocols)) { + $this->logger->debug("[subprotocol-negotiation] Supported subprotocols: {$supported}"); + } + foreach ($message->getHeader('Sec-WebSocket-Protocol') as $subprotocol) { + if (in_array($subprotocol, $this->subprotocols)) { + $connection->setMeta('subprotocolNegotiation.selected', $subprotocol); + return $message; + } + } + } elseif ($message instanceof ResponseInterface) { + // Incoming Response on Client + if ($selected = $message->getHeaderLine('Sec-WebSocket-Protocol')) { + $connection->setMeta('subprotocolNegotiation.selected', $selected); + $this->logger->info("[subprotocol-negotiation] Selected subprotocol: {$selected}"); + } elseif ($this->require) { + // No matching subprotocol, close and fail + $connection->close(); + throw new HandshakeException("Could not resolve subprotocol.", $message); + } + } + return $message; + } +} diff --git a/vendor/phrity/websocket/src/Server.php b/vendor/phrity/websocket/src/Server.php new file mode 100644 index 0000000..a1f7c2f --- /dev/null +++ b/vendor/phrity/websocket/src/Server.php @@ -0,0 +1,671 @@ + */ + use ListenerTrait; + use LoggerAwareTrait; + use SendMethodsTrait; + use StringableTrait; + + // Settings + private int $port; + private string $scheme; + /** @var int<0, max>|float $timeout */ + private int|float $timeout = 60; + /** @var int<1, max> $frameSize */ + private int $frameSize = 4096; + private Context $context; + + // Internal resources + private StreamFactory $streamFactory; + private SocketServer|null $server = null; + private StreamCollection|null $streams = null; + private bool $running = false; + /** @var array $connections */ + private array $connections = []; + /** @var array $middlewares */ + private array $middlewares = []; + private int|null $maxConnections = null; + private HttpFactory $httpFactory; + + + /* ---------- Magic methods ------------------------------------------------------------------------------------ */ + + /** + * @param int $port Socket port to listen to + * @param bool $ssl If SSL should be used + * @throws InvalidArgumentException If invalid port provided + */ + public function __construct(int $port = 80, bool $ssl = false) + { + if ($port < 0 || $port > 65535) { + throw new InvalidArgumentException("Invalid port '{$port}' provided"); + } + $this->port = $port; + $this->scheme = $ssl ? 'ssl' : 'tcp'; + $this->initLogger(); + $this->context = new Context(); + $this->httpFactory = new DefaultHttpFactory(); + $this->setStreamFactory(new StreamFactory()); + } + + /** + * Get string representation of instance. + * @return string String representation + */ + public function __toString(): string + { + return $this->stringable('%s', $this->server ? "{$this->scheme}://0.0.0.0:{$this->port}" : 'closed'); + } + + + /* ---------- Configuration ------------------------------------------------------------------------------------ */ + + /** + * Set stream factory to use. + * @param StreamFactory $streamFactory + * @return self + */ + public function setStreamFactory(StreamFactory $streamFactory): self + { + $this->streamFactory = $streamFactory; + return $this; + } + + /** + * Set HTTP factory to use. + * @param HttpFactory $httpFactory + * @return self + */ + public function setHttpFactory(HttpFactory $httpFactory): self + { + $this->httpFactory = $httpFactory; + return $this; + } + + /** + * Set logger. + * @param LoggerInterface $logger Logger implementation + */ + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $logger; + foreach ($this->connections as $connection) { + $connection->setLogger($this->logger); + } + } + + /** + * Set timeout. + * @param int<0, max>|float $timeout Timeout in seconds + * @return self + * @throws InvalidArgumentException If invalid timeout provided + */ + public function setTimeout(int|float $timeout): self + { + if ($timeout < 0) { + throw new InvalidArgumentException("Invalid timeout '{$timeout}' provided"); + } + $this->timeout = $timeout; + foreach ($this->connections as $connection) { + $connection->setTimeout($timeout); + } + return $this; + } + + /** + * Get timeout. + * @return int<0, max>|float Timeout in seconds + */ + public function getTimeout(): int|float + { + return $this->timeout; + } + + /** + * Set frame size. + * @param int<1, max> $frameSize Frame size in bytes + * @return self + * @throws InvalidArgumentException If invalid frameSize provided + */ + public function setFrameSize(int $frameSize): self + { + if ($frameSize < 3) { + throw new InvalidArgumentException("Invalid frameSize '{$frameSize}' provided"); + } + $this->frameSize = $frameSize; + foreach ($this->connections as $connection) { + $connection->setFrameSize($frameSize); + } + return $this; + } + + /** + * Get frame size. + * @return int Frame size in bytes + */ + public function getFrameSize(): int + { + return $this->frameSize; + } + + /** + * Get socket port number. + * @return int port + */ + public function getPort(): int + { + return $this->port; + } + + /** + * Get connection scheme. + * @return string scheme + */ + public function getScheme(): string + { + return $this->scheme; + } + + /** + * Get connection scheme. + * @return bool SSL mode + */ + public function isSsl(): bool + { + return $this->scheme === 'ssl'; + } + + /** + * Number of currently connected clients. + * @return int Connection count + */ + public function getConnectionCount(): int + { + return count($this->connections); + } + + /** + * Get currently connected clients. + * @return array Connections + */ + public function getConnections(): array + { + return $this->connections; + } + + /** + * Get currently readable clients. + * @return array Connections + */ + public function getReadableConnections(): array + { + return array_filter($this->connections, function (Connection $connection) { + return $connection->isReadable(); + }); + } + + /** + * Get currently writable clients. + * @return array Connections + */ + public function getWritableConnections(): array + { + return array_filter($this->connections, function (Connection $connection) { + return $connection->isWritable(); + }); + } + + /** + * Set stream context. + * @param Context|array $context Context or options as array + * @see https://www.php.net/manual/en/context.php + * @return self + */ + public function setContext(Context|array $context): self + { + if ($context instanceof Context) { + $this->context = $context; + } else { + $this->context->setOptions($context); + trigger_error('Calling Server.setContext with array is deprecated, use Context class.', E_USER_DEPRECATED); + } + return $this; + } + + /** + * Get current stream context. + * @return Context + */ + public function getContext(): Context + { + return $this->context; + } + + /** + * Add a middleware. + * @param MiddlewareInterface $middleware + * @return self + */ + public function addMiddleware(MiddlewareInterface $middleware): self + { + $this->middlewares[] = $middleware; + foreach ($this->connections as $connection) { + $connection->addMiddleware($middleware); + } + return $this; + } + + /** + * Set maximum number of connections allowed, null means unlimited. + * @param int|null $maxConnections + * @return self + * @throws InvalidArgumentException If number provided + */ + public function setMaxConnections(int|null $maxConnections): self + { + if ($maxConnections !== null && $maxConnections < 1) { + throw new InvalidArgumentException("Invalid maxConnections '{$maxConnections}' provided"); + } + $this->maxConnections = $maxConnections; + return $this; + } + + + /* ---------- Messaging operations ----------------------------------------------------------------------------- */ + + /** + * Send message (broadcast to all connected clients). + * @template T of Message + * @param T $message + * @return T + */ + public function send(Message $message): Message + { + foreach ($this->connections as $connection) { + if ($connection->isWritable()) { + $connection->send($message); + } + } + return $message; + } + + + /* ---------- Listener operations ------------------------------------------------------------------------------ */ + + /** + * Start server listener. + * @throws Throwable On low level error + */ + public function start(int|float|null $timeout = null): void + { + // Create socket server + if (empty($this->server)) { + $this->createSocketServer(); + } + + // Check if running + if ($this->running) { + $this->logger->warning("[server] Server is already running"); + return; + } + $this->running = true; + $this->logger->info("[server] Server is running"); + + /** @var StreamCollection */ + $streams = $this->streams; + + // Run handler + while ($this->running) { + try { + // Clear closed connections + $this->detachUnconnected(); + if (is_null($this->streams)) { + $this->stop(); + return; + } + + // Get streams with readable content + $readables = $this->streams->waitRead($timeout ?? $this->timeout); + foreach ($readables as $key => $readable) { + try { + $connection = null; + // Accept new client connection + if ($readable instanceof SocketServer) { + $this->acceptSocket($readable); + continue; + } + // Read from connection + $connection = $this->connections[$key]; + $message = $connection->pullMessage(); + $this->dispatch($message->getOpcode(), [$this, $connection, $message]); + } catch (MessageLevelInterface $e) { + // Error, but keep connection open + $this->logger->error("[server] {$e->getMessage()}", ['exception' => $e]); + $this->dispatch('error', [$this, $connection, $e]); + } catch (ConnectionLevelInterface $e) { + // Error, disconnect connection + if ($connection) { + $this->streams()->detach($key); + unset($this->connections[$key]); + $connection->disconnect(); + } + $this->logger->error("[server] {$e->getMessage()}", ['exception' => $e]); + $this->dispatch('error', [$this, $connection, $e]); + } catch (CloseException $e) { + // Should close + if ($connection) { + $connection->close($e->getCloseStatus(), $e->getMessage()); + } + $this->logger->error("[server] {$e->getMessage()}", ['exception' => $e]); + $this->dispatch('error', [$this, $connection, $e]); + } + } + foreach ($this->connections as $connection) { + $connection->tick(); + } + $this->dispatch('tick', [$this]); + } catch (ExceptionInterface $e) { + // Low-level error + $this->logger->error("[server] {$e->getMessage()}", ['exception' => $e]); + $this->dispatch('error', [$this, null, $e]); + } catch (Throwable $e) { + // Crash it + $this->logger->error("[server] {$e->getMessage()}", ['exception' => $e]); + $this->disconnect(); + throw $e; + } + gc_collect_cycles(); // Collect garbage + } + } + + /** + * Stop server listener (resumable). + */ + public function stop(): void + { + $this->running = false; + $this->logger->info("[server] Server is stopped"); + } + + /** + * If server is running (accepting connections and messages). + * @return bool + */ + public function isRunning(): bool + { + return $this->running; + } + + + /* ---------- Connection management ---------------------------------------------------------------------------- */ + + /** + * Orderly shutdown of server. + * @param int $closeStatus Default is 1001 "Going away" + */ + public function shutdown(int $closeStatus = 1001): void + { + $this->logger->info('[server] Shutting down'); + if ($this->getConnectionCount() == 0) { + $this->disconnect(); + return; + } + // Store and reset settings, lock new connections, reset listeners + $max = $this->maxConnections; + $this->maxConnections = 0; + $listeners = $this->listeners; + $this->listeners = []; + // Track disconnects + $this->onDisconnect(function () use ($max, $listeners) { + if ($this->getConnectionCount() > 0) { + return; + } + $this->disconnect(); + // Restore settings + $this->maxConnections = $max; + $this->listeners = $listeners; + }); + // Close all current connections, listen to acks + $this->close($closeStatus); + $this->start(); + } + + /** + * Disconnect all connections and stop server. + */ + public function disconnect(): void + { + $this->running = false; + foreach ($this->connections as $connection) { + $connection->disconnect(); + $this->dispatch('disconnect', [$this, $connection]); + } + $this->connections = []; + if ($this->server) { + $this->server->close(); + } + $this->server = $this->streams = null; + $this->logger->info('[server] Server disconnected'); + } + + + /* ---------- Internal helper methods -------------------------------------------------------------------------- */ + + // Create socket server + protected function createSocketServer(): void + { + try { + $uri = new Uri("{$this->scheme}://0.0.0.0:{$this->port}"); + $this->server = $this->streamFactory->createSocketServer($uri, $this->context); + $this->streams = $this->streamFactory->createStreamCollection(); + $this->streams->attach($this->server, '@server'); + $this->logger->info("[server] Starting server on {$uri}."); + } catch (Throwable $e) { + $error = "Server failed to start: {$e->getMessage()}"; + throw new ServerException($error); + } + } + + // Accept connection on socket server + protected function acceptSocket(SocketServer $socket): void + { + if (!is_null($this->maxConnections) && $this->getConnectionCount() >= $this->maxConnections) { + $this->logger->warning("[server] Denied connection, reached max {$this->maxConnections}"); + return; + } + try { + /** @var SocketStream $stream */ + $stream = $socket->accept(); + $name = $stream->getRemoteName(); + $this->streams()->attach($stream, $name); + $connection = new Connection( + $stream, + false, + true, + $this->isSsl(), + $this->httpFactory + ); + } catch (StreamException $e) { + throw new ConnectionFailureException("Server failed to accept: {$e->getMessage()}"); + } + try { + $connection->setLogger($this->logger); + $connection + ->setFrameSize($this->frameSize) + ->setTimeout($this->timeout) + ; + foreach ($this->middlewares as $middleware) { + $connection->addMiddleware($middleware); + } + /** @throws StreamException */ + $request = $this->performHandshake($connection); + $this->connections[$name] = $connection; + $this->logger->info("[server] Accepted connection from {$name}."); + $this->dispatch('handshake', [ + $this, + $connection, + $connection->getHandshakeRequest(), + $connection->getHandshakeResponse(), + ]); + $this->dispatch('connect', [$this, $connection, $request]); + } catch (ExceptionInterface | StreamException $e) { + $connection->disconnect(); + throw new ConnectionFailureException("Server failed to accept: {$e->getMessage()}"); + } + } + + // Detach connections no longer available + protected function detachUnconnected(): void + { + foreach ($this->connections as $key => $connection) { + if (!$connection->isConnected()) { + $this->streams()->detach($key); + unset($this->connections[$key]); + $this->logger->info("[server] Disconnected {$key}."); + $this->dispatch('disconnect', [$this, $connection]); + } + } + } + + // Perform upgrade handshake on new connections. + protected function performHandshake(Connection $connection): ServerRequest + { + $response = $this->httpFactory->createResponse(101); + $exception = null; + + // Read handshake request + /** @var ServerRequest */ + $request = $connection->pullHttp(); + + // Verify handshake request + try { + if ($request->getMethod() != 'GET') { + throw new HandshakeException( + "Handshake request with invalid method: '{$request->getMethod()}'", + $response->withStatus(405) + ); + } + $connectionHeader = trim($request->getHeaderLine('Connection')); + if (!str_contains(strtolower($connectionHeader), 'upgrade')) { + throw new HandshakeException( + "Handshake request with invalid Connection header: '{$connectionHeader}'", + $response->withStatus(426) + ); + } + $upgradeHeader = trim($request->getHeaderLine('Upgrade')); + if (strtolower($upgradeHeader) != 'websocket') { + throw new HandshakeException( + "Handshake request with invalid Upgrade header: '{$upgradeHeader}'", + $response->withStatus(426) + ); + } + $versionHeader = trim($request->getHeaderLine('Sec-WebSocket-Version')); + if ($versionHeader != '13') { + throw new HandshakeException( + "Handshake request with invalid Sec-WebSocket-Version header: '{$versionHeader}'", + $response->withStatus(426)->withHeader('Sec-WebSocket-Version', '13') + ); + } + $keyHeader = trim($request->getHeaderLine('Sec-WebSocket-Key')); + if (empty($keyHeader)) { + throw new HandshakeException( + "Handshake request with invalid Sec-WebSocket-Key header: '{$keyHeader}'", + $response->withStatus(426) + ); + } + if (strlen(base64_decode($keyHeader)) != 16) { + throw new HandshakeException( + "Handshake request with invalid Sec-WebSocket-Key header: '{$keyHeader}'", + $response->withStatus(426) + ); + } + + $responseKey = base64_encode(pack('H*', sha1($keyHeader . Constant::GUID))); + $response = $response + ->withHeader('Upgrade', 'websocket') + ->withHeader('Connection', 'Upgrade') + ->withHeader('Sec-WebSocket-Accept', $responseKey); + } catch (HandshakeException $e) { + $this->logger->warning("[server] {$e->getMessage()}", ['exception' => $e]); + $response = $e->getResponse(); + $exception = $e; + } + + // Respond to handshake + /** @var Response */ + $response = $connection->pushHttp($response); + if ($response->getStatusCode() != 101) { + $exception = new HandshakeException("Invalid status code {$response->getStatusCode()}", $response); + } + + if ($exception) { + throw $exception; + } + + $this->logger->debug("[server] Handshake on {$request->getUri()->getPath()}"); + $connection->setHandshakeRequest($request); + $connection->setHandshakeResponse($response); + + return $request; + } + + protected function streams(): StreamCollection + { + /** @var StreamCollection $streams */ + $streams = $this->streams; + return $streams; + } +} diff --git a/vendor/phrity/websocket/src/Trait/ListenerTrait.php b/vendor/phrity/websocket/src/Trait/ListenerTrait.php new file mode 100644 index 0000000..222c35e --- /dev/null +++ b/vendor/phrity/websocket/src/Trait/ListenerTrait.php @@ -0,0 +1,126 @@ + $listeners */ + private array $listeners = []; + + /** + * @param Closure(T, Connection, RequestInterface|ResponseInterface): void $closure + * @deprecated Will be removed in v4 + */ + public function onConnect(Closure $closure): self + { + $msg = 'onConnect() is deprecated and will be removed in v4. Use onHandshake() instead.'; + trigger_error($msg, E_USER_DEPRECATED); + $this->listeners['connect'] = $closure; + return $this; + } + + /** @param Closure(T, Connection): void $closure */ + public function onDisconnect(Closure $closure): self + { + $this->listeners['disconnect'] = $closure; + return $this; + } + + /** @param Closure(T, Connection, RequestInterface, ResponseInterface): void $closure */ + public function onHandshake(Closure $closure): self + { + $this->listeners['handshake'] = $closure; + return $this; + } + + /** @param Closure(T, Connection, Text): void $closure */ + public function onText(Closure $closure): self + { + $this->listeners['text'] = $closure; + return $this; + } + + /** @param Closure(T, Connection, Binary): void $closure */ + public function onBinary(Closure $closure): self + { + $this->listeners['binary'] = $closure; + return $this; + } + + /** @param Closure(T, Connection, Ping): void $closure */ + public function onPing(Closure $closure): self + { + $this->listeners['ping'] = $closure; + return $this; + } + + /** @param Closure(T, Connection, Pong): void $closure */ + public function onPong(Closure $closure): self + { + $this->listeners['pong'] = $closure; + return $this; + } + + /** @param Closure(T, Connection, Close): void $closure */ + public function onClose(Closure $closure): self + { + $this->listeners['close'] = $closure; + return $this; + } + + /** @param Closure(T, Connection|null, ExceptionInterface): void $closure */ + public function onError(Closure $closure): self + { + $this->listeners['error'] = $closure; + return $this; + } + + /** @param Closure(T): void $closure */ + public function onTick(Closure $closure): self + { + $this->listeners['tick'] = $closure; + return $this; + } + + /** + * @param array{ + * 0: T, + * 1?: Connection|null, + * 2?: Message|Text|Binary|Close|Ping|Pong|RequestInterface|ResponseInterface|ExceptionInterface|null, + * 3?: ResponseInterface|null + * } $args + */ + private function dispatch(string $type, array $args): void + { + if (array_key_exists($type, $this->listeners)) { + $closure = $this->listeners[$type]; + call_user_func_array($closure, $args); + } + } +} diff --git a/vendor/phrity/websocket/src/Trait/LoggerAwareTrait.php b/vendor/phrity/websocket/src/Trait/LoggerAwareTrait.php new file mode 100644 index 0000000..5890b33 --- /dev/null +++ b/vendor/phrity/websocket/src/Trait/LoggerAwareTrait.php @@ -0,0 +1,44 @@ +logger = $logger ?? new NullLogger(); + } + + public function setLogger(LoggerInterface $logger): void + { + $this->logger = $logger; + } + + public function attachLogger(mixed $instance): void + { + if ($instance instanceof LoggerAwareInterface) { + $instance->setLogger($this->logger); + } + } +} diff --git a/vendor/phrity/websocket/src/Trait/OpcodeTrait.php b/vendor/phrity/websocket/src/Trait/OpcodeTrait.php new file mode 100644 index 0000000..aa0926d --- /dev/null +++ b/vendor/phrity/websocket/src/Trait/OpcodeTrait.php @@ -0,0 +1,25 @@ + $opcodes */ + private static array $opcodes = [ + 'continuation' => 0, + 'text' => 1, + 'binary' => 2, + 'close' => 8, + 'ping' => 9, + 'pong' => 10, + ]; +} diff --git a/vendor/phrity/websocket/src/Trait/SendMethodsTrait.php b/vendor/phrity/websocket/src/Trait/SendMethodsTrait.php new file mode 100644 index 0000000..6d216a0 --- /dev/null +++ b/vendor/phrity/websocket/src/Trait/SendMethodsTrait.php @@ -0,0 +1,74 @@ +send(new Text($message)); + } + + /** + * Send binary message. + * @param string $message Content as binary string. + * @return Binary instance + */ + public function binary(string $message): Binary + { + return $this->send(new Binary($message)); + } + + /** + * Send ping. + * @param string $message Optional text as string. + * @return Ping instance + */ + public function ping(string $message = ''): Ping + { + return $this->send(new Ping($message)); + } + + /** + * Send unsolicited pong. + * @param string $message Optional text as string. + * @return Pong instance + */ + public function pong(string $message = ''): Pong + { + return $this->send(new Pong($message)); + } + + /** + * Tell the socket to close. + * @param integer $status http://tools.ietf.org/html/rfc6455#section-7.4 + * @param string $message A closing message, max 125 bytes. + * @return Close instance + */ + public function close(int $status = 1000, string $message = 'ttfn'): Close + { + return $this->send(new Close($status, $message)); + } +} diff --git a/vendor/phrity/websocket/src/Trait/StringableTrait.php b/vendor/phrity/websocket/src/Trait/StringableTrait.php new file mode 100644 index 0000000..ba67f1d --- /dev/null +++ b/vendor/phrity/websocket/src/Trait/StringableTrait.php @@ -0,0 +1,25 @@ +=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/psr/http-factory/src/RequestFactoryInterface.php b/vendor/psr/http-factory/src/RequestFactoryInterface.php new file mode 100644 index 0000000..cb39a08 --- /dev/null +++ b/vendor/psr/http-factory/src/RequestFactoryInterface.php @@ -0,0 +1,18 @@ + `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`. +> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered. + diff --git a/vendor/psr/http-message/docs/PSR7-Usage.md b/vendor/psr/http-message/docs/PSR7-Usage.md new file mode 100644 index 0000000..b6d048a --- /dev/null +++ b/vendor/psr/http-message/docs/PSR7-Usage.md @@ -0,0 +1,159 @@ +### PSR-7 Usage + +All PSR-7 applications comply with these interfaces +They were created to establish a standard between middleware implementations. + +> `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`. +> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered. + + +The following examples will illustrate how basic operations are done in PSR-7. + +##### Examples + + +For this examples to work (at least) a PSR-7 implementation package is required. (eg: zendframework/zend-diactoros, guzzlehttp/psr7, slim/slim, etc) +All PSR-7 implementations should have the same behaviour. + +The following will be assumed: +`$request` is an object of `Psr\Http\Message\RequestInterface` and + +`$response` is an object implementing `Psr\Http\Message\RequestInterface` + + +### Working with HTTP Headers + +#### Adding headers to response: + +```php +$response->withHeader('My-Custom-Header', 'My Custom Message'); +``` + +#### Appending values to headers + +```php +$response->withAddedHeader('My-Custom-Header', 'The second message'); +``` + +#### Checking if header exists: + +```php +$request->hasHeader('My-Custom-Header'); // will return false +$response->hasHeader('My-Custom-Header'); // will return true +``` + +> Note: My-Custom-Header was only added in the Response + +#### Getting comma-separated values from a header (also applies to request) + +```php +// getting value from request headers +$request->getHeaderLine('Content-Type'); // will return: "text/html; charset=UTF-8" +// getting value from response headers +$response->getHeaderLine('My-Custom-Header'); // will return: "My Custom Message; The second message" +``` + +#### Getting array of value from a header (also applies to request) +```php +// getting value from request headers +$request->getHeader('Content-Type'); // will return: ["text/html", "charset=UTF-8"] +// getting value from response headers +$response->getHeader('My-Custom-Header'); // will return: ["My Custom Message", "The second message"] +``` + +#### Removing headers from HTTP Messages +```php +// removing a header from Request, removing deprecated "Content-MD5" header +$request->withoutHeader('Content-MD5'); + +// removing a header from Response +// effect: the browser won't know the size of the stream +// the browser will download the stream till it ends +$response->withoutHeader('Content-Length'); +``` + +### Working with HTTP Message Body + +When working with the PSR-7 there are two methods of implementation: +#### 1. Getting the body separately + +> This method makes the body handling easier to understand and is useful when repeatedly calling body methods. (You only call `getBody()` once). Using this method mistakes like `$response->write()` are also prevented. + +```php +$body = $response->getBody(); +// operations on body, eg. read, write, seek +// ... +// replacing the old body +$response->withBody($body); +// this last statement is optional as we working with objects +// in this case the "new" body is same with the "old" one +// the $body variable has the same value as the one in $request, only the reference is passed +``` + +#### 2. Working directly on response + +> This method is useful when only performing few operations as the `$request->getBody()` statement fragment is required + +```php +$response->getBody()->write('hello'); +``` + +### Getting the body contents + +The following snippet gets the contents of a stream contents. +> Note: Streams must be rewinded, if content was written into streams, it will be ignored when calling `getContents()` because the stream pointer is set to the last character, which is `\0` - meaning end of stream. +```php +$body = $response->getBody(); +$body->rewind(); // or $body->seek(0); +$bodyText = $body->getContents(); +``` +> Note: If `$body->seek(1)` is called before `$body->getContents()`, the first character will be ommited as the starting pointer is set to `1`, not `0`. This is why using `$body->rewind()` is recommended. + +### Append to body + +```php +$response->getBody()->write('Hello'); // writing directly +$body = $request->getBody(); // which is a `StreamInterface` +$body->write('xxxxx'); +``` + +### Prepend to body +Prepending is different when it comes to streams. The content must be copied before writing the content to be prepended. +The following example will explain the behaviour of streams. + +```php +// assuming our response is initially empty +$body = $repsonse->getBody(); +// writing the string "abcd" +$body->write('abcd'); + +// seeking to start of stream +$body->seek(0); +// writing 'ef' +$body->write('ef'); // at this point the stream contains "efcd" +``` + +#### Prepending by rewriting separately + +```php +// assuming our response body stream only contains: "abcd" +$body = $response->getBody(); +$body->rewind(); +$contents = $body->getContents(); // abcd +// seeking the stream to beginning +$body->rewind(); +$body->write('ef'); // stream contains "efcd" +$body->write($contents); // stream contains "efabcd" +``` + +> Note: `getContents()` seeks the stream while reading it, therefore if the second `rewind()` method call was not present the stream would have resulted in `abcdefabcd` because the `write()` method appends to stream if not preceeded by `rewind()` or `seek(0)`. + +#### Prepending by using contents as a string +```php +$body = $response->getBody(); +$body->rewind(); +$contents = $body->getContents(); // efabcd +$contents = 'ef'.$contents; +$body->rewind(); +$body->write($contents); +``` diff --git a/vendor/psr/http-message/src/MessageInterface.php b/vendor/psr/http-message/src/MessageInterface.php new file mode 100644 index 0000000..a83c985 --- /dev/null +++ b/vendor/psr/http-message/src/MessageInterface.php @@ -0,0 +1,187 @@ +getHeaders() as $name => $values) { + * echo $name . ": " . implode(", ", $values); + * } + * + * // Emit headers iteratively: + * foreach ($message->getHeaders() as $name => $values) { + * foreach ($values as $value) { + * header(sprintf('%s: %s', $name, $value), false); + * } + * } + * + * While header names are not case-sensitive, getHeaders() will preserve the + * exact case in which headers were originally specified. + * + * @return string[][] Returns an associative array of the message's headers. Each + * key MUST be a header name, and each value MUST be an array of strings + * for that header. + */ + public function getHeaders(): array; + + /** + * Checks if a header exists by the given case-insensitive name. + * + * @param string $name Case-insensitive header field name. + * @return bool Returns true if any header names match the given header + * name using a case-insensitive string comparison. Returns false if + * no matching header name is found in the message. + */ + public function hasHeader(string $name): bool; + + /** + * Retrieves a message header value by the given case-insensitive name. + * + * This method returns an array of all the header values of the given + * case-insensitive header name. + * + * If the header does not appear in the message, this method MUST return an + * empty array. + * + * @param string $name Case-insensitive header field name. + * @return string[] An array of string values as provided for the given + * header. If the header does not appear in the message, this method MUST + * return an empty array. + */ + public function getHeader(string $name): array; + + /** + * Retrieves a comma-separated string of the values for a single header. + * + * This method returns all of the header values of the given + * case-insensitive header name as a string concatenated together using + * a comma. + * + * NOTE: Not all header values may be appropriately represented using + * comma concatenation. For such headers, use getHeader() instead + * and supply your own delimiter when concatenating. + * + * If the header does not appear in the message, this method MUST return + * an empty string. + * + * @param string $name Case-insensitive header field name. + * @return string A string of values as provided for the given header + * concatenated together using a comma. If the header does not appear in + * the message, this method MUST return an empty string. + */ + public function getHeaderLine(string $name): string; + + /** + * Return an instance with the provided value replacing the specified header. + * + * While header names are case-insensitive, the casing of the header will + * be preserved by this function, and returned from getHeaders(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new and/or updated header and value. + * + * @param string $name Case-insensitive header field name. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withHeader(string $name, $value): MessageInterface; + + /** + * Return an instance with the specified header appended with the given value. + * + * Existing values for the specified header will be maintained. The new + * value(s) will be appended to the existing list. If the header did not + * exist previously, it will be added. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new header and/or value. + * + * @param string $name Case-insensitive header field name to add. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withAddedHeader(string $name, $value): MessageInterface; + + /** + * Return an instance without the specified header. + * + * Header resolution MUST be done without case-sensitivity. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the named header. + * + * @param string $name Case-insensitive header field name to remove. + * @return static + */ + public function withoutHeader(string $name): MessageInterface; + + /** + * Gets the body of the message. + * + * @return StreamInterface Returns the body as a stream. + */ + public function getBody(): StreamInterface; + + /** + * Return an instance with the specified message body. + * + * The body MUST be a StreamInterface object. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return a new instance that has the + * new body stream. + * + * @param StreamInterface $body Body. + * @return static + * @throws \InvalidArgumentException When the body is not valid. + */ + public function withBody(StreamInterface $body): MessageInterface; +} diff --git a/vendor/psr/http-message/src/RequestInterface.php b/vendor/psr/http-message/src/RequestInterface.php new file mode 100644 index 0000000..33f85e5 --- /dev/null +++ b/vendor/psr/http-message/src/RequestInterface.php @@ -0,0 +1,130 @@ +getQuery()` + * or from the `QUERY_STRING` server param. + * + * @return array + */ + public function getQueryParams(): array; + + /** + * Return an instance with the specified query string arguments. + * + * These values SHOULD remain immutable over the course of the incoming + * request. They MAY be injected during instantiation, such as from PHP's + * $_GET superglobal, or MAY be derived from some other value such as the + * URI. In cases where the arguments are parsed from the URI, the data + * MUST be compatible with what PHP's parse_str() would return for + * purposes of how duplicate query parameters are handled, and how nested + * sets are handled. + * + * Setting query string arguments MUST NOT change the URI stored by the + * request, nor the values in the server params. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated query string arguments. + * + * @param array $query Array of query string arguments, typically from + * $_GET. + * @return static + */ + public function withQueryParams(array $query): ServerRequestInterface; + + /** + * Retrieve normalized file upload data. + * + * This method returns upload metadata in a normalized tree, with each leaf + * an instance of Psr\Http\Message\UploadedFileInterface. + * + * These values MAY be prepared from $_FILES or the message body during + * instantiation, or MAY be injected via withUploadedFiles(). + * + * @return array An array tree of UploadedFileInterface instances; an empty + * array MUST be returned if no data is present. + */ + public function getUploadedFiles(): array; + + /** + * Create a new instance with the specified uploaded files. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param array $uploadedFiles An array tree of UploadedFileInterface instances. + * @return static + * @throws \InvalidArgumentException if an invalid structure is provided. + */ + public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface; + + /** + * Retrieve any parameters provided in the request body. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, this method MUST + * return the contents of $_POST. + * + * Otherwise, this method may return any results of deserializing + * the request body content; as parsing returns structured content, the + * potential types MUST be arrays or objects only. A null value indicates + * the absence of body content. + * + * @return null|array|object The deserialized body parameters, if any. + * These will typically be an array or object. + */ + public function getParsedBody(); + + /** + * Return an instance with the specified body parameters. + * + * These MAY be injected during instantiation. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, use this method + * ONLY to inject the contents of $_POST. + * + * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of + * deserializing the request body content. Deserialization/parsing returns + * structured data, and, as such, this method ONLY accepts arrays or objects, + * or a null value if nothing was available to parse. + * + * As an example, if content negotiation determines that the request data + * is a JSON payload, this method could be used to create a request + * instance with the deserialized parameters. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param null|array|object $data The deserialized body data. This will + * typically be in an array or object. + * @return static + * @throws \InvalidArgumentException if an unsupported argument type is + * provided. + */ + public function withParsedBody($data): ServerRequestInterface; + + /** + * Retrieve attributes derived from the request. + * + * The request "attributes" may be used to allow injection of any + * parameters derived from the request: e.g., the results of path + * match operations; the results of decrypting cookies; the results of + * deserializing non-form-encoded message bodies; etc. Attributes + * will be application and request specific, and CAN be mutable. + * + * @return array Attributes derived from the request. + */ + public function getAttributes(): array; + + /** + * Retrieve a single derived request attribute. + * + * Retrieves a single derived request attribute as described in + * getAttributes(). If the attribute has not been previously set, returns + * the default value as provided. + * + * This method obviates the need for a hasAttribute() method, as it allows + * specifying a default value to return if the attribute is not found. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $default Default value to return if the attribute does not exist. + * @return mixed + */ + public function getAttribute(string $name, $default = null); + + /** + * Return an instance with the specified derived request attribute. + * + * This method allows setting a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $value The value of the attribute. + * @return static + */ + public function withAttribute(string $name, $value): ServerRequestInterface; + + /** + * Return an instance that removes the specified derived request attribute. + * + * This method allows removing a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @return static + */ + public function withoutAttribute(string $name): ServerRequestInterface; +} diff --git a/vendor/psr/http-message/src/StreamInterface.php b/vendor/psr/http-message/src/StreamInterface.php new file mode 100644 index 0000000..a62aabb --- /dev/null +++ b/vendor/psr/http-message/src/StreamInterface.php @@ -0,0 +1,158 @@ + + * [user-info@]host[:port] + * + * + * If the port component is not set or is the standard port for the current + * scheme, it SHOULD NOT be included. + * + * @see https://tools.ietf.org/html/rfc3986#section-3.2 + * @return string The URI authority, in "[user-info@]host[:port]" format. + */ + public function getAuthority(): string; + + /** + * Retrieve the user information component of the URI. + * + * If no user information is present, this method MUST return an empty + * string. + * + * If a user is present in the URI, this will return that value; + * additionally, if the password is also present, it will be appended to the + * user value, with a colon (":") separating the values. + * + * The trailing "@" character is not part of the user information and MUST + * NOT be added. + * + * @return string The URI user information, in "username[:password]" format. + */ + public function getUserInfo(): string; + + /** + * Retrieve the host component of the URI. + * + * If no host is present, this method MUST return an empty string. + * + * The value returned MUST be normalized to lowercase, per RFC 3986 + * Section 3.2.2. + * + * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 + * @return string The URI host. + */ + public function getHost(): string; + + /** + * Retrieve the port component of the URI. + * + * If a port is present, and it is non-standard for the current scheme, + * this method MUST return it as an integer. If the port is the standard port + * used with the current scheme, this method SHOULD return null. + * + * If no port is present, and no scheme is present, this method MUST return + * a null value. + * + * If no port is present, but a scheme is present, this method MAY return + * the standard port for that scheme, but SHOULD return null. + * + * @return null|int The URI port. + */ + public function getPort(): ?int; + + /** + * Retrieve the path component of the URI. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * Normally, the empty path "" and absolute path "/" are considered equal as + * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically + * do this normalization because in contexts with a trimmed base path, e.g. + * the front controller, this difference becomes significant. It's the task + * of the user to handle both "" and "/". + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.3. + * + * As an example, if the value should include a slash ("/") not intended as + * delimiter between path segments, that value MUST be passed in encoded + * form (e.g., "%2F") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.3 + * @return string The URI path. + */ + public function getPath(): string; + + /** + * Retrieve the query string of the URI. + * + * If no query string is present, this method MUST return an empty string. + * + * The leading "?" character is not part of the query and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.4. + * + * As an example, if a value in a key/value pair of the query string should + * include an ampersand ("&") not intended as a delimiter between values, + * that value MUST be passed in encoded form (e.g., "%26") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.4 + * @return string The URI query string. + */ + public function getQuery(): string; + + /** + * Retrieve the fragment component of the URI. + * + * If no fragment is present, this method MUST return an empty string. + * + * The leading "#" character is not part of the fragment and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.5. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.5 + * @return string The URI fragment. + */ + public function getFragment(): string; + + /** + * Return an instance with the specified scheme. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified scheme. + * + * Implementations MUST support the schemes "http" and "https" case + * insensitively, and MAY accommodate other schemes if required. + * + * An empty scheme is equivalent to removing the scheme. + * + * @param string $scheme The scheme to use with the new instance. + * @return static A new instance with the specified scheme. + * @throws \InvalidArgumentException for invalid or unsupported schemes. + */ + public function withScheme(string $scheme): UriInterface; + + /** + * Return an instance with the specified user information. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified user information. + * + * Password is optional, but the user information MUST include the + * user; an empty string for the user is equivalent to removing user + * information. + * + * @param string $user The user name to use for authority. + * @param null|string $password The password associated with $user. + * @return static A new instance with the specified user information. + */ + public function withUserInfo(string $user, ?string $password = null): UriInterface; + + /** + * Return an instance with the specified host. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified host. + * + * An empty host value is equivalent to removing the host. + * + * @param string $host The hostname to use with the new instance. + * @return static A new instance with the specified host. + * @throws \InvalidArgumentException for invalid hostnames. + */ + public function withHost(string $host): UriInterface; + + /** + * Return an instance with the specified port. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified port. + * + * Implementations MUST raise an exception for ports outside the + * established TCP and UDP port ranges. + * + * A null value provided for the port is equivalent to removing the port + * information. + * + * @param null|int $port The port to use with the new instance; a null value + * removes the port information. + * @return static A new instance with the specified port. + * @throws \InvalidArgumentException for invalid ports. + */ + public function withPort(?int $port): UriInterface; + + /** + * Return an instance with the specified path. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified path. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * If the path is intended to be domain-relative rather than path relative then + * it must begin with a slash ("/"). Paths not starting with a slash ("/") + * are assumed to be relative to some base path known to the application or + * consumer. + * + * Users can provide both encoded and decoded path characters. + * Implementations ensure the correct encoding as outlined in getPath(). + * + * @param string $path The path to use with the new instance. + * @return static A new instance with the specified path. + * @throws \InvalidArgumentException for invalid paths. + */ + public function withPath(string $path): UriInterface; + + /** + * Return an instance with the specified query string. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified query string. + * + * Users can provide both encoded and decoded query characters. + * Implementations ensure the correct encoding as outlined in getQuery(). + * + * An empty query string value is equivalent to removing the query string. + * + * @param string $query The query string to use with the new instance. + * @return static A new instance with the specified query string. + * @throws \InvalidArgumentException for invalid query strings. + */ + public function withQuery(string $query): UriInterface; + + /** + * Return an instance with the specified URI fragment. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified URI fragment. + * + * Users can provide both encoded and decoded fragment characters. + * Implementations ensure the correct encoding as outlined in getFragment(). + * + * An empty fragment value is equivalent to removing the fragment. + * + * @param string $fragment The fragment to use with the new instance. + * @return static A new instance with the specified fragment. + */ + public function withFragment(string $fragment): UriInterface; + + /** + * Return the string representation as a URI reference. + * + * Depending on which components of the URI are present, the resulting + * string is either a full URI or relative reference according to RFC 3986, + * Section 4.1. The method concatenates the various components of the URI, + * using the appropriate delimiters: + * + * - If a scheme is present, it MUST be suffixed by ":". + * - If an authority is present, it MUST be prefixed by "//". + * - The path can be concatenated without delimiters. But there are two + * cases where the path has to be adjusted to make the URI reference + * valid as PHP does not allow to throw an exception in __toString(): + * - If the path is rootless and an authority is present, the path MUST + * be prefixed by "/". + * - If the path is starting with more than one "/" and no authority is + * present, the starting slashes MUST be reduced to one. + * - If a query is present, it MUST be prefixed by "?". + * - If a fragment is present, it MUST be prefixed by "#". + * + * @see http://tools.ietf.org/html/rfc3986#section-4.1 + * @return string + */ + public function __toString(): string; +} diff --git a/vendor/psr/log/Psr/Log/AbstractLogger.php b/vendor/psr/log/Psr/Log/AbstractLogger.php deleted file mode 100644 index e02f9da..0000000 --- a/vendor/psr/log/Psr/Log/AbstractLogger.php +++ /dev/null @@ -1,128 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param mixed[] $context - * - * @return void - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } -} diff --git a/vendor/psr/log/Psr/Log/Test/DummyTest.php b/vendor/psr/log/Psr/Log/Test/DummyTest.php deleted file mode 100644 index 9638c11..0000000 --- a/vendor/psr/log/Psr/Log/Test/DummyTest.php +++ /dev/null @@ -1,18 +0,0 @@ - ". - * - * Example ->error('Foo') would yield "error Foo". - * - * @return string[] - */ - abstract public function getLogs(); - - public function testImplements() - { - $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); - } - - /** - * @dataProvider provideLevelsAndMessages - */ - public function testLogsAtAllLevels($level, $message) - { - $logger = $this->getLogger(); - $logger->{$level}($message, array('user' => 'Bob')); - $logger->log($level, $message, array('user' => 'Bob')); - - $expected = array( - $level.' message of level '.$level.' with context: Bob', - $level.' message of level '.$level.' with context: Bob', - ); - $this->assertEquals($expected, $this->getLogs()); - } - - public function provideLevelsAndMessages() - { - return array( - LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), - LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), - LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), - LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), - LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), - LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), - LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), - LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), - ); - } - - /** - * @expectedException \Psr\Log\InvalidArgumentException - */ - public function testThrowsOnInvalidLevel() - { - $logger = $this->getLogger(); - $logger->log('invalid level', 'Foo'); - } - - public function testContextReplacement() - { - $logger = $this->getLogger(); - $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); - - $expected = array('info {Message {nothing} Bob Bar a}'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testObjectCastToString() - { - if (method_exists($this, 'createPartialMock')) { - $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); - } else { - $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); - } - $dummy->expects($this->once()) - ->method('__toString') - ->will($this->returnValue('DUMMY')); - - $this->getLogger()->warning($dummy); - - $expected = array('warning DUMMY'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextCanContainAnything() - { - $closed = fopen('php://memory', 'r'); - fclose($closed); - - $context = array( - 'bool' => true, - 'null' => null, - 'string' => 'Foo', - 'int' => 0, - 'float' => 0.5, - 'nested' => array('with object' => new DummyTest), - 'object' => new \DateTime, - 'resource' => fopen('php://memory', 'r'), - 'closed' => $closed, - ); - - $this->getLogger()->warning('Crazy context data', $context); - - $expected = array('warning Crazy context data'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextExceptionKeyCanBeExceptionOrOtherValues() - { - $logger = $this->getLogger(); - $logger->warning('Random message', array('exception' => 'oops')); - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); - - $expected = array( - 'warning Random message', - 'critical Uncaught Exception!' - ); - $this->assertEquals($expected, $this->getLogs()); - } -} diff --git a/vendor/psr/log/Psr/Log/Test/TestLogger.php b/vendor/psr/log/Psr/Log/Test/TestLogger.php deleted file mode 100644 index 1be3230..0000000 --- a/vendor/psr/log/Psr/Log/Test/TestLogger.php +++ /dev/null @@ -1,147 +0,0 @@ - $level, - 'message' => $message, - 'context' => $context, - ]; - - $this->recordsByLevel[$record['level']][] = $record; - $this->records[] = $record; - } - - public function hasRecords($level) - { - return isset($this->recordsByLevel[$level]); - } - - public function hasRecord($record, $level) - { - if (is_string($record)) { - $record = ['message' => $record]; - } - return $this->hasRecordThatPasses(function ($rec) use ($record) { - if ($rec['message'] !== $record['message']) { - return false; - } - if (isset($record['context']) && $rec['context'] !== $record['context']) { - return false; - } - return true; - }, $level); - } - - public function hasRecordThatContains($message, $level) - { - return $this->hasRecordThatPasses(function ($rec) use ($message) { - return strpos($rec['message'], $message) !== false; - }, $level); - } - - public function hasRecordThatMatches($regex, $level) - { - return $this->hasRecordThatPasses(function ($rec) use ($regex) { - return preg_match($regex, $rec['message']) > 0; - }, $level); - } - - public function hasRecordThatPasses(callable $predicate, $level) - { - if (!isset($this->recordsByLevel[$level])) { - return false; - } - foreach ($this->recordsByLevel[$level] as $i => $rec) { - if (call_user_func($predicate, $rec, $i)) { - return true; - } - } - return false; - } - - public function __call($method, $args) - { - if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { - $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; - $level = strtolower($matches[2]); - if (method_exists($this, $genericMethod)) { - $args[] = $level; - return call_user_func_array([$this, $genericMethod], $args); - } - } - throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); - } - - public function reset() - { - $this->records = []; - $this->recordsByLevel = []; - } -} diff --git a/vendor/psr/log/composer.json b/vendor/psr/log/composer.json index ca05695..879fc6f 100644 --- a/vendor/psr/log/composer.json +++ b/vendor/psr/log/composer.json @@ -11,16 +11,16 @@ } ], "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } } } diff --git a/vendor/psr/log/src/AbstractLogger.php b/vendor/psr/log/src/AbstractLogger.php new file mode 100644 index 0000000..d60a091 --- /dev/null +++ b/vendor/psr/log/src/AbstractLogger.php @@ -0,0 +1,15 @@ +logger = $logger; } diff --git a/vendor/psr/log/Psr/Log/LoggerInterface.php b/vendor/psr/log/src/LoggerInterface.php similarity index 63% rename from vendor/psr/log/Psr/Log/LoggerInterface.php rename to vendor/psr/log/src/LoggerInterface.php index 2206cfd..cb4cf64 100644 --- a/vendor/psr/log/Psr/Log/LoggerInterface.php +++ b/vendor/psr/log/src/LoggerInterface.php @@ -22,12 +22,9 @@ interface LoggerInterface /** * System is unusable. * - * @param string $message * @param mixed[] $context - * - * @return void */ - public function emergency($message, array $context = array()); + public function emergency(string|\Stringable $message, array $context = []): void; /** * Action must be taken immediately. @@ -35,35 +32,26 @@ public function emergency($message, array $context = array()); * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * - * @param string $message * @param mixed[] $context - * - * @return void */ - public function alert($message, array $context = array()); + public function alert(string|\Stringable $message, array $context = []): void; /** * Critical conditions. * * Example: Application component unavailable, unexpected exception. * - * @param string $message * @param mixed[] $context - * - * @return void */ - public function critical($message, array $context = array()); + public function critical(string|\Stringable $message, array $context = []): void; /** * Runtime errors that do not require immediate action but should typically * be logged and monitored. * - * @param string $message * @param mixed[] $context - * - * @return void */ - public function error($message, array $context = array()); + public function error(string|\Stringable $message, array $context = []): void; /** * Exceptional occurrences that are not errors. @@ -71,55 +59,40 @@ public function error($message, array $context = array()); * Example: Use of deprecated APIs, poor use of an API, undesirable things * that are not necessarily wrong. * - * @param string $message * @param mixed[] $context - * - * @return void */ - public function warning($message, array $context = array()); + public function warning(string|\Stringable $message, array $context = []): void; /** * Normal but significant events. * - * @param string $message * @param mixed[] $context - * - * @return void */ - public function notice($message, array $context = array()); + public function notice(string|\Stringable $message, array $context = []): void; /** * Interesting events. * * Example: User logs in, SQL logs. * - * @param string $message * @param mixed[] $context - * - * @return void */ - public function info($message, array $context = array()); + public function info(string|\Stringable $message, array $context = []): void; /** * Detailed debug information. * - * @param string $message * @param mixed[] $context - * - * @return void */ - public function debug($message, array $context = array()); + public function debug(string|\Stringable $message, array $context = []): void; /** * Logs with an arbitrary level. * - * @param mixed $level - * @param string $message + * @param mixed $level * @param mixed[] $context * - * @return void - * * @throws \Psr\Log\InvalidArgumentException */ - public function log($level, $message, array $context = array()); + public function log($level, string|\Stringable $message, array $context = []): void; } diff --git a/vendor/psr/log/Psr/Log/LoggerTrait.php b/vendor/psr/log/src/LoggerTrait.php similarity index 57% rename from vendor/psr/log/Psr/Log/LoggerTrait.php rename to vendor/psr/log/src/LoggerTrait.php index e392fef..a5d9980 100644 --- a/vendor/psr/log/Psr/Log/LoggerTrait.php +++ b/vendor/psr/log/src/LoggerTrait.php @@ -14,13 +14,8 @@ trait LoggerTrait { /** * System is unusable. - * - * @param string $message - * @param array $context - * - * @return void */ - public function emergency($message, array $context = array()) + public function emergency(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::EMERGENCY, $message, $context); } @@ -30,13 +25,8 @@ public function emergency($message, array $context = array()) * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * - * @return void */ - public function alert($message, array $context = array()) + public function alert(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::ALERT, $message, $context); } @@ -45,13 +35,8 @@ public function alert($message, array $context = array()) * Critical conditions. * * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * - * @return void */ - public function critical($message, array $context = array()) + public function critical(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::CRITICAL, $message, $context); } @@ -59,13 +44,8 @@ public function critical($message, array $context = array()) /** * Runtime errors that do not require immediate action but should typically * be logged and monitored. - * - * @param string $message - * @param array $context - * - * @return void */ - public function error($message, array $context = array()) + public function error(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::ERROR, $message, $context); } @@ -75,26 +55,16 @@ public function error($message, array $context = array()) * * Example: Use of deprecated APIs, poor use of an API, undesirable things * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * - * @return void */ - public function warning($message, array $context = array()) + public function warning(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::WARNING, $message, $context); } /** * Normal but significant events. - * - * @param string $message - * @param array $context - * - * @return void */ - public function notice($message, array $context = array()) + public function notice(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::NOTICE, $message, $context); } @@ -103,26 +73,16 @@ public function notice($message, array $context = array()) * Interesting events. * * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * - * @return void */ - public function info($message, array $context = array()) + public function info(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::INFO, $message, $context); } /** * Detailed debug information. - * - * @param string $message - * @param array $context - * - * @return void */ - public function debug($message, array $context = array()) + public function debug(string|\Stringable $message, array $context = []): void { $this->log(LogLevel::DEBUG, $message, $context); } @@ -130,13 +90,9 @@ public function debug($message, array $context = array()) /** * Logs with an arbitrary level. * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void + * @param mixed $level * * @throws \Psr\Log\InvalidArgumentException */ - abstract public function log($level, $message, array $context = array()); + abstract public function log($level, string|\Stringable $message, array $context = []): void; } diff --git a/vendor/psr/log/Psr/Log/NullLogger.php b/vendor/psr/log/src/NullLogger.php similarity index 74% rename from vendor/psr/log/Psr/Log/NullLogger.php rename to vendor/psr/log/src/NullLogger.php index c8f7293..de0561e 100644 --- a/vendor/psr/log/Psr/Log/NullLogger.php +++ b/vendor/psr/log/src/NullLogger.php @@ -15,15 +15,11 @@ class NullLogger extends AbstractLogger /** * Logs with an arbitrary level. * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void + * @param mixed[] $context * * @throws \Psr\Log\InvalidArgumentException */ - public function log($level, $message, array $context = array()) + public function log($level, string|\Stringable $message, array $context = []): void { // noop } diff --git a/vendor/setasign/fpdi/README.md b/vendor/setasign/fpdi/README.md deleted file mode 100644 index e27d205..0000000 --- a/vendor/setasign/fpdi/README.md +++ /dev/null @@ -1,131 +0,0 @@ -FPDI - Free PDF Document Importer -================================= - -[![Latest Stable Version](https://poser.pugx.org/setasign/fpdi/v/stable.svg)](https://packagist.org/packages/setasign/fpdi) -[![Total Downloads](https://poser.pugx.org/setasign/fpdi/downloads.svg)](https://packagist.org/packages/setasign/fpdi) -[![Latest Unstable Version](https://poser.pugx.org/setasign/fpdi/v/unstable.svg)](https://packagist.org/packages/setasign/fpdi) -[![License](https://poser.pugx.org/setasign/fpdi/license.svg)](https://packagist.org/packages/setasign/fpdi) - -:heavy_exclamation_mark: This document refers to FPDI 2. Version 1 is deprecated and development is discontinued. :heavy_exclamation_mark: - -FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF -documents and use them as templates in [FPDF](http://www.fpdf.org), which was developed by Olivier Plathey. Apart -from a copy of [FPDF](http://www.fpdf.org), FPDI does not require any special PHP extensions. - -FPDI can also be used as an extension for [TCPDF](https://github.com/tecnickcom/TCPDF) or -[tFPDF](http://fpdf.org/en/script/script92.php), too. - -## Installation with [Composer](https://packagist.org/packages/setasign/fpdi) - -Because FPDI can be used with FPDF, TCPDF or tFPDF we haven't added a fixed dependency in the main -composer.json file. You need to add the dependency to the PDF generation library of your choice -yourself. - -To use FPDI with FPDF include following in your composer.json file: - -```json -{ - "require": { - "setasign/fpdf": "1.8.*", - "setasign/fpdi": "^2.5" - } -} -``` - -If you want to use TCPDF, you have to update your composer.json to: - -```json -{ - "require": { - "tecnickcom/tcpdf": "6.6.*", - "setasign/fpdi": "^2.5" - } -} -``` - -If you want to use tFPDF, you have to update your composer.json to: - -```json -{ - "require": { - "setasign/tfpdf": "1.33.*", - "setasign/fpdi": "^2.3" - } -} -``` - -## Manual Installation - -If you do not use composer, just require the autoload.php in the /src folder: - -```php -require_once('src/autoload.php'); -``` - -If you have a PSR-4 autoloader implemented, just register the src path as follows: -```php -$loader = new \Example\Psr4AutoloaderClass; -$loader->register(); -$loader->addNamespace('setasign\Fpdi', 'path/to/src/'); -``` - -## Changes to Version 1 - -Version 2 is a complete rewrite from scratch of FPDI which comes with: -- Namespaced code -- Clean and up-to-date code base and style -- PSR-4 compatible autoloading -- Performance improvements by up to 100% -- Less memory consumption -- Native support for reading PDFs from strings or stream-resources -- Support for documents with "invalid" data before their file-header -- Optimized page tree resolving -- Usage of individual exceptions -- Several test types (unit, functional and visual tests) - -We tried to keep the main methods and logical workflow the same as in version 1 but please -notice that there were incompatible changes which you should consider when updating to -version 2: -- You need to load the code using the `src/autoload.php` file instead of `classes/FPDI.php`. -- The classes and traits are namespaced now: `setasign\Fpdi` -- Page boundaries beginning with a slash, such as `/MediaBox`, are not supported anymore. Remove - the slash or use a constant of `PdfReader\PageBoundaries`. -- The parameters $x, $y, $width and $height of the `useTemplate()` or `getTemplateSize()` - method have more logical correct default values now. Passing `0` as width or height will - result in an `InvalidArgumentException` now. -- The return value of `getTemplateSize()` had changed to an array with more speaking keys - and reusability: Use `width` instead of `w` and `height` instead of `h`. -- If you want to use **FPDI with TCPDF** you need to refactor your code to use the class `Tcpdf\Fpdi` -(since 2.1; before it was `TcpdfFpdi`) instead of `FPDI`. - -## Example and Documentation - -A simple example, that imports a single page and places this onto a new created page: - -```php -AddPage(); -// set the source file -$pdf->setSourceFile("Fantastic-Speaker.pdf"); -// import page 1 -$tplId = $pdf->importPage(1); -// use the imported page and place it at point 10,10 with a width of 100 mm -$pdf->useTemplate($tplId, 10, 10, 100); - -$pdf->Output(); -``` - -A full end-user documentation and API reference is available [here](https://manuals.setasign.com/fpdi-manual/). diff --git a/vendor/setasign/fpdi/SECURITY.md b/vendor/setasign/fpdi/SECURITY.md deleted file mode 100644 index da9c516..0000000 --- a/vendor/setasign/fpdi/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -## Security contact information - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. diff --git a/vendor/setasign/fpdi/composer.json b/vendor/setasign/fpdi/composer.json deleted file mode 100644 index c0eb4df..0000000 --- a/vendor/setasign/fpdi/composer.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "setasign/fpdi", - "homepage": "https://www.setasign.com/fpdi", - "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.", - "type": "library", - "keywords": [ - "pdf", - "fpdi", - "fpdf" - ], - "license": "MIT", - "autoload": { - "psr-4": { - "setasign\\Fpdi\\": "src/" - } - }, - "require": { - "php": "^5.6 || ^7.0 || ^8.0", - "ext-zlib": "*" - }, - "conflict": { - "setasign/tfpdf": "<1.31" - }, - "authors": [ - { - "name": "Jan Slabon", - "email": "jan.slabon@setasign.com", - "homepage": "https://www.setasign.com" - }, - { - "name": "Maximilian Kresse", - "email": "maximilian.kresse@setasign.com", - "homepage": "https://www.setasign.com" - } - ], - "suggest": { - "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured." - }, - "require-dev": { - "phpunit/phpunit": "~5.7", - "setasign/fpdf": "~1.8.6", - "tecnickcom/tcpdf": "~6.2", - "setasign/tfpdf": "~1.33", - "squizlabs/php_codesniffer": "^3.5" - }, - "autoload-dev": { - "psr-4": { - "setasign\\Fpdi\\": "tests/" - } - } -} diff --git a/vendor/setasign/fpdi/src/FpdfTpl.php b/vendor/setasign/fpdi/src/FpdfTpl.php deleted file mode 100644 index 0f3a6fc..0000000 --- a/vendor/setasign/fpdi/src/FpdfTpl.php +++ /dev/null @@ -1,21 +0,0 @@ -currentTemplateId !== null) { - throw new \BadMethodCallException('The page format cannot be changed when writing to a template.'); - } - - if (!\in_array($orientation, ['P', 'L'], true)) { - throw new \InvalidArgumentException(\sprintf( - 'Invalid page orientation "%s"! Only "P" and "L" are allowed!', - $orientation - )); - } - - $size = $this->_getpagesize($size); - - if ( - $orientation != $this->CurOrientation - || $size[0] != $this->CurPageSize[0] - || $size[1] != $this->CurPageSize[1] - ) { - // New size or orientation - if ($orientation === 'P') { - $this->w = $size[0]; - $this->h = $size[1]; - } else { - $this->w = $size[1]; - $this->h = $size[0]; - } - $this->wPt = $this->w * $this->k; - $this->hPt = $this->h * $this->k; - $this->PageBreakTrigger = $this->h - $this->bMargin; - $this->CurOrientation = $orientation; - $this->CurPageSize = $size; - - $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt); - } - } - - /** - * Draws a template onto the page or another template. - * - * Give only one of the size parameters (width, height) to calculate the other one automatically in view to the - * aspect ratio. - * - * @param mixed $tpl The template id - * @param array|float|int $x The abscissa of upper-left corner. Alternatively you could use an assoc array - * with the keys "x", "y", "width", "height", "adjustPageSize". - * @param float|int $y The ordinate of upper-left corner. - * @param float|int|null $width The width. - * @param float|int|null $height The height. - * @param bool $adjustPageSize - * @return array The size - * @see FpdfTplTrait::getTemplateSize() - */ - public function useTemplate($tpl, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false) - { - if (!isset($this->templates[$tpl])) { - throw new \InvalidArgumentException('Template does not exist!'); - } - - if (\is_array($x)) { - unset($x['tpl']); - \extract($x, EXTR_IF_EXISTS); - /** @noinspection NotOptimalIfConditionsInspection */ - /** @noinspection PhpConditionAlreadyCheckedInspection */ - if (\is_array($x)) { - $x = 0; - } - } - - $template = $this->templates[$tpl]; - - $originalSize = $this->getTemplateSize($tpl); - $newSize = $this->getTemplateSize($tpl, $width, $height); - if ($adjustPageSize) { - $this->setPageFormat($newSize, $newSize['orientation']); - } - - $this->_out( - // reset standard values, translate and scale - \sprintf( - 'q 0 J 1 w 0 j 0 G 0 g %.4F 0 0 %.4F %.4F %.4F cm /%s Do Q', - ($newSize['width'] / $originalSize['width']), - ($newSize['height'] / $originalSize['height']), - $x * $this->k, - ($this->h - $y - $newSize['height']) * $this->k, - $template['id'] - ) - ); - - return $newSize; - } - - /** - * Get the size of a template. - * - * Give only one of the size parameters (width, height) to calculate the other one automatically in view to the - * aspect ratio. - * - * @param mixed $tpl The template id - * @param float|int|null $width The width. - * @param float|int|null $height The height. - * @return array|bool An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P) - */ - public function getTemplateSize($tpl, $width = null, $height = null) - { - if (!isset($this->templates[$tpl])) { - return false; - } - - if ($width === null && $height === null) { - $width = $this->templates[$tpl]['width']; - $height = $this->templates[$tpl]['height']; - } elseif ($width === null) { - $width = $height * $this->templates[$tpl]['width'] / $this->templates[$tpl]['height']; - } - - if ($height === null) { - $height = $width * $this->templates[$tpl]['height'] / $this->templates[$tpl]['width']; - } - - if ($height <= 0. || $width <= 0.) { - throw new \InvalidArgumentException('Width or height parameter needs to be larger than zero.'); - } - - return [ - 'width' => $width, - 'height' => $height, - 0 => $width, - 1 => $height, - 'orientation' => $width > $height ? 'L' : 'P' - ]; - } - - /** - * Begins a new template. - * - * @param float|int|null $width The width of the template. If null, the current page width is used. - * @param float|int|null $height The height of the template. If null, the current page height is used. - * @param bool $groupXObject Define the form XObject as a group XObject to support transparency (if used). - * @return int A template identifier. - */ - public function beginTemplate($width = null, $height = null, $groupXObject = false) - { - if ($width === null) { - $width = $this->w; - } - - if ($height === null) { - $height = $this->h; - } - - $templateId = $this->getNextTemplateId(); - - // initiate buffer with current state of FPDF - $buffer = "2 J\n" - . \sprintf('%.2F w', $this->LineWidth * $this->k) . "\n"; - - if ($this->FontFamily) { - $buffer .= \sprintf("BT /F%d %.2F Tf ET\n", $this->CurrentFont['i'], $this->FontSizePt); - } - - if ($this->DrawColor !== '0 G') { - $buffer .= $this->DrawColor . "\n"; - } - if ($this->FillColor !== '0 g') { - $buffer .= $this->FillColor . "\n"; - } - - if ($groupXObject && \version_compare('1.4', $this->PDFVersion, '>')) { - $this->PDFVersion = '1.4'; - } - - $this->templates[$templateId] = [ - 'objectNumber' => null, - 'id' => 'TPL' . $templateId, - 'buffer' => $buffer, - 'width' => $width, - 'height' => $height, - 'groupXObject' => $groupXObject, - 'state' => [ - 'x' => $this->x, - 'y' => $this->y, - 'AutoPageBreak' => $this->AutoPageBreak, - 'bMargin' => $this->bMargin, - 'tMargin' => $this->tMargin, - 'lMargin' => $this->lMargin, - 'rMargin' => $this->rMargin, - 'h' => $this->h, - 'hPt' => $this->hPt, - 'w' => $this->w, - 'wPt' => $this->wPt, - 'FontFamily' => $this->FontFamily, - 'FontStyle' => $this->FontStyle, - 'FontSizePt' => $this->FontSizePt, - 'FontSize' => $this->FontSize, - 'underline' => $this->underline, - 'TextColor' => $this->TextColor, - 'DrawColor' => $this->DrawColor, - 'FillColor' => $this->FillColor, - 'ColorFlag' => $this->ColorFlag - ] - ]; - - $this->SetAutoPageBreak(false); - $this->currentTemplateId = $templateId; - - $this->h = $height; - $this->hPt = $height / $this->k; - $this->w = $width; - $this->wPt = $width / $this->k; - - $this->SetXY($this->lMargin, $this->tMargin); - $this->SetRightMargin($this->w - $width + $this->rMargin); - - return $templateId; - } - - /** - * Ends a template. - * - * @return bool|int|null A template identifier. - */ - public function endTemplate() - { - if ($this->currentTemplateId === null) { - return false; - } - - $templateId = $this->currentTemplateId; - $template = $this->templates[$templateId]; - - $state = $template['state']; - $this->SetXY($state['x'], $state['y']); - $this->tMargin = $state['tMargin']; - $this->lMargin = $state['lMargin']; - $this->rMargin = $state['rMargin']; - $this->h = $state['h']; - $this->hPt = $state['hPt']; - $this->w = $state['w']; - $this->wPt = $state['wPt']; - $this->SetAutoPageBreak($state['AutoPageBreak'], $state['bMargin']); - - $this->FontFamily = $state['FontFamily']; - $this->FontStyle = $state['FontStyle']; - $this->FontSizePt = $state['FontSizePt']; - $this->FontSize = $state['FontSize']; - - $this->TextColor = $state['TextColor']; - $this->DrawColor = $state['DrawColor']; - $this->FillColor = $state['FillColor']; - $this->ColorFlag = $state['ColorFlag']; - - $this->underline = $state['underline']; - - $fontKey = $this->FontFamily . $this->FontStyle; - if ($fontKey) { - $this->CurrentFont =& $this->fonts[$fontKey]; - } else { - unset($this->CurrentFont); - } - - $this->currentTemplateId = null; - - return $templateId; - } - - /** - * Get the next template id. - * - * @return int - */ - protected function getNextTemplateId() - { - return $this->templateId++; - } - - /* overwritten FPDF methods: */ - - /** - * @inheritdoc - */ - public function AddPage($orientation = '', $size = '', $rotation = 0) - { - if ($this->currentTemplateId !== null) { - throw new \BadMethodCallException('Pages cannot be added when writing to a template.'); - } - parent::AddPage($orientation, $size, $rotation); - } - - /** - * @inheritdoc - */ - public function Link($x, $y, $w, $h, $link) - { - if ($this->currentTemplateId !== null) { - throw new \BadMethodCallException('Links cannot be set when writing to a template.'); - } - parent::Link($x, $y, $w, $h, $link); - } - - /** - * @inheritdoc - */ - public function SetLink($link, $y = 0, $page = -1) - { - if ($this->currentTemplateId !== null) { - throw new \BadMethodCallException('Links cannot be set when writing to a template.'); - } - return parent::SetLink($link, $y, $page); - } - - /** - * @inheritdoc - */ - public function SetDrawColor($r, $g = null, $b = null) - { - parent::SetDrawColor($r, $g, $b); - if ($this->page === 0 && $this->currentTemplateId !== null) { - $this->_out($this->DrawColor); - } - } - - /** - * @inheritdoc - */ - public function SetFillColor($r, $g = null, $b = null) - { - parent::SetFillColor($r, $g, $b); - if ($this->page === 0 && $this->currentTemplateId !== null) { - $this->_out($this->FillColor); - } - } - - /** - * @inheritdoc - */ - public function SetLineWidth($width) - { - parent::SetLineWidth($width); - if ($this->page === 0 && $this->currentTemplateId !== null) { - $this->_out(\sprintf('%.2F w', $width * $this->k)); - } - } - - /** - * @inheritdoc - */ - public function SetFont($family, $style = '', $size = 0) - { - parent::SetFont($family, $style, $size); - if ($this->page === 0 && $this->currentTemplateId !== null) { - $this->_out(\sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); - } - } - - /** - * @inheritdoc - */ - public function SetFontSize($size) - { - parent::SetFontSize($size); - if ($this->page === 0 && $this->currentTemplateId !== null) { - $this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt)); - } - } - - protected function _putimages() - { - parent::_putimages(); - - foreach ($this->templates as $key => $template) { - $this->_newobj(); - $this->templates[$key]['objectNumber'] = $this->n; - - $this->_put('<_put(\sprintf( - '/BBox[0 0 %.2F %.2F]', - $template['width'] * $this->k, - $template['height'] * $this->k - )); - $this->_put('/Resources 2 0 R'); // default resources dictionary of FPDF - - if ($this->compress) { - $buffer = \gzcompress($template['buffer']); - $this->_put('/Filter/FlateDecode'); - } else { - $buffer = $template['buffer']; - } - - $this->_put('/Length ' . \strlen($buffer)); - - if ($template['groupXObject']) { - $this->_put('/Group <>'); - } - - $this->_put('>>'); - $this->_putstream($buffer); - $this->_put('endobj'); - } - } - - /** - * @inheritdoc - */ - protected function _putxobjectdict() - { - foreach ($this->templates as $key => $template) { - $this->_put('/' . $template['id'] . ' ' . $template['objectNumber'] . ' 0 R'); - } - - parent::_putxobjectdict(); - } - - /** - * @inheritdoc - */ - public function _out($s) - { - if ($this->currentTemplateId !== null) { - $this->templates[$this->currentTemplateId]['buffer'] .= $s . "\n"; - } else { - parent::_out($s); - } - } -} diff --git a/vendor/setasign/fpdi/src/FpdfTrait.php b/vendor/setasign/fpdi/src/FpdfTrait.php deleted file mode 100644 index 67fa561..0000000 --- a/vendor/setasign/fpdi/src/FpdfTrait.php +++ /dev/null @@ -1,192 +0,0 @@ -cleanUp(); - } - - /** - * Draws an imported page or a template onto the page or another template. - * - * Give only one of the size parameters (width, height) to calculate the other one automatically in view to the - * aspect ratio. - * - * @param mixed $tpl The template id - * @param float|int|array $x The abscissa of upper-left corner. Alternatively you could use an assoc array - * with the keys "x", "y", "width", "height", "adjustPageSize". - * @param float|int $y The ordinate of upper-left corner. - * @param float|int|null $width The width. - * @param float|int|null $height The height. - * @param bool $adjustPageSize - * @return array The size - * @see Fpdi::getTemplateSize() - */ - public function useTemplate($tpl, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false) - { - if (isset($this->importedPages[$tpl])) { - $size = $this->useImportedPage($tpl, $x, $y, $width, $height, $adjustPageSize); - if ($this->currentTemplateId !== null) { - $this->templates[$this->currentTemplateId]['resources']['templates']['importedPages'][$tpl] = $tpl; - } - return $size; - } - - return parent::useTemplate($tpl, $x, $y, $width, $height, $adjustPageSize); - } - - /** - * Get the size of an imported page or template. - * - * Give only one of the size parameters (width, height) to calculate the other one automatically in view to the - * aspect ratio. - * - * @param mixed $tpl The template id - * @param float|int|null $width The width. - * @param float|int|null $height The height. - * @return array|bool An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P) - */ - public function getTemplateSize($tpl, $width = null, $height = null) - { - $size = parent::getTemplateSize($tpl, $width, $height); - if ($size === false) { - return $this->getImportedPageSize($tpl, $width, $height); - } - - return $size; - } - - /** - * @throws CrossReferenceException - * @throws PdfParserException - */ - protected function _putimages() - { - $this->currentReaderId = null; - parent::_putimages(); - - foreach ($this->importedPages as $key => $pageData) { - $this->_newobj(); - $this->importedPages[$key]['objectNumber'] = $this->n; - $this->currentReaderId = $pageData['readerId']; - $this->writePdfType($pageData['stream']); - $this->_put('endobj'); - } - - foreach (\array_keys($this->readers) as $readerId) { - $parser = $this->getPdfReader($readerId)->getParser(); - $this->currentReaderId = $readerId; - - while (($objectNumber = \array_pop($this->objectsToCopy[$readerId])) !== null) { - try { - $object = $parser->getIndirectObject($objectNumber); - } catch (CrossReferenceException $e) { - if ($e->getCode() === CrossReferenceException::OBJECT_NOT_FOUND) { - $object = PdfIndirectObject::create($objectNumber, 0, new PdfNull()); - } else { - throw $e; - } - } - - $this->writePdfType($object); - } - } - - $this->currentReaderId = null; - } - - /** - * @inheritdoc - */ - protected function _putxobjectdict() - { - foreach ($this->importedPages as $pageData) { - $this->_put('/' . $pageData['id'] . ' ' . $pageData['objectNumber'] . ' 0 R'); - } - - parent::_putxobjectdict(); - } - - /** - * @param int $n - * @return void - * @throws PdfParser\Type\PdfTypeException - */ - protected function _putlinks($n) - { - foreach ($this->PageLinks[$n] as $pl) { - $this->_newobj(); - $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]); - $this->_put('<_put('/A <_textstring($pl[4]) . '>>'); - if (isset($pl['importedLink'])) { - $values = $pl['importedLink']['pdfObject']->value; - - foreach ($values as $name => $entry) { - $this->_put('/' . $name . ' ', false); - $this->writePdfType($entry); - } - - if (isset($pl['quadPoints'])) { - $s = '/QuadPoints['; - foreach ($pl['quadPoints'] as $value) { - $s .= sprintf('%.2F ', $value); - } - $s .= ']'; - $this->_put($s); - } - } else { - $this->_put('/Border [0 0 0]', false); - } - $this->_put('>>'); - } else { - $this->_put('/Border [0 0 0] ', false); - $l = $this->links[$pl[4]]; - if (isset($this->PageInfo[$l[0]]['size'])) { - $h = $this->PageInfo[$l[0]]['size'][1]; - } else { - $h = ($this->DefOrientation === 'P') - ? $this->DefPageSize[1] * $this->k - : $this->DefPageSize[0] * $this->k; - } - $this->_put(sprintf( - '/Dest [%d 0 R /XYZ 0 %.2F null]>>', - $this->PageInfo[$l[0]]['n'], - $h - $l[1] * $this->k - )); - } - $this->_put('endobj'); - } - } - - protected function _put($s, $newLine = true) - { - if ($newLine) { - $this->buffer .= $s . "\n"; - } else { - $this->buffer .= $s; - } - } -} diff --git a/vendor/setasign/fpdi/src/Fpdi.php b/vendor/setasign/fpdi/src/Fpdi.php deleted file mode 100644 index fd158a6..0000000 --- a/vendor/setasign/fpdi/src/Fpdi.php +++ /dev/null @@ -1,34 +0,0 @@ -readers) : $this->createdReaders; - foreach ($readers as $id) { - $this->readers[$id]->getParser()->getStreamReader()->cleanUp(); - unset($this->readers[$id]); - } - - $this->createdReaders = []; - } - - /** - * Set the minimal PDF version. - * - * @param string $pdfVersion - */ - protected function setMinPdfVersion($pdfVersion) - { - if (\version_compare($pdfVersion, $this->PDFVersion, '>')) { - $this->PDFVersion = $pdfVersion; - } - } - - /** @noinspection PhpUndefinedClassInspection */ - /** - * Get a new pdf parser instance. - * - * @param StreamReader $streamReader - * @param array $parserParams Individual parameters passed to the parser instance. - * @return PdfParser|FpdiPdfParser - */ - protected function getPdfParserInstance(StreamReader $streamReader, array $parserParams = []) - { - // note: if you get an exception here - turn off errors/warnings on not found classes for your autoloader. - // psr-4 (https://www.php-fig.org/psr/psr-4/) says: Autoloader implementations MUST NOT throw - // exceptions, MUST NOT raise errors of any level, and SHOULD NOT return a value. - /** @noinspection PhpUndefinedClassInspection */ - if (\class_exists(FpdiPdfParser::class)) { - /** @noinspection PhpUndefinedClassInspection */ - return new FpdiPdfParser($streamReader, $parserParams); - } - - return new PdfParser($streamReader); - } - - /** - * Get an unique reader id by the $file parameter. - * - * @param string|resource|PdfReader|StreamReader $file An open file descriptor, a path to a file, a PdfReader - * instance or a StreamReader instance. - * @param array $parserParams Individual parameters passed to the parser instance. - * @return string - */ - protected function getPdfReaderId($file, array $parserParams = []) - { - if (\is_resource($file)) { - $id = (string) $file; - } elseif (\is_string($file)) { - $id = \realpath($file); - if ($id === false) { - $id = $file; - } - } elseif (\is_object($file)) { - $id = \spl_object_hash($file); - } else { - throw new \InvalidArgumentException( - \sprintf('Invalid type in $file parameter (%s)', \gettype($file)) - ); - } - - /** @noinspection OffsetOperationsInspection */ - if (isset($this->readers[$id])) { - return $id; - } - - if (\is_resource($file)) { - $streamReader = new StreamReader($file); - } elseif (\is_string($file)) { - $streamReader = StreamReader::createByFile($file); - $this->createdReaders[] = $id; - } else { - $streamReader = $file; - } - - $reader = new PdfReader($this->getPdfParserInstance($streamReader, $parserParams)); - /** @noinspection OffsetOperationsInspection */ - $this->readers[$id] = $reader; - - return $id; - } - - /** - * Get a pdf reader instance by its id. - * - * @param string $id - * @return PdfReader - */ - protected function getPdfReader($id) - { - if (isset($this->readers[$id])) { - return $this->readers[$id]; - } - - throw new \InvalidArgumentException( - \sprintf('No pdf reader with the given id (%s) exists.', $id) - ); - } - - /** - * Set the source PDF file. - * - * @param string|resource|StreamReader $file Path to the file or a stream resource or a StreamReader instance. - * @return int The page count of the PDF document. - * @throws PdfParserException - */ - public function setSourceFile($file) - { - return $this->setSourceFileWithParserParams($file); - } - - /** - * Set the source PDF file with parameters which are passed to the parser instance. - * - * This method allows us to pass e.g. authentication information to the parser instance. - * - * @param string|resource|StreamReader $file Path to the file or a stream resource or a StreamReader instance. - * @param array $parserParams Individual parameters passed to the parser instance. - * @return int The page count of the PDF document. - * @throws CrossReferenceException - * @throws PdfParserException - * @throws PdfTypeException - */ - public function setSourceFileWithParserParams($file, array $parserParams = []) - { - $this->currentReaderId = $this->getPdfReaderId($file, $parserParams); - $this->objectsToCopy[$this->currentReaderId] = []; - - $reader = $this->getPdfReader($this->currentReaderId); - $this->setMinPdfVersion($reader->getPdfVersion()); - - return $reader->getPageCount(); - } - - /** - * Imports a page. - * - * @param int $pageNumber The page number. - * @param string $box The page boundary to import. Default set to PageBoundaries::CROP_BOX. - * @param bool $groupXObject Define the form XObject as a group XObject to support transparency (if used). - * @param bool $importExternalLinks Define whether external links are imported or not. - * @return string A unique string identifying the imported page. - * @throws CrossReferenceException - * @throws FilterException - * @throws PdfParserException - * @throws PdfTypeException - * @throws PdfReaderException - * @see PageBoundaries - */ - public function importPage( - $pageNumber, - $box = PageBoundaries::CROP_BOX, - $groupXObject = true, - $importExternalLinks = false - ) { - if ($this->currentReaderId === null) { - throw new \BadMethodCallException('No reader initiated. Call setSourceFile() first.'); - } - - $pageId = $this->currentReaderId; - - $pageNumber = (int)$pageNumber; - $pageId .= '|' . $pageNumber . '|' . ($groupXObject ? '1' : '0') . '|' . ($importExternalLinks ? '1' : '0'); - - // for backwards compatibility with FPDI 1 - $box = \ltrim($box, '/'); - if (!PageBoundaries::isValidName($box)) { - throw new \InvalidArgumentException( - \sprintf('Box name is invalid: "%s"', $box) - ); - } - - $pageId .= '|' . $box; - - if (isset($this->importedPages[$pageId])) { - return $pageId; - } - - $reader = $this->getPdfReader($this->currentReaderId); - $page = $reader->getPage($pageNumber); - - $bbox = $page->getBoundary($box); - if ($bbox === false) { - throw new PdfReaderException( - \sprintf("Page doesn't have a boundary box (%s).", $box), - PdfReaderException::MISSING_DATA - ); - } - - $dict = new PdfDictionary(); - $dict->value['Type'] = PdfName::create('XObject'); - $dict->value['Subtype'] = PdfName::create('Form'); - $dict->value['FormType'] = PdfNumeric::create(1); - $dict->value['BBox'] = $bbox->toPdfArray(); - - if ($groupXObject) { - $this->setMinPdfVersion('1.4'); - $dict->value['Group'] = PdfDictionary::create([ - 'Type' => PdfName::create('Group'), - 'S' => PdfName::create('Transparency') - ]); - } - - $resources = $page->getAttribute('Resources'); - if ($resources !== null) { - $dict->value['Resources'] = $resources; - } - - list($width, $height) = $page->getWidthAndHeight($box); - - $a = 1; - $b = 0; - $c = 0; - $d = 1; - $e = -$bbox->getLlx(); - $f = -$bbox->getLly(); - - $rotation = $page->getRotation(); - - if ($rotation !== 0) { - $rotation *= -1; - $angle = $rotation * M_PI / 180; - $a = \cos($angle); - $b = \sin($angle); - $c = -$b; - $d = $a; - - switch ($rotation) { - case -90: - $e = -$bbox->getLly(); - $f = $bbox->getUrx(); - break; - case -180: - $e = $bbox->getUrx(); - $f = $bbox->getUry(); - break; - case -270: - $e = $bbox->getUry(); - $f = -$bbox->getLlx(); - break; - } - } - - // we need to rotate/translate - if ($a != 1 || $b != 0 || $c != 0 || $d != 1 || $e != 0 || $f != 0) { - $dict->value['Matrix'] = PdfArray::create([ - PdfNumeric::create($a), PdfNumeric::create($b), PdfNumeric::create($c), - PdfNumeric::create($d), PdfNumeric::create($e), PdfNumeric::create($f) - ]); - } - - // try to use the existing content stream - $pageDict = $page->getPageDictionary(); - - try { - $contentsObject = PdfType::resolve(PdfDictionary::get($pageDict, 'Contents'), $reader->getParser(), true); - $contents = PdfType::resolve($contentsObject, $reader->getParser()); - - // just copy the stream reference if it is only a single stream - if ( - ($contentsIsStream = ($contents instanceof PdfStream)) - || ($contents instanceof PdfArray && \count($contents->value) === 1) - ) { - if ($contentsIsStream) { - /** - * @var PdfIndirectObject $contentsObject - */ - $stream = $contents; - } else { - $stream = PdfType::resolve($contents->value[0], $reader->getParser()); - } - - $filter = PdfDictionary::get($stream->value, 'Filter'); - if (!$filter instanceof PdfNull) { - $dict->value['Filter'] = $filter; - } - $length = PdfType::resolve(PdfDictionary::get($stream->value, 'Length'), $reader->getParser()); - $dict->value['Length'] = $length; - $stream->value = $dict; - // otherwise extract it from the array and re-compress the whole stream - } else { - $streamContent = $this->compress - ? \gzcompress($page->getContentStream()) - : $page->getContentStream(); - - $dict->value['Length'] = PdfNumeric::create(\strlen($streamContent)); - if ($this->compress) { - $dict->value['Filter'] = PdfName::create('FlateDecode'); - } - - $stream = PdfStream::create($dict, $streamContent); - } - // Catch faulty pages and use an empty content stream - } catch (FpdiException $e) { - $dict->value['Length'] = PdfNumeric::create(0); - $stream = PdfStream::create($dict, ''); - } - - $externalLinks = []; - if ($importExternalLinks) { - $externalLinks = $page->getExternalLinks($box); - } - - $this->importedPages[$pageId] = [ - 'objectNumber' => null, - 'readerId' => $this->currentReaderId, - 'id' => 'TPL' . $this->getNextTemplateId(), - 'width' => $width / $this->k, - 'height' => $height / $this->k, - 'stream' => $stream, - 'externalLinks' => $externalLinks - ]; - - return $pageId; - } - - /** - * Draws an imported page onto the page. - * - * Give only one of the size parameters (width, height) to calculate the other one automatically in view to the - * aspect ratio. - * - * @param mixed $pageId The page id - * @param float|int|array $x The abscissa of upper-left corner. Alternatively you could use an assoc array - * with the keys "x", "y", "width", "height", "adjustPageSize". - * @param float|int $y The ordinate of upper-left corner. - * @param float|int|null $width The width. - * @param float|int|null $height The height. - * @param bool $adjustPageSize - * @return array The size. - * @see Fpdi::getTemplateSize() - */ - public function useImportedPage($pageId, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false) - { - if (\is_array($x)) { - /** @noinspection OffsetOperationsInspection */ - unset($x['pageId']); - \extract($x, EXTR_IF_EXISTS); - /** @noinspection NotOptimalIfConditionsInspection */ - if (\is_array($x)) { - $x = 0; - } - } - - if (!isset($this->importedPages[$pageId])) { - throw new \InvalidArgumentException('Imported page does not exist!'); - } - - $importedPage = $this->importedPages[$pageId]; - - $originalSize = $this->getTemplateSize($pageId); - $newSize = $this->getTemplateSize($pageId, $width, $height); - if ($adjustPageSize) { - $this->setPageFormat($newSize, $newSize['orientation']); - } - - $scaleX = ($newSize['width'] / $originalSize['width']); - $scaleY = ($newSize['height'] / $originalSize['height']); - $xPt = $x * $this->k; - $yPt = $y * $this->k; - $newHeightPt = $newSize['height'] * $this->k; - - $this->_out( - // reset standard values, translate and scale - \sprintf( - 'q 0 J 1 w 0 j 0 G 0 g %.4F 0 0 %.4F %.4F %.4F cm /%s Do Q', - $scaleX, - $scaleY, - $xPt, - $this->hPt - $yPt - $newHeightPt, - $importedPage['id'] - ) - ); - - if (count($importedPage['externalLinks']) > 0) { - foreach ($importedPage['externalLinks'] as $externalLink) { - // mPDF uses also 'externalLinks' but doesn't come with a rect-value - if (!isset($externalLink['rect'])) { - continue; - } - - /** @var Rectangle $rect */ - $rect = $externalLink['rect']; - $this->Link( - $x + $rect->getLlx() / $this->k * $scaleX, - $y + $newSize['height'] - ($rect->getLly() + $rect->getHeight()) / $this->k * $scaleY, - $rect->getWidth() / $this->k * $scaleX, - $rect->getHeight() / $this->k * $scaleY, - $externalLink['uri'] - ); - - $this->adjustLastLink($externalLink, $xPt, $scaleX, $yPt, $newHeightPt, $scaleY, $importedPage); - } - } - - return $newSize; - } - - /** - * This method will add additional data to the last created link/annotation. - * - * It is separated because TCPDF uses its own logic to handle link annotations. - * This method is overwritten in the TCPDF implementation. - * - * @param array $externalLink - * @param float|int $xPt - * @param float|int $scaleX - * @param float|int $yPt - * @param float|int $newHeightPt - * @param float|int $scaleY - * @param array $importedPage - * @return void - */ - protected function adjustLastLink($externalLink, $xPt, $scaleX, $yPt, $newHeightPt, $scaleY, $importedPage) - { - // let's create a relation of the newly created link to the data of the external link - $lastLink = count($this->PageLinks[$this->page]); - $this->PageLinks[$this->page][$lastLink - 1]['importedLink'] = $externalLink; - if (count($externalLink['quadPoints']) > 0) { - $quadPoints = []; - for ($i = 0, $n = count($externalLink['quadPoints']); $i < $n; $i += 2) { - $quadPoints[] = $xPt + $externalLink['quadPoints'][$i] * $scaleX; - $quadPoints[] = $this->hPt - $yPt - $newHeightPt + $externalLink['quadPoints'][$i + 1] * $scaleY; - } - - $this->PageLinks[$this->page][$lastLink - 1]['quadPoints'] = $quadPoints; - } - } - - /** - * Get the size of an imported page. - * - * Give only one of the size parameters (width, height) to calculate the other one automatically in view to the - * aspect ratio. - * - * @param mixed $tpl The template id - * @param float|int|null $width The width. - * @param float|int|null $height The height. - * @return array|bool An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P) - */ - public function getImportedPageSize($tpl, $width = null, $height = null) - { - if (isset($this->importedPages[$tpl])) { - $importedPage = $this->importedPages[$tpl]; - - if ($width === null && $height === null) { - $width = $importedPage['width']; - $height = $importedPage['height']; - } elseif ($width === null) { - $width = $height * $importedPage['width'] / $importedPage['height']; - } - - if ($height === null) { - $height = $width * $importedPage['height'] / $importedPage['width']; - } - - if ($height <= 0. || $width <= 0.) { - throw new \InvalidArgumentException('Width or height parameter needs to be larger than zero.'); - } - - return [ - 'width' => $width, - 'height' => $height, - 0 => $width, - 1 => $height, - 'orientation' => $width > $height ? 'L' : 'P' - ]; - } - - return false; - } - - /** - * Writes a PdfType object to the resulting buffer. - * - * @param PdfType $value - * @throws PdfTypeException - */ - protected function writePdfType(PdfType $value) - { - if ($value instanceof PdfNumeric) { - if (\is_int($value->value)) { - $this->_put($value->value . ' ', false); - } else { - $this->_put(\rtrim(\rtrim(\sprintf('%.5F', $value->value), '0'), '.') . ' ', false); - } - } elseif ($value instanceof PdfName) { - $this->_put('/' . $value->value . ' ', false); - } elseif ($value instanceof PdfString) { - $this->_put('(' . $value->value . ')', false); - } elseif ($value instanceof PdfHexString) { - $this->_put('<' . $value->value . '>', false); - } elseif ($value instanceof PdfBoolean) { - $this->_put($value->value ? 'true ' : 'false ', false); - } elseif ($value instanceof PdfArray) { - $this->_put('[', false); - foreach ($value->value as $entry) { - $this->writePdfType($entry); - } - $this->_put(']'); - } elseif ($value instanceof PdfDictionary) { - $this->_put('<<', false); - foreach ($value->value as $name => $entry) { - $this->_put('/' . $name . ' ', false); - $this->writePdfType($entry); - } - $this->_put('>>'); - } elseif ($value instanceof PdfToken) { - $this->_put($value->value); - } elseif ($value instanceof PdfNull) { - $this->_put('null ', false); - } elseif ($value instanceof PdfStream) { - $this->writePdfType($value->value); - $this->_put('stream'); - $this->_put($value->getStream()); - $this->_put('endstream'); - } elseif ($value instanceof PdfIndirectObjectReference) { - if (!isset($this->objectMap[$this->currentReaderId])) { - $this->objectMap[$this->currentReaderId] = []; - } - - if (!isset($this->objectMap[$this->currentReaderId][$value->value])) { - $this->objectMap[$this->currentReaderId][$value->value] = ++$this->n; - $this->objectsToCopy[$this->currentReaderId][] = $value->value; - } - - $this->_put($this->objectMap[$this->currentReaderId][$value->value] . ' 0 R ', false); - } elseif ($value instanceof PdfIndirectObject) { - $n = $this->objectMap[$this->currentReaderId][$value->objectNumber]; - $this->_newobj($n); - $this->writePdfType($value->value); - - // add newline before "endobj" for all objects in view to PDF/A conformance - if ( - !( - ($value->value instanceof PdfArray) || - ($value->value instanceof PdfDictionary) || - ($value->value instanceof PdfToken) || - ($value->value instanceof PdfStream) - ) - ) { - $this->_put("\n", false); - } - - $this->_put('endobj'); - } - } -} diff --git a/vendor/setasign/fpdi/src/GraphicsState.php b/vendor/setasign/fpdi/src/GraphicsState.php deleted file mode 100644 index 27feafb..0000000 --- a/vendor/setasign/fpdi/src/GraphicsState.php +++ /dev/null @@ -1,97 +0,0 @@ -ctm = $ctm; - } - - /** - * @param Matrix $matrix - * @return $this - */ - public function add(Matrix $matrix) - { - $this->ctm = $matrix->multiply($this->ctm); - return $this; - } - - /** - * @param int|float $x - * @param int|float $y - * @param int|float $angle - * @return $this - */ - public function rotate($x, $y, $angle) - { - if (abs($angle) < 1e-5) { - return $this; - } - - $angle = deg2rad($angle); - $c = cos($angle); - $s = sin($angle); - - $this->add(new Matrix($c, $s, -$s, $c, $x, $y)); - - return $this->translate(-$x, -$y); - } - - /** - * @param int|float $shiftX - * @param int|float $shiftY - * @return $this - */ - public function translate($shiftX, $shiftY) - { - return $this->add(new Matrix(1, 0, 0, 1, $shiftX, $shiftY)); - } - - /** - * @param int|float $scaleX - * @param int|float $scaleY - * @return $this - */ - public function scale($scaleX, $scaleY) - { - return $this->add(new Matrix($scaleX, 0, 0, $scaleY, 0, 0)); - } - - /** - * @param Vector $vector - * @return Vector - */ - public function toUserSpace(Vector $vector) - { - return $vector->multiplyWithMatrix($this->ctm); - } -} diff --git a/vendor/setasign/fpdi/src/Math/Matrix.php b/vendor/setasign/fpdi/src/Math/Matrix.php deleted file mode 100644 index 662a5a2..0000000 --- a/vendor/setasign/fpdi/src/Math/Matrix.php +++ /dev/null @@ -1,116 +0,0 @@ -a = (float)$a; - $this->b = (float)$b; - $this->c = (float)$c; - $this->d = (float)$d; - $this->e = (float)$e; - $this->f = (float)$f; - } - - /** - * @return float[] - */ - public function getValues() - { - return [$this->a, $this->b, $this->c, $this->d, $this->e, $this->f]; - } - - /** - * @param Matrix $by - * @return Matrix - */ - public function multiply(self $by) - { - $a = - $this->a * $by->a - + $this->b * $by->c - //+ 0 * $by->e - ; - - $b = - $this->a * $by->b - + $this->b * $by->d - //+ 0 * $by->f - ; - - $c = - $this->c * $by->a - + $this->d * $by->c - //+ 0 * $by->e - ; - - $d = - $this->c * $by->b - + $this->d * $by->d - //+ 0 * $by->f - ; - - $e = - $this->e * $by->a - + $this->f * $by->c - + /*1 * */$by->e; - - $f = - $this->e * $by->b - + $this->f * $by->d - + /*1 * */$by->f; - - return new self($a, $b, $c, $d, $e, $f); - } -} diff --git a/vendor/setasign/fpdi/src/Math/Vector.php b/vendor/setasign/fpdi/src/Math/Vector.php deleted file mode 100644 index df782d4..0000000 --- a/vendor/setasign/fpdi/src/Math/Vector.php +++ /dev/null @@ -1,66 +0,0 @@ -x = (float)$x; - $this->y = (float)$y; - } - - /** - * @return float - */ - public function getX() - { - return $this->x; - } - - /** - * @return float - */ - public function getY() - { - return $this->y; - } - - /** - * @param Matrix $matrix - * @return Vector - */ - public function multiplyWithMatrix(Matrix $matrix) - { - list($a, $b, $c, $d, $e, $f) = $matrix->getValues(); - $x = $a * $this->x + $c * $this->y + $e; - $y = $b * $this->x + $d * $this->y + $f; - - return new self($x, $y); - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/AbstractReader.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/AbstractReader.php deleted file mode 100644 index bcf21d6..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/AbstractReader.php +++ /dev/null @@ -1,95 +0,0 @@ -parser = $parser; - $this->readTrailer(); - } - - /** - * Get the trailer dictionary. - * - * @return PdfDictionary - */ - public function getTrailer() - { - return $this->trailer; - } - - /** - * Read the trailer dictionary. - * - * @throws CrossReferenceException - * @throws PdfTypeException - */ - protected function readTrailer() - { - try { - $trailerKeyword = $this->parser->readValue(null, PdfToken::class); - if ($trailerKeyword->value !== 'trailer') { - throw new CrossReferenceException( - \sprintf( - 'Unexpected end of cross reference. "trailer"-keyword expected, got: %s.', - $trailerKeyword->value - ), - CrossReferenceException::UNEXPECTED_END - ); - } - } catch (PdfTypeException $e) { - throw new CrossReferenceException( - 'Unexpected end of cross reference. "trailer"-keyword expected, got an invalid object type.', - CrossReferenceException::UNEXPECTED_END, - $e - ); - } - - try { - $trailer = $this->parser->readValue(null, PdfDictionary::class); - } catch (PdfTypeException $e) { - throw new CrossReferenceException( - 'Unexpected end of cross reference. Trailer not found.', - CrossReferenceException::UNEXPECTED_END, - $e - ); - } - - $this->trailer = $trailer; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php deleted file mode 100644 index 7fa146d..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php +++ /dev/null @@ -1,326 +0,0 @@ -parser = $parser; - $this->fileHeaderOffset = $fileHeaderOffset; - - $offset = $this->findStartXref(); - $reader = null; - /** @noinspection TypeUnsafeComparisonInspection */ - while ($offset != false) { // By doing an unsafe comparsion we ignore faulty references to byte offset 0 - try { - $reader = $this->readXref($offset + $this->fileHeaderOffset); - } catch (CrossReferenceException $e) { - // sometimes the file header offset is part of the byte offsets, so let's retry by resetting it to zero. - if ($e->getCode() === CrossReferenceException::INVALID_DATA && $this->fileHeaderOffset !== 0) { - $this->fileHeaderOffset = 0; - $reader = $this->readXref($offset); - } else { - throw $e; - } - } - - $trailer = $reader->getTrailer(); - $this->checkForEncryption($trailer); - $this->readers[] = $reader; - - if (isset($trailer->value['Prev'])) { - $offset = $trailer->value['Prev']->value; - } else { - $offset = false; - } - } - - // fix faulty sub-section header - if ($reader instanceof FixedReader) { - /** - * @var FixedReader $reader - */ - $reader->fixFaultySubSectionShift(); - } - - if ($reader === null) { - throw new CrossReferenceException('No cross-reference found.', CrossReferenceException::NO_XREF_FOUND); - } - } - - /** - * Get the size of the cross reference. - * - * @return integer - */ - public function getSize() - { - return $this->getTrailer()->value['Size']->value; - } - - /** - * Get the trailer dictionary. - * - * @return PdfDictionary - */ - public function getTrailer() - { - return $this->readers[0]->getTrailer(); - } - - /** - * Get the cross reference readser instances. - * - * @return ReaderInterface[] - */ - public function getReaders() - { - return $this->readers; - } - - /** - * Get the offset by an object number. - * - * @param int $objectNumber - * @return integer|bool - */ - public function getOffsetFor($objectNumber) - { - foreach ($this->getReaders() as $reader) { - $offset = $reader->getOffsetFor($objectNumber); - if ($offset !== false) { - return $offset; - } - } - - return false; - } - - /** - * Get an indirect object by its object number. - * - * @param int $objectNumber - * @return PdfIndirectObject - * @throws CrossReferenceException - */ - public function getIndirectObject($objectNumber) - { - $offset = $this->getOffsetFor($objectNumber); - if ($offset === false) { - throw new CrossReferenceException( - \sprintf('Object (id:%s) not found.', $objectNumber), - CrossReferenceException::OBJECT_NOT_FOUND - ); - } - - $parser = $this->parser; - - $parser->getTokenizer()->clearStack(); - $parser->getStreamReader()->reset($offset + $this->fileHeaderOffset); - - try { - /** @var PdfIndirectObject $object */ - $object = $parser->readValue(null, PdfIndirectObject::class); - } catch (PdfTypeException $e) { - throw new CrossReferenceException( - \sprintf('Object (id:%s) not found at location (%s).', $objectNumber, $offset), - CrossReferenceException::OBJECT_NOT_FOUND, - $e - ); - } - - if ($object->objectNumber !== $objectNumber) { - throw new CrossReferenceException( - \sprintf('Wrong object found, got %s while %s was expected.', $object->objectNumber, $objectNumber), - CrossReferenceException::OBJECT_NOT_FOUND - ); - } - - return $object; - } - - /** - * Read the cross-reference table at a given offset. - * - * Internally the method will try to evaluate the best reader for this cross-reference. - * - * @param int $offset - * @return ReaderInterface - * @throws CrossReferenceException - * @throws PdfTypeException - */ - protected function readXref($offset) - { - $this->parser->getStreamReader()->reset($offset); - $this->parser->getTokenizer()->clearStack(); - $initValue = $this->parser->readValue(); - - return $this->initReaderInstance($initValue); - } - - /** - * Get a cross-reference reader instance. - * - * @param PdfToken|PdfIndirectObject $initValue - * @return ReaderInterface|bool - * @throws CrossReferenceException - * @throws PdfTypeException - */ - protected function initReaderInstance($initValue) - { - $position = $this->parser->getStreamReader()->getPosition() - + $this->parser->getStreamReader()->getOffset() + $this->fileHeaderOffset; - - if ($initValue instanceof PdfToken && $initValue->value === 'xref') { - try { - return new FixedReader($this->parser); - } catch (CrossReferenceException $e) { - $this->parser->getStreamReader()->reset($position); - $this->parser->getTokenizer()->clearStack(); - - return new LineReader($this->parser); - } - } - - if ($initValue instanceof PdfIndirectObject) { - try { - $stream = PdfStream::ensure($initValue->value); - } catch (PdfTypeException $e) { - throw new CrossReferenceException( - 'Invalid object type at xref reference offset.', - CrossReferenceException::INVALID_DATA, - $e - ); - } - - $type = PdfDictionary::get($stream->value, 'Type'); - if ($type->value !== 'XRef') { - throw new CrossReferenceException( - 'The xref position points to an incorrect object type.', - CrossReferenceException::INVALID_DATA - ); - } - - $this->checkForEncryption($stream->value); - - throw new CrossReferenceException( - 'This PDF document probably uses a compression technique which is not supported by the ' . - 'free parser shipped with FPDI. (See https://www.setasign.com/fpdi-pdf-parser for more details)', - CrossReferenceException::COMPRESSED_XREF - ); - } - - throw new CrossReferenceException( - 'The xref position points to an incorrect object type.', - CrossReferenceException::INVALID_DATA - ); - } - - /** - * Check for encryption. - * - * @param PdfDictionary $dictionary - * @throws CrossReferenceException - */ - protected function checkForEncryption(PdfDictionary $dictionary) - { - if (isset($dictionary->value['Encrypt'])) { - throw new CrossReferenceException( - 'This PDF document is encrypted and cannot be processed with FPDI.', - CrossReferenceException::ENCRYPTED - ); - } - } - - /** - * Find the start position for the first cross-reference. - * - * @return int The byte-offset position of the first cross-reference. - * @throws CrossReferenceException - */ - protected function findStartXref() - { - $reader = $this->parser->getStreamReader(); - $reader->reset(-self::$trailerSearchLength, self::$trailerSearchLength); - - $buffer = $reader->getBuffer(false); - $pos = \strrpos($buffer, 'startxref'); - $addOffset = 9; - if ($pos === false) { - // Some corrupted documents uses startref, instead of startxref - $pos = \strrpos($buffer, 'startref'); - if ($pos === false) { - throw new CrossReferenceException( - 'Unable to find pointer to xref table', - CrossReferenceException::NO_STARTXREF_FOUND - ); - } - $addOffset = 8; - } - - $reader->setOffset($pos + $addOffset); - - try { - $value = $this->parser->readValue(null, PdfNumeric::class); - } catch (PdfTypeException $e) { - throw new CrossReferenceException( - 'Invalid data after startxref keyword.', - CrossReferenceException::INVALID_DATA, - $e - ); - } - - return $value->value; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php deleted file mode 100644 index 8a1a589..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php +++ /dev/null @@ -1,79 +0,0 @@ -reader = $parser->getStreamReader(); - $this->read(); - parent::__construct($parser); - } - - /** - * Get all subsection data. - * - * @return array - */ - public function getSubSections() - { - return $this->subSections; - } - - /** - * @inheritdoc - * @return int|false - */ - public function getOffsetFor($objectNumber) - { - foreach ($this->subSections as $offset => list($startObject, $objectCount)) { - /** - * @var int $startObject - * @var int $objectCount - */ - if ($objectNumber >= $startObject && $objectNumber < ($startObject + $objectCount)) { - $position = $offset + 20 * ($objectNumber - $startObject); - $this->reader->ensure($position, 20); - $line = $this->reader->readBytes(20); - if ($line[17] === 'f') { - return false; - } - - return (int) \substr($line, 0, 10); - } - } - - return false; - } - - /** - * Read the cross-reference. - * - * This reader will only read the subsections in this method. The offsets were resolved individually by this - * information. - * - * @throws CrossReferenceException - */ - protected function read() - { - $subSections = []; - - $startObject = $entryCount = $lastLineStart = null; - $validityChecked = false; - while (($line = $this->reader->readLine(20)) !== false) { - if (\strpos($line, 'trailer') !== false) { - $this->reader->reset($lastLineStart); - break; - } - - // jump over if line content doesn't match the expected string - if (\sscanf($line, '%d %d', $startObject, $entryCount) !== 2) { - continue; - } - - $oldPosition = $this->reader->getPosition(); - $position = $oldPosition + $this->reader->getOffset(); - - if (!$validityChecked && $entryCount > 0) { - $nextLine = $this->reader->readBytes(21); - /* Check the next line for maximum of 20 bytes and not longer - * By catching 21 bytes and trimming the length should be still 21. - */ - if (\strlen(\trim($nextLine)) !== 21) { - throw new CrossReferenceException( - 'Cross-reference entries are larger than 20 bytes.', - CrossReferenceException::ENTRIES_TOO_LARGE - ); - } - - /* Check for less than 20 bytes: cut the line to 20 bytes and trim; have to result in exactly 18 bytes. - * If it would have less bytes the substring would get the first bytes of the next line which would - * evaluate to a 20 bytes long string after trimming. - */ - if (\strlen(\trim(\substr($nextLine, 0, 20))) !== 18) { - throw new CrossReferenceException( - 'Cross-reference entries are less than 20 bytes.', - CrossReferenceException::ENTRIES_TOO_SHORT - ); - } - - $validityChecked = true; - } - - $subSections[$position] = [$startObject, $entryCount]; - - $lastLineStart = $position + $entryCount * 20; - $this->reader->reset($lastLineStart); - } - - // reset after the last correct parsed line - $this->reader->reset($lastLineStart); - - if (\count($subSections) === 0) { - throw new CrossReferenceException( - 'No entries found in cross-reference.', - CrossReferenceException::NO_ENTRIES - ); - } - - $this->subSections = $subSections; - } - - /** - * Fixes an invalid object number shift. - * - * This method can be used to repair documents with an invalid subsection header: - * - * - * xref - * 1 7 - * 0000000000 65535 f - * 0000000009 00000 n - * 0000412075 00000 n - * 0000412172 00000 n - * 0000412359 00000 n - * 0000412417 00000 n - * 0000412468 00000 n - * - * - * It shall only be called on the first table. - * - * @return bool - */ - public function fixFaultySubSectionShift() - { - $subSections = $this->getSubSections(); - if (\count($subSections) > 1) { - return false; - } - - $subSection = \current($subSections); - if ($subSection[0] != 1) { - return false; - } - - if ($this->getOffsetFor(1) === false) { - foreach ($subSections as $offset => list($startObject, $objectCount)) { - $this->subSections[$offset] = [$startObject - 1, $objectCount]; - } - return true; - } - - return false; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php deleted file mode 100644 index bcbd8e4..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php +++ /dev/null @@ -1,168 +0,0 @@ - 20 bytes). - */ -class LineReader extends AbstractReader implements ReaderInterface -{ - /** - * The object offsets. - * - * @var array - */ - protected $offsets; - - /** - * LineReader constructor. - * - * @param PdfParser $parser - * @throws CrossReferenceException - */ - public function __construct(PdfParser $parser) - { - $this->read($this->extract($parser->getStreamReader())); - parent::__construct($parser); - } - - /** - * @inheritdoc - * @return int|false - */ - public function getOffsetFor($objectNumber) - { - if (isset($this->offsets[$objectNumber])) { - return $this->offsets[$objectNumber][0]; - } - - return false; - } - - /** - * Get all found offsets. - * - * @return array - */ - public function getOffsets() - { - return $this->offsets; - } - - /** - * Extracts the cross reference data from the stream reader. - * - * @param StreamReader $reader - * @return string - * @throws CrossReferenceException - */ - protected function extract(StreamReader $reader) - { - $bytesPerCycle = 100; - $reader->reset(null, $bytesPerCycle); - - $cycles = 0; - do { - // 6 = length of "trailer" - 1 - $pos = \max(($bytesPerCycle * $cycles) - 6, 0); - $trailerPos = \strpos($reader->getBuffer(false), 'trailer', $pos); - $cycles++; - } while ($trailerPos === false && $reader->increaseLength($bytesPerCycle) !== false); - - if ($trailerPos === false) { - throw new CrossReferenceException( - 'Unexpected end of cross reference. "trailer"-keyword not found.', - CrossReferenceException::NO_TRAILER_FOUND - ); - } - - $xrefContent = \substr($reader->getBuffer(false), 0, $trailerPos); - $reader->reset($reader->getPosition() + $trailerPos); - - return $xrefContent; - } - - /** - * Read the cross-reference entries. - * - * @param string $xrefContent - * @throws CrossReferenceException - */ - protected function read($xrefContent) - { - // get eol markers in the first 100 bytes - \preg_match_all("/(\r\n|\n|\r)/", \substr($xrefContent, 0, 100), $m); - - if (\count($m[0]) === 0) { - throw new CrossReferenceException( - 'No data found in cross-reference.', - CrossReferenceException::INVALID_DATA - ); - } - - // count(array_count_values()) is faster then count(array_unique()) - // @see https://github.com/symfony/symfony/pull/23731 - // can be reverted for php7.2 - $differentLineEndings = \count(\array_count_values($m[0])); - if ($differentLineEndings > 1) { - $lines = \preg_split("/(\r\n|\n|\r)/", $xrefContent, -1, PREG_SPLIT_NO_EMPTY); - } else { - $lines = \explode($m[0][0], $xrefContent); - } - - unset($differentLineEndings, $m); - if (!\is_array($lines)) { - $this->offsets = []; - return; - } - - $start = 0; - $offsets = []; - - // trim all lines and remove empty lines - $lines = \array_filter(\array_map('\trim', $lines)); - foreach ($lines as $line) { - $pieces = \explode(' ', $line); - - switch (\count($pieces)) { - case 2: - $start = (int) $pieces[0]; - break; - - case 3: - switch ($pieces[2]) { - case 'n': - $offsets[$start] = [(int) $pieces[0], (int) $pieces[1]]; - $start++; - break 2; - case 'f': - $start++; - break 2; - } - // fall through if pieces doesn't match - - default: - throw new CrossReferenceException( - \sprintf('Unexpected data in xref table (%s)', \implode(' ', $pieces)), - CrossReferenceException::INVALID_DATA - ); - } - } - - $this->offsets = $offsets; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/ReaderInterface.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/ReaderInterface.php deleted file mode 100644 index 0bdc0ab..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/ReaderInterface.php +++ /dev/null @@ -1,34 +0,0 @@ - - if ($ch === 126 && isset($data[$k + 1]) && (\ord($data[$k + 1]) & 0xFF) === 62) { - break; - } - - if ($ch === 122 /* z */ && $state === 0) { - $out .= \chr(0) . \chr(0) . \chr(0) . \chr(0); - continue; - } - - if ($ch < 33 /* ! */ || $ch > 117 /* u */) { - throw new Ascii85Exception( - 'Illegal character found while ASCII85 decode.', - Ascii85Exception::ILLEGAL_CHAR_FOUND - ); - } - - $chn[$state] = $ch - 33;/* ! */ - $state++; - - if ($state === 5) { - $state = 0; - $r = 0; - for ($j = 0; $j < 5; ++$j) { - /** @noinspection UnnecessaryCastingInspection */ - $r = (int)($r * 85 + $chn[$j]); - } - - $out .= \chr($r >> 24) - . \chr($r >> 16) - . \chr($r >> 8) - . \chr($r); - } - } - - if ($state === 1) { - throw new Ascii85Exception( - 'Illegal length while ASCII85 decode.', - Ascii85Exception::ILLEGAL_LENGTH - ); - } - - if ($state === 2) { - $r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1] + 1) * 85 * 85 * 85; - $out .= \chr($r >> 24); - } elseif ($state === 3) { - $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2] + 1) * 85 * 85; - $out .= \chr($r >> 24); - $out .= \chr($r >> 16); - } elseif ($state === 4) { - $r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3] + 1) * 85; - $out .= \chr($r >> 24); - $out .= \chr($r >> 16); - $out .= \chr($r >> 8); - } - - return $out; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85Exception.php b/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85Exception.php deleted file mode 100644 index 83a780c..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85Exception.php +++ /dev/null @@ -1,27 +0,0 @@ -')); - if ((\strlen($data) % 2) === 1) { - $data .= '0'; - } - - return \pack('H*', $data); - } - - /** - * Converts a string into ASCII hexadecimal representation. - * - * @param string $data The input string - * @param boolean $leaveEOD - * @return string - */ - public function encode($data, $leaveEOD = false) - { - $t = \unpack('H*', $data); - return \current($t) - . ($leaveEOD ? '' : '>'); - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/FilterException.php b/vendor/setasign/fpdi/src/PdfParser/Filter/FilterException.php deleted file mode 100644 index c71ff38..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/FilterException.php +++ /dev/null @@ -1,23 +0,0 @@ -extensionLoaded()) { - $oData = $data; - $data = (($data !== '') ? @\gzuncompress($data) : ''); - if ($data === false) { - // let's try if the checksum is CRC32 - $fh = fopen('php://temp', 'w+b'); - fwrite($fh, "\x1f\x8b\x08\x00\x00\x00\x00\x00" . $oData); - // "window" == 31 -> 16 + (8 to 15): Uses the low 4 bits of the value as the window size logarithm. - // The input must include a gzip header and trailer (via 16). - stream_filter_append($fh, 'zlib.inflate', STREAM_FILTER_READ, ['window' => 31]); - fseek($fh, 0); - $data = @stream_get_contents($fh); - fclose($fh); - - if ($data) { - return $data; - } - - // Try this fallback (remove the zlib stream header) - $data = @(gzinflate(substr($oData, 2))); - - if ($data === false) { - throw new FlateException( - 'Error while decompressing stream.', - FlateException::DECOMPRESS_ERROR - ); - } - } - } else { - throw new FlateException( - 'To handle FlateDecode filter, enable zlib support in PHP.', - FlateException::NO_ZLIB - ); - } - - return $data; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/FlateException.php b/vendor/setasign/fpdi/src/PdfParser/Filter/FlateException.php deleted file mode 100644 index 7791ca7..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/FlateException.php +++ /dev/null @@ -1,27 +0,0 @@ -initsTable(); - - $this->data = $data; - $this->dataLength = \strlen($data); - - // Initialize pointers - $this->bytePointer = 0; - - $this->nextData = 0; - $this->nextBits = 0; - - $prevCode = 0; - - $uncompData = ''; - - while (($code = $this->getNextCode()) !== 257) { - if ($code === 256) { - $this->initsTable(); - } elseif ($prevCode === 256) { - $uncompData .= $this->sTable[$code]; - } elseif ($code < $this->tIdx) { - $string = $this->sTable[$code]; - $uncompData .= $string; - - $this->addStringToTable($this->sTable[$prevCode], $string[0]); - } else { - $string = $this->sTable[$prevCode]; - $string .= $string[0]; - $uncompData .= $string; - - $this->addStringToTable($string); - } - $prevCode = $code; - } - - return $uncompData; - } - - /** - * Initialize the string table. - */ - protected function initsTable() - { - $this->sTable = []; - - for ($i = 0; $i < 256; $i++) { - $this->sTable[$i] = \chr($i); - } - - $this->tIdx = 258; - $this->bitsToGet = 9; - } - - /** - * Add a new string to the string table. - * - * @param string $oldString - * @param string $newString - */ - protected function addStringToTable($oldString, $newString = '') - { - $string = $oldString . $newString; - - // Add this new String to the table - $this->sTable[$this->tIdx++] = $string; - - if ($this->tIdx === 511) { - $this->bitsToGet = 10; - } elseif ($this->tIdx === 1023) { - $this->bitsToGet = 11; - } elseif ($this->tIdx === 2047) { - $this->bitsToGet = 12; - } - } - - /** - * Returns the next 9, 10, 11 or 12 bits. - * - * @return int - */ - protected function getNextCode() - { - if ($this->bytePointer === $this->dataLength) { - return 257; - } - - $this->nextData = ($this->nextData << 8) | (\ord($this->data[$this->bytePointer++]) & 0xff); - $this->nextBits += 8; - - if ($this->nextBits < $this->bitsToGet) { - $this->nextData = ($this->nextData << 8) | (\ord($this->data[$this->bytePointer++]) & 0xff); - $this->nextBits += 8; - } - - $code = ($this->nextData >> ($this->nextBits - $this->bitsToGet)) & $this->andTable[$this->bitsToGet - 9]; - $this->nextBits -= $this->bitsToGet; - - return $code; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/LzwException.php b/vendor/setasign/fpdi/src/PdfParser/Filter/LzwException.php deleted file mode 100644 index 9f42038..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/LzwException.php +++ /dev/null @@ -1,22 +0,0 @@ -streamReader = $streamReader; - $this->tokenizer = new Tokenizer($streamReader); - } - - /** - * Removes cycled references. - * - * @internal - */ - public function cleanUp() - { - $this->xref = null; - } - - /** - * Get the stream reader instance. - * - * @return StreamReader - */ - public function getStreamReader() - { - return $this->streamReader; - } - - /** - * Get the tokenizer instance. - * - * @return Tokenizer - */ - public function getTokenizer() - { - return $this->tokenizer; - } - - /** - * Resolves the file header. - * - * @throws PdfParserException - * @return int - */ - protected function resolveFileHeader() - { - if ($this->fileHeader) { - return $this->fileHeaderOffset; - } - - $this->streamReader->reset(0); - $maxIterations = 1000; - while (true) { - $buffer = $this->streamReader->getBuffer(false); - $offset = \strpos($buffer, '%PDF-'); - if ($offset === false) { - if (!$this->streamReader->increaseLength(100) || (--$maxIterations === 0)) { - throw new PdfParserException( - 'Unable to find PDF file header.', - PdfParserException::FILE_HEADER_NOT_FOUND - ); - } - continue; - } - break; - } - - $this->fileHeaderOffset = $offset; - $this->streamReader->setOffset($offset); - - $this->fileHeader = \trim($this->streamReader->readLine()); - return $this->fileHeaderOffset; - } - - /** - * Get the cross-reference instance. - * - * @return CrossReference - * @throws CrossReferenceException - * @throws PdfParserException - */ - public function getCrossReference() - { - if ($this->xref === null) { - $this->xref = new CrossReference($this, $this->resolveFileHeader()); - } - - return $this->xref; - } - - /** - * Get the PDF version. - * - * @return int[] An array of major and minor version. - * @throws PdfParserException - */ - public function getPdfVersion() - { - $this->resolveFileHeader(); - - if (\preg_match('/%PDF-(\d)\.(\d)/', $this->fileHeader, $result) === 0) { - throw new PdfParserException( - 'Unable to extract PDF version from file header.', - PdfParserException::PDF_VERSION_NOT_FOUND - ); - } - list(, $major, $minor) = $result; - - $catalog = $this->getCatalog(); - if (isset($catalog->value['Version'])) { - $versionParts = \explode( - '.', - PdfName::unescape(PdfType::resolve($catalog->value['Version'], $this)->value) - ); - if (count($versionParts) === 2) { - list($major, $minor) = $versionParts; - } - } - - return [(int) $major, (int) $minor]; - } - - /** - * Get the catalog dictionary. - * - * @return PdfDictionary - * @throws Type\PdfTypeException - * @throws CrossReferenceException - * @throws PdfParserException - */ - public function getCatalog() - { - $trailer = $this->getCrossReference()->getTrailer(); - - $catalog = PdfType::resolve(PdfDictionary::get($trailer, 'Root'), $this); - - return PdfDictionary::ensure($catalog); - } - - /** - * Get an indirect object by its object number. - * - * @param int $objectNumber - * @param bool $cache - * @return PdfIndirectObject - * @throws CrossReferenceException - * @throws PdfParserException - */ - public function getIndirectObject($objectNumber, $cache = false) - { - $objectNumber = (int) $objectNumber; - if (isset($this->objects[$objectNumber])) { - return $this->objects[$objectNumber]; - } - - $object = $this->getCrossReference()->getIndirectObject($objectNumber); - - if ($cache) { - $this->objects[$objectNumber] = $object; - } - - return $object; - } - - /** - * Read a PDF value. - * - * @param null|bool|string $token - * @param null|string $expectedType - * @return false|PdfArray|PdfBoolean|PdfDictionary|PdfHexString|PdfIndirectObject|PdfIndirectObjectReference|PdfName|PdfNull|PdfNumeric|PdfStream|PdfString|PdfToken - * @throws Type\PdfTypeException - */ - public function readValue($token = null, $expectedType = null) - { - if ($token === null) { - $token = $this->tokenizer->getNextToken(); - } - - if ($token === false) { - if ($expectedType !== null) { - throw new Type\PdfTypeException('Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE); - } - return false; - } - - switch ($token) { - case '(': - $this->ensureExpectedType($token, $expectedType); - return $this->parsePdfString(); - - case '<': - if ($this->streamReader->getByte() === '<') { - $this->ensureExpectedType('<<', $expectedType); - $this->streamReader->addOffset(1); - return $this->parsePdfDictionary(); - } - - $this->ensureExpectedType($token, $expectedType); - return $this->parsePdfHexString(); - - case '/': - $this->ensureExpectedType($token, $expectedType); - return $this->parsePdfName(); - - case '[': - $this->ensureExpectedType($token, $expectedType); - return $this->parsePdfArray(); - - default: - if (\is_numeric($token)) { - if (($token2 = $this->tokenizer->getNextToken()) !== false) { - if (\is_numeric($token2) && ($token3 = $this->tokenizer->getNextToken()) !== false) { - switch ($token3) { - case 'obj': - if ($expectedType !== null && $expectedType !== PdfIndirectObject::class) { - throw new Type\PdfTypeException( - 'Got unexpected token type.', - Type\PdfTypeException::INVALID_DATA_TYPE - ); - } - - return $this->parsePdfIndirectObject((int)$token, (int)$token2); - case 'R': - if ( - $expectedType !== null && - $expectedType !== PdfIndirectObjectReference::class - ) { - throw new Type\PdfTypeException( - 'Got unexpected token type.', - Type\PdfTypeException::INVALID_DATA_TYPE - ); - } - - return PdfIndirectObjectReference::create((int)$token, (int)$token2); - } - - $this->tokenizer->pushStack($token3); - } - - $this->tokenizer->pushStack($token2); - } - - if ($expectedType !== null && $expectedType !== PdfNumeric::class) { - throw new Type\PdfTypeException( - 'Got unexpected token type.', - Type\PdfTypeException::INVALID_DATA_TYPE - ); - } - return PdfNumeric::create($token + 0); - } - - if ($token === 'true' || $token === 'false') { - $this->ensureExpectedType($token, $expectedType); - return PdfBoolean::create($token === 'true'); - } - - if ($token === 'null') { - $this->ensureExpectedType($token, $expectedType); - return new PdfNull(); - } - - if ($expectedType !== null && $expectedType !== PdfToken::class) { - throw new Type\PdfTypeException( - 'Got unexpected token type.', - Type\PdfTypeException::INVALID_DATA_TYPE - ); - } - - $v = new PdfToken(); - $v->value = $token; - - return $v; - } - } - - /** - * @return PdfString - */ - protected function parsePdfString() - { - return PdfString::parse($this->streamReader); - } - - /** - * @return false|PdfHexString - */ - protected function parsePdfHexString() - { - return PdfHexString::parse($this->streamReader); - } - - /** - * @return bool|PdfDictionary - * @throws PdfTypeException - */ - protected function parsePdfDictionary() - { - return PdfDictionary::parse($this->tokenizer, $this->streamReader, $this); - } - - /** - * @return PdfName - */ - protected function parsePdfName() - { - return PdfName::parse($this->tokenizer, $this->streamReader); - } - - /** - * @return false|PdfArray - * @throws PdfTypeException - */ - protected function parsePdfArray() - { - return PdfArray::parse($this->tokenizer, $this); - } - - /** - * @param int $objectNumber - * @param int $generationNumber - * @return false|PdfIndirectObject - * @throws Type\PdfTypeException - */ - protected function parsePdfIndirectObject($objectNumber, $generationNumber) - { - return PdfIndirectObject::parse( - $objectNumber, - $generationNumber, - $this, - $this->tokenizer, - $this->streamReader - ); - } - - /** - * Ensures that the token will evaluate to an expected object type (or not). - * - * @param string $token - * @param string|null $expectedType - * @return bool - * @throws Type\PdfTypeException - */ - protected function ensureExpectedType($token, $expectedType) - { - static $mapping = [ - '(' => PdfString::class, - '<' => PdfHexString::class, - '<<' => PdfDictionary::class, - '/' => PdfName::class, - '[' => PdfArray::class, - 'true' => PdfBoolean::class, - 'false' => PdfBoolean::class, - 'null' => PdfNull::class - ]; - - if ($expectedType === null || $mapping[$token] === $expectedType) { - return true; - } - - throw new Type\PdfTypeException('Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE); - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/PdfParserException.php b/vendor/setasign/fpdi/src/PdfParser/PdfParserException.php deleted file mode 100644 index 0629d9d..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/PdfParserException.php +++ /dev/null @@ -1,49 +0,0 @@ -stream = $stream; - $this->closeStream = $closeStream; - $this->reset(); - } - - /** - * The destructor. - */ - public function __destruct() - { - $this->cleanUp(); - } - - /** - * Closes the file handle. - */ - public function cleanUp() - { - if ($this->closeStream && is_resource($this->stream)) { - \fclose($this->stream); - } - } - - /** - * Returns the byte length of the buffer. - * - * @param bool $atOffset - * @return int - */ - public function getBufferLength($atOffset = false) - { - if ($atOffset === false) { - return $this->bufferLength; - } - - return $this->bufferLength - $this->offset; - } - - /** - * Get the current position in the stream. - * - * @return int - */ - public function getPosition() - { - return $this->position; - } - - /** - * Returns the current buffer. - * - * @param bool $atOffset - * @return string - */ - public function getBuffer($atOffset = true) - { - if ($atOffset === false) { - return $this->buffer; - } - - $string = \substr($this->buffer, $this->offset); - - return (string) $string; - } - - /** - * Gets a byte at a specific position in the buffer. - * - * If the position is invalid the method will return false. - * - * If the $position parameter is set to null the value of $this->offset will be used. - * - * @param int|null $position - * @return string|bool - */ - public function getByte($position = null) - { - $position = (int) ($position !== null ? $position : $this->offset); - if ( - $position >= $this->bufferLength - && (!$this->increaseLength() || $position >= $this->bufferLength) - ) { - return false; - } - - return $this->buffer[$position]; - } - - /** - * Returns a byte at a specific position, and set the offset to the next byte position. - * - * If the position is invalid the method will return false. - * - * If the $position parameter is set to null the value of $this->offset will be used. - * - * @param int|null $position - * @return string|bool - */ - public function readByte($position = null) - { - if ($position !== null) { - $position = (int) $position; - // check if needed bytes are available in the current buffer - if (!($position >= $this->position && $position < $this->position + $this->bufferLength)) { - $this->reset($position); - $offset = $this->offset; - } else { - $offset = $position - $this->position; - } - } else { - $offset = $this->offset; - } - - if ( - $offset >= $this->bufferLength - && ((!$this->increaseLength()) || $offset >= $this->bufferLength) - ) { - return false; - } - - $this->offset = $offset + 1; - return $this->buffer[$offset]; - } - - /** - * Read bytes from the current or a specific offset position and set the internal pointer to the next byte. - * - * If the position is invalid the method will return false. - * - * If the $position parameter is set to null the value of $this->offset will be used. - * - * @param int $length - * @param int|null $position - * @return string|false - */ - public function readBytes($length, $position = null) - { - $length = (int) $length; - if ($position !== null) { - // check if needed bytes are available in the current buffer - if (!($position >= $this->position && $position < $this->position + $this->bufferLength)) { - $this->reset($position, $length); - $offset = $this->offset; - } else { - $offset = $position - $this->position; - } - } else { - $offset = $this->offset; - } - - if ( - ($offset + $length) > $this->bufferLength - && ((!$this->increaseLength($length)) || ($offset + $length) > $this->bufferLength) - ) { - return false; - } - - $bytes = \substr($this->buffer, $offset, $length); - $this->offset = $offset + $length; - - return $bytes; - } - - /** - * Read a line from the current position. - * - * @param int $length - * @return string|bool - */ - public function readLine($length = 1024) - { - if ($this->ensureContent() === false) { - return false; - } - - $line = ''; - while ($this->ensureContent()) { - $char = $this->readByte(); - - if ($char === "\n") { - break; - } - - if ($char === "\r") { - if ($this->getByte() === "\n") { - $this->addOffset(1); - } - break; - } - - $line .= $char; - - if (\strlen($line) >= $length) { - break; - } - } - - return $line; - } - - /** - * Set the offset position in the current buffer. - * - * @param int $offset - */ - public function setOffset($offset) - { - if ($offset > $this->bufferLength || $offset < 0) { - throw new \OutOfRangeException( - \sprintf('Offset (%s) out of range (length: %s)', $offset, $this->bufferLength) - ); - } - - $this->offset = (int) $offset; - } - - /** - * Returns the current offset in the current buffer. - * - * @return int - */ - public function getOffset() - { - return $this->offset; - } - - /** - * Add an offset to the current offset. - * - * @param int $offset - */ - public function addOffset($offset) - { - $this->setOffset($this->offset + $offset); - } - - /** - * Make sure that there is at least one character beyond the current offset in the buffer. - * - * @return bool - */ - public function ensureContent() - { - while ($this->offset >= $this->bufferLength) { - if (!$this->increaseLength()) { - return false; - } - } - return true; - } - - /** - * Returns the stream. - * - * @return resource - */ - public function getStream() - { - return $this->stream; - } - - /** - * Gets the total available length. - * - * @return int - */ - public function getTotalLength() - { - if ($this->totalLength === null) { - $stat = \fstat($this->stream); - $this->totalLength = $stat['size']; - } - - return $this->totalLength; - } - - /** - * Resets the buffer to a position and re-read the buffer with the given length. - * - * If the $pos parameter is negative the start buffer position will be the $pos'th position from - * the end of the file. - * - * If the $pos parameter is negative and the absolute value is bigger then the totalLength of - * the file $pos will set to zero. - * - * @param int|null $pos Start position of the new buffer - * @param int $length Length of the new buffer. Mustn't be negative - */ - public function reset($pos = 0, $length = 200) - { - if ($pos === null) { - $pos = $this->position + $this->offset; - } elseif ($pos < 0) { - $pos = \max(0, $this->getTotalLength() + $pos); - } - - \fseek($this->stream, $pos); - - $this->position = $pos; - $this->buffer = $length > 0 ? \fread($this->stream, $length) : ''; - $this->bufferLength = \strlen($this->buffer); - $this->offset = 0; - - // If a stream wrapper is in use it is possible that - // length values > 8096 will be ignored, so use the - // increaseLength()-method to correct that behavior - if ($this->bufferLength < $length && $this->increaseLength($length - $this->bufferLength)) { - // increaseLength parameter is $minLength, so cut to have only the required bytes in the buffer - $this->buffer = \substr($this->buffer, 0, $length); - $this->bufferLength = \strlen($this->buffer); - } - } - - /** - * Ensures bytes in the buffer with a specific length and location in the file. - * - * @param int $pos - * @param int $length - * @see reset() - */ - public function ensure($pos, $length) - { - if ( - $pos >= $this->position - && $pos < ($this->position + $this->bufferLength) - && ($this->position + $this->bufferLength) >= ($pos + $length) - ) { - $this->offset = $pos - $this->position; - } else { - $this->reset($pos, $length); - } - } - - /** - * Forcefully read more data into the buffer. - * - * @param int $minLength - * @return bool Returns false if the stream reaches the end - */ - public function increaseLength($minLength = 100) - { - $length = \max($minLength, 100); - - if (\feof($this->stream) || $this->getTotalLength() === $this->position + $this->bufferLength) { - return false; - } - - $newLength = $this->bufferLength + $length; - do { - $this->buffer .= \fread($this->stream, $newLength - $this->bufferLength); - $this->bufferLength = \strlen($this->buffer); - } while (($this->bufferLength !== $newLength) && !\feof($this->stream)); - - return true; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Tokenizer.php b/vendor/setasign/fpdi/src/PdfParser/Tokenizer.php deleted file mode 100644 index 5c1ccd8..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Tokenizer.php +++ /dev/null @@ -1,154 +0,0 @@ -streamReader = $streamReader; - } - - /** - * Get the stream reader instance. - * - * @return StreamReader - */ - public function getStreamReader() - { - return $this->streamReader; - } - - /** - * Clear the token stack. - */ - public function clearStack() - { - $this->stack = []; - } - - /** - * Push a token onto the stack. - * - * @param string $token - */ - public function pushStack($token) - { - $this->stack[] = $token; - } - - /** - * Get next token. - * - * @return bool|string - */ - public function getNextToken() - { - $token = \array_pop($this->stack); - if ($token !== null) { - return $token; - } - - if (($byte = $this->streamReader->readByte()) === false) { - return false; - } - - if (\in_array($byte, ["\x20", "\x0A", "\x0D", "\x0C", "\x09", "\x00"], true)) { - if ($this->leapWhiteSpaces() === false) { - return false; - } - $byte = $this->streamReader->readByte(); - } - - switch ($byte) { - case '/': - case '[': - case ']': - case '(': - case ')': - case '{': - case '}': - case '<': - case '>': - return $byte; - case '%': - $this->streamReader->readLine(); - return $this->getNextToken(); - } - - /* This way is faster than checking single bytes. - */ - $bufferOffset = $this->streamReader->getOffset(); - do { - $lastBuffer = $this->streamReader->getBuffer(false); - $pos = \strcspn( - $lastBuffer, - "\x00\x09\x0A\x0C\x0D\x20()<>[]{}/%", - $bufferOffset - ); - } while ( - // Break the loop if a delimiter or white space char is matched - // in the current buffer or increase the buffers length - $lastBuffer !== false && - ( - $bufferOffset + $pos === \strlen($lastBuffer) && - $this->streamReader->increaseLength() - ) - ); - - $result = \substr($lastBuffer, $bufferOffset - 1, $pos + 1); - $this->streamReader->setOffset($bufferOffset + $pos); - - return $result; - } - - /** - * Leap white spaces. - * - * @return boolean - */ - public function leapWhiteSpaces() - { - do { - if (!$this->streamReader->ensureContent()) { - return false; - } - - $buffer = $this->streamReader->getBuffer(false); - $matches = \strspn($buffer, "\x20\x0A\x0C\x0D\x09\x00", $this->streamReader->getOffset()); - if ($matches > 0) { - $this->streamReader->addOffset($matches); - } - } while ($this->streamReader->getOffset() >= $this->streamReader->getBufferLength()); - - return true; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfArray.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfArray.php deleted file mode 100644 index c7981b6..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfArray.php +++ /dev/null @@ -1,85 +0,0 @@ -getNextToken()) !== ']') { - if ($token === false || ($value = $parser->readValue($token)) === false) { - return false; - } - - $result[] = $value; - } - - $v = new self(); - $v->value = $result; - - return $v; - } - - /** - * Helper method to create an instance. - * - * @param PdfType[] $values - * @return self - */ - public static function create(array $values = []) - { - $v = new self(); - $v->value = $values; - - return $v; - } - - /** - * Ensures that the passed array is a PdfArray instance with a (optional) specific size. - * - * @param mixed $array - * @param null|int $size - * @return self - * @throws PdfTypeException - */ - public static function ensure($array, $size = null) - { - $result = PdfType::ensureType(self::class, $array, 'Array value expected.'); - - if ($size !== null && \count($array->value) !== $size) { - throw new PdfTypeException( - \sprintf('Array with %s entries expected.', $size), - PdfTypeException::INVALID_DATA_SIZE - ); - } - - return $result; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php deleted file mode 100644 index ad7c5d6..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php +++ /dev/null @@ -1,42 +0,0 @@ -value = (bool) $value; - return $v; - } - - /** - * Ensures that the passed value is a PdfBoolean instance. - * - * @param mixed $value - * @return self - * @throws PdfTypeException - */ - public static function ensure($value) - { - return PdfType::ensureType(self::class, $value, 'Boolean value expected.'); - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php deleted file mode 100644 index 8991322..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php +++ /dev/null @@ -1,134 +0,0 @@ -getNextToken(); - if ($token === '>' && $streamReader->getByte() === '>') { - $streamReader->addOffset(1); - break; - } - - $key = $parser->readValue($token); - if ($key === false) { - return false; - } - - // ensure the first value to be a Name object - if (!($key instanceof PdfName)) { - $lastToken = null; - // ignore all other entries and search for the closing brackets - while (($token = $tokenizer->getNextToken()) !== '>' && $token !== false && $lastToken !== '>') { - $lastToken = $token; - } - - if ($token === false) { - return false; - } - - break; - } - - - $value = $parser->readValue(); - if ($value === false) { - return false; - } - - if ($value instanceof PdfNull) { - continue; - } - - // catch missing value - if ($value instanceof PdfToken && $value->value === '>' && $streamReader->getByte() === '>') { - $streamReader->addOffset(1); - break; - } - - $entries[$key->value] = $value; - } - - $v = new self(); - $v->value = $entries; - - return $v; - } - - /** - * Helper method to create an instance. - * - * @param PdfType[] $entries The keys are the name entries of the dictionary. - * @return self - */ - public static function create(array $entries = []) - { - $v = new self(); - $v->value = $entries; - - return $v; - } - - /** - * Get a value by its key from a dictionary or a default value. - * - * @param mixed $dictionary - * @param string $key - * @param PdfType|null $default - * @return PdfNull|PdfType - * @throws PdfTypeException - */ - public static function get($dictionary, $key, PdfType $default = null) - { - $dictionary = self::ensure($dictionary); - - if (isset($dictionary->value[$key])) { - return $dictionary->value[$key]; - } - - return $default === null - ? new PdfNull() - : $default; - } - - /** - * Ensures that the passed value is a PdfDictionary instance. - * - * @param mixed $dictionary - * @return self - * @throws PdfTypeException - */ - public static function ensure($dictionary) - { - return PdfType::ensureType(self::class, $dictionary, 'Dictionary value expected.'); - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfHexString.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfHexString.php deleted file mode 100644 index cd9d2b6..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfHexString.php +++ /dev/null @@ -1,77 +0,0 @@ -getOffset(); - - while (true) { - $buffer = $streamReader->getBuffer(false); - $pos = \strpos($buffer, '>', $bufferOffset); - if ($pos === false) { - if (!$streamReader->increaseLength()) { - return false; - } - continue; - } - - break; - } - - $result = \substr($buffer, $bufferOffset, $pos - $bufferOffset); - $streamReader->setOffset($pos + 1); - - $v = new self(); - $v->value = $result; - - return $v; - } - - /** - * Helper method to create an instance. - * - * @param string $string The hex encoded string. - * @return self - */ - public static function create($string) - { - $v = new self(); - $v->value = $string; - - return $v; - } - - /** - * Ensures that the passed value is a PdfHexString instance. - * - * @param mixed $hexString - * @return self - * @throws PdfTypeException - */ - public static function ensure($hexString) - { - return PdfType::ensureType(self::class, $hexString, 'Hex string value expected.'); - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObject.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObject.php deleted file mode 100644 index 72a80e1..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObject.php +++ /dev/null @@ -1,103 +0,0 @@ -readValue(); - if ($value === false) { - return false; - } - - $nextToken = $tokenizer->getNextToken(); - if ($nextToken === 'stream') { - $value = PdfStream::parse($value, $reader, $parser); - } elseif ($nextToken !== false) { - $tokenizer->pushStack($nextToken); - } - - $v = new self(); - $v->objectNumber = (int) $objectNumber; - $v->generationNumber = (int) $objectGenerationNumber; - $v->value = $value; - - return $v; - } - - /** - * Helper method to create an instance. - * - * @param int $objectNumber - * @param int $generationNumber - * @param PdfType $value - * @return self - */ - public static function create($objectNumber, $generationNumber, PdfType $value) - { - $v = new self(); - $v->objectNumber = (int) $objectNumber; - $v->generationNumber = (int) $generationNumber; - $v->value = $value; - - return $v; - } - - /** - * Ensures that the passed value is a PdfIndirectObject instance. - * - * @param mixed $indirectObject - * @return self - * @throws PdfTypeException - */ - public static function ensure($indirectObject) - { - return PdfType::ensureType(self::class, $indirectObject, 'Indirect object expected.'); - } - - /** - * The object number. - * - * @var int - */ - public $objectNumber; - - /** - * The generation number. - * - * @var int - */ - public $generationNumber; -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObjectReference.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObjectReference.php deleted file mode 100644 index 975e9e8..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObjectReference.php +++ /dev/null @@ -1,52 +0,0 @@ -value = (int) $objectNumber; - $v->generationNumber = (int) $generationNumber; - - return $v; - } - - /** - * Ensures that the passed value is a PdfIndirectObject instance. - * - * @param mixed $value - * @return self - * @throws PdfTypeException - */ - public static function ensure($value) - { - return PdfType::ensureType(self::class, $value, 'Indirect reference value expected.'); - } - - /** - * The generation number. - * - * @var int - */ - public $generationNumber; -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfName.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfName.php deleted file mode 100644 index 0fbfe52..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfName.php +++ /dev/null @@ -1,82 +0,0 @@ -getByte(), "\x00\x09\x0A\x0C\x0D\x20()<>[]{}/%") === 0) { - $v->value = (string) $tokenizer->getNextToken(); - return $v; - } - - $v->value = ''; - return $v; - } - - /** - * Unescapes a name string. - * - * @param string $value - * @return string - */ - public static function unescape($value) - { - if (strpos($value, '#') === false) { - return $value; - } - - return preg_replace_callback('/#([a-fA-F\d]{2})/', function ($matches) { - return chr(hexdec($matches[1])); - }, $value); - } - - /** - * Helper method to create an instance. - * - * @param string $string - * @return self - */ - public static function create($string) - { - $v = new self(); - $v->value = $string; - - return $v; - } - - /** - * Ensures that the passed value is a PdfName instance. - * - * @param mixed $name - * @return self - * @throws PdfTypeException - */ - public static function ensure($name) - { - return PdfType::ensureType(self::class, $name, 'Name value expected.'); - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfNull.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfNull.php deleted file mode 100644 index 4830564..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfNull.php +++ /dev/null @@ -1,19 +0,0 @@ -value = $value + 0; - - return $v; - } - - /** - * Ensures that the passed value is a PdfNumeric instance. - * - * @param mixed $value - * @return self - * @throws PdfTypeException - */ - public static function ensure($value) - { - return PdfType::ensureType(self::class, $value, 'Numeric value expected.'); - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfStream.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfStream.php deleted file mode 100644 index cfa2cdb..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfStream.php +++ /dev/null @@ -1,352 +0,0 @@ -value = $dictionary; - $v->reader = $reader; - $v->parser = $parser; - - $offset = $reader->getOffset(); - - // Find the first "newline" - while (($firstByte = $reader->getByte($offset)) !== false) { - $offset++; - if ($firstByte === "\n" || $firstByte === "\r") { - break; - } - } - - if ($firstByte === false) { - throw new PdfTypeException( - 'Unable to parse stream data. No newline after the stream keyword found.', - PdfTypeException::NO_NEWLINE_AFTER_STREAM_KEYWORD - ); - } - - $sndByte = $reader->getByte($offset); - if ($sndByte === "\n" && $firstByte !== "\n") { - $offset++; - } - - $reader->setOffset($offset); - // let's only save the byte-offset and read the stream only when needed - $v->stream = $reader->getPosition() + $reader->getOffset(); - - return $v; - } - - /** - * Helper method to create an instance. - * - * @param PdfDictionary $dictionary - * @param string $stream - * @return self - */ - public static function create(PdfDictionary $dictionary, $stream) - { - $v = new self(); - $v->value = $dictionary; - $v->stream = (string) $stream; - - return $v; - } - - /** - * Ensures that the passed value is a PdfStream instance. - * - * @param mixed $stream - * @return self - * @throws PdfTypeException - */ - public static function ensure($stream) - { - return PdfType::ensureType(self::class, $stream, 'Stream value expected.'); - } - - /** - * The stream or its byte-offset position. - * - * @var int|string - */ - protected $stream; - - /** - * The stream reader instance. - * - * @var StreamReader|null - */ - protected $reader; - - /** - * The PDF parser instance. - * - * @var PdfParser - */ - protected $parser; - - /** - * Get the stream data. - * - * @param bool $cache Whether cache the stream data or not. - * @return bool|string - * @throws PdfTypeException - * @throws CrossReferenceException - * @throws PdfParserException - */ - public function getStream($cache = false) - { - if (\is_int($this->stream)) { - $length = PdfDictionary::get($this->value, 'Length'); - if ($this->parser !== null) { - $length = PdfType::resolve($length, $this->parser); - } - - if (!($length instanceof PdfNumeric) || $length->value === 0) { - $this->reader->reset($this->stream, 100000); - $buffer = $this->extractStream(); - } else { - $this->reader->reset($this->stream, $length->value); - $buffer = $this->reader->getBuffer(false); - if ($this->parser !== null) { - $this->reader->reset($this->stream + strlen($buffer)); - $this->parser->getTokenizer()->clearStack(); - $token = $this->parser->readValue(); - if ($token === false || !($token instanceof PdfToken) || $token->value !== 'endstream') { - $this->reader->reset($this->stream, 100000); - $buffer = $this->extractStream(); - $this->reader->reset($this->stream + strlen($buffer)); - } - } - } - - if ($cache === false) { - return $buffer; - } - - $this->stream = $buffer; - $this->reader = null; - } - - return $this->stream; - } - - /** - * Extract the stream "manually". - * - * @return string - * @throws PdfTypeException - */ - protected function extractStream() - { - while (true) { - $buffer = $this->reader->getBuffer(false); - $length = \strpos($buffer, 'endstream'); - if ($length === false) { - if (!$this->reader->increaseLength(100000)) { - throw new PdfTypeException('Cannot extract stream.'); - } - continue; - } - break; - } - - $buffer = \substr($buffer, 0, $length); - $lastByte = \substr($buffer, -1); - - /* Check for EOL marker = - * CARRIAGE RETURN (\r) and a LINE FEED (\n) or just a LINE FEED (\n}, - * and not by a CARRIAGE RETURN (\r) alone - */ - if ($lastByte === "\n") { - $buffer = \substr($buffer, 0, -1); - - $lastByte = \substr($buffer, -1); - if ($lastByte === "\r") { - $buffer = \substr($buffer, 0, -1); - } - } - - // There are streams in the wild, which have only white signs in them but need to be parsed manually due - // to a problem encountered before (e.g. Length === 0). We should set them to empty streams to avoid problems - // in further processing (e.g. applying of filters). - if (trim($buffer) === '') { - $buffer = ''; - } - - return $buffer; - } - - /** - * Get all filters defined for this stream. - * - * @return PdfType[] - * @throws PdfTypeException - */ - public function getFilters() - { - $filters = PdfDictionary::get($this->value, 'Filter'); - if ($filters instanceof PdfNull) { - return []; - } - - if ($filters instanceof PdfArray) { - $filters = $filters->value; - } else { - $filters = [$filters]; - } - - return $filters; - } - - /** - * Get the unfiltered stream data. - * - * @return string - * @throws FilterException - * @throws PdfParserException - */ - public function getUnfilteredStream() - { - $stream = $this->getStream(); - $filters = $this->getFilters(); - if ($filters === []) { - return $stream; - } - - $decodeParams = PdfDictionary::get($this->value, 'DecodeParms'); - if ($decodeParams instanceof PdfArray) { - $decodeParams = $decodeParams->value; - } else { - $decodeParams = [$decodeParams]; - } - - foreach ($filters as $key => $filter) { - if (!($filter instanceof PdfName)) { - continue; - } - - $decodeParam = null; - if (isset($decodeParams[$key])) { - $decodeParam = ($decodeParams[$key] instanceof PdfDictionary ? $decodeParams[$key] : null); - } - - switch ($filter->value) { - case 'FlateDecode': - case 'Fl': - case 'LZWDecode': - case 'LZW': - if (\strpos($filter->value, 'LZW') === 0) { - $filterObject = new Lzw(); - } else { - $filterObject = new Flate(); - } - - $stream = $filterObject->decode($stream); - - if ($decodeParam instanceof PdfDictionary) { - $predictor = PdfDictionary::get($decodeParam, 'Predictor', PdfNumeric::create(1)); - if ($predictor->value !== 1) { - if (!\class_exists(Predictor::class)) { - throw new PdfParserException( - 'This PDF document makes use of features which are only implemented in the ' . - 'commercial "FPDI PDF-Parser" add-on (see https://www.setasign.com/fpdi-pdf-' . - 'parser).', - PdfParserException::IMPLEMENTED_IN_FPDI_PDF_PARSER - ); - } - - $colors = PdfDictionary::get($decodeParam, 'Colors', PdfNumeric::create(1)); - $bitsPerComponent = PdfDictionary::get( - $decodeParam, - 'BitsPerComponent', - PdfNumeric::create(8) - ); - - $columns = PdfDictionary::get($decodeParam, 'Columns', PdfNumeric::create(1)); - - $filterObject = new Predictor( - $predictor->value, - $colors->value, - $bitsPerComponent->value, - $columns->value - ); - - $stream = $filterObject->decode($stream); - } - } - - break; - case 'ASCII85Decode': - case 'A85': - $filterObject = new Ascii85(); - $stream = $filterObject->decode($stream); - break; - - case 'ASCIIHexDecode': - case 'AHx': - $filterObject = new AsciiHex(); - $stream = $filterObject->decode($stream); - break; - - case 'Crypt': - if (!$decodeParam instanceof PdfDictionary) { - break; - } - // Filter is "Identity" - $name = PdfDictionary::get($decodeParam, 'Name'); - if (!$name instanceof PdfName || $name->value !== 'Identity') { - break; - } - - throw new FilterException( - 'Support for Crypt filters other than "Identity" is not implemented.', - FilterException::UNSUPPORTED_FILTER - ); - - default: - throw new FilterException( - \sprintf('Unsupported filter "%s".', $filter->value), - FilterException::UNSUPPORTED_FILTER - ); - } - } - - return $stream; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfString.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfString.php deleted file mode 100644 index dc4ce33..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfString.php +++ /dev/null @@ -1,202 +0,0 @@ -getOffset(); - $openBrackets = 1; - do { - $buffer = $streamReader->getBuffer(false); - for ($length = \strlen($buffer); $openBrackets !== 0 && $pos < $length; $pos++) { - switch ($buffer[$pos]) { - case '(': - $openBrackets++; - break; - case ')': - $openBrackets--; - break; - case '\\': - $pos++; - } - } - } while ($openBrackets !== 0 && $streamReader->increaseLength()); - - $result = \substr($buffer, $startPos, $openBrackets + $pos - $startPos - 1); - $streamReader->setOffset($pos); - - $v = new self(); - $v->value = $result; - - return $v; - } - - /** - * Helper method to create an instance. - * - * @param string $value The string needs to be escaped accordingly. - * @return self - */ - public static function create($value) - { - $v = new self(); - $v->value = $value; - - return $v; - } - - /** - * Ensures that the passed value is a PdfString instance. - * - * @param mixed $string - * @return self - * @throws PdfTypeException - */ - public static function ensure($string) - { - return PdfType::ensureType(self::class, $string, 'String value expected.'); - } - - /** - * Escapes sequences in a string according to the PDF specification. - * - * @param string $s - * @return string - */ - public static function escape($s) - { - // Still a bit faster, than direct replacing - if ( - \strpos($s, '\\') !== false || - \strpos($s, ')') !== false || - \strpos($s, '(') !== false || - \strpos($s, "\x0D") !== false || - \strpos($s, "\x0A") !== false || - \strpos($s, "\x09") !== false || - \strpos($s, "\x08") !== false || - \strpos($s, "\x0C") !== false - ) { - // is faster than strtr(...) - return \str_replace( - ['\\', ')', '(', "\x0D", "\x0A", "\x09", "\x08", "\x0C"], - ['\\\\', '\\)', '\\(', '\r', '\n', '\t', '\b', '\f'], - $s - ); - } - - return $s; - } - - /** - * Unescapes escaped sequences in a PDF string according to the PDF specification. - * - * @param string $s - * @return string - */ - public static function unescape($s) - { - $out = ''; - /** @noinspection ForeachInvariantsInspection */ - for ($count = 0, $n = \strlen($s); $count < $n; $count++) { - if ($s[$count] !== '\\') { - $out .= $s[$count]; - } else { - // A backslash at the end of the string - ignore it - if ($count === ($n - 1)) { - break; - } - - switch ($s[++$count]) { - case ')': - case '(': - case '\\': - $out .= $s[$count]; - break; - - case 'f': - $out .= "\x0C"; - break; - - case 'b': - $out .= "\x08"; - break; - - case 't': - $out .= "\x09"; - break; - - case 'r': - $out .= "\x0D"; - break; - - case 'n': - $out .= "\x0A"; - break; - - case "\r": - if ($count !== $n - 1 && $s[$count + 1] === "\n") { - $count++; - } - break; - - case "\n": - break; - - default: - $actualChar = \ord($s[$count]); - // ascii 48 = number 0 - // ascii 57 = number 9 - if ($actualChar >= 48 && $actualChar <= 57) { - $oct = '' . $s[$count]; - - /** @noinspection NotOptimalIfConditionsInspection */ - if ( - $count + 1 < $n - && \ord($s[$count + 1]) >= 48 - && \ord($s[$count + 1]) <= 57 - ) { - $count++; - $oct .= $s[$count]; - - /** @noinspection NotOptimalIfConditionsInspection */ - if ( - $count + 1 < $n - && \ord($s[$count + 1]) >= 48 - && \ord($s[$count + 1]) <= 57 - ) { - $oct .= $s[++$count]; - } - } - - $out .= \chr(\octdec($oct)); - } else { - // If the character is not one of those defined, the backslash is ignored - $out .= $s[$count]; - } - } - } - } - return $out; - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfToken.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfToken.php deleted file mode 100644 index 8293c28..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfToken.php +++ /dev/null @@ -1,43 +0,0 @@ -value = $token; - - return $v; - } - - /** - * Ensures that the passed value is a PdfToken instance. - * - * @param mixed $token - * @return self - * @throws PdfTypeException - */ - public static function ensure($token) - { - return PdfType::ensureType(self::class, $token, 'Token value expected.'); - } -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfType.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfType.php deleted file mode 100644 index ecd18b3..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfType.php +++ /dev/null @@ -1,106 +0,0 @@ -value, $parser, $stopAtIndirectObject); - } - - if ($value instanceof PdfIndirectObjectReference) { - return self::resolve($parser->getIndirectObject($value->value), $parser, $stopAtIndirectObject); - } - - return $value; - } - - /** - * Ensure that a value is an instance of a specific PDF type. - * - * @param string $type - * @param PdfType $value - * @param string $errorMessage - * @return mixed - * @throws PdfTypeException - */ - protected static function ensureType($type, $value, $errorMessage) - { - if (!($value instanceof $type)) { - throw new PdfTypeException( - $errorMessage, - PdfTypeException::INVALID_DATA_TYPE - ); - } - - return $value; - } - - /** - * Flatten indirect object references to direct objects. - * - * @param PdfType $value - * @param PdfParser $parser - * @return PdfType - * @throws CrossReferenceException - * @throws PdfParserException - */ - public static function flatten(PdfType $value, PdfParser $parser) - { - if ($value instanceof PdfIndirectObjectReference) { - return self::flatten(self::resolve($value, $parser), $parser); - } - - if ($value instanceof PdfDictionary || $value instanceof PdfArray) { - foreach ($value->value as $key => $_value) { - $value->value[$key] = self::flatten($_value, $parser); - } - } - - if ($value instanceof PdfStream) { - throw new PdfTypeException('There is a stream object found which cannot be flattened to a direct object.'); - } - - return $value; - } - - /** - * The value of the PDF type. - * - * @var mixed - */ - public $value; -} diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfTypeException.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfTypeException.php deleted file mode 100644 index 88d2c20..0000000 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfTypeException.php +++ /dev/null @@ -1,24 +0,0 @@ -value; - $ax = PdfNumeric::ensure(PdfType::resolve($array[0], $parser))->value; - $ay = PdfNumeric::ensure(PdfType::resolve($array[1], $parser))->value; - $bx = PdfNumeric::ensure(PdfType::resolve($array[2], $parser))->value; - $by = PdfNumeric::ensure(PdfType::resolve($array[3], $parser))->value; - - return new self($ax, $ay, $bx, $by); - } - - public static function byVectors(Vector $ll, Vector $ur) - { - return new self($ll->getX(), $ll->getY(), $ur->getX(), $ur->getY()); - } - - /** - * Rectangle constructor. - * - * @param float|int $ax - * @param float|int $ay - * @param float|int $bx - * @param float|int $by - */ - public function __construct($ax, $ay, $bx, $by) - { - $this->llx = \min($ax, $bx); - $this->lly = \min($ay, $by); - $this->urx = \max($ax, $bx); - $this->ury = \max($ay, $by); - } - - /** - * Get the width of the rectangle. - * - * @return float|int - */ - public function getWidth() - { - return $this->urx - $this->llx; - } - - /** - * Get the height of the rectangle. - * - * @return float|int - */ - public function getHeight() - { - return $this->ury - $this->lly; - } - - /** - * Get the lower left abscissa. - * - * @return float|int - */ - public function getLlx() - { - return $this->llx; - } - - /** - * Get the lower left ordinate. - * - * @return float|int - */ - public function getLly() - { - return $this->lly; - } - - /** - * Get the upper right abscissa. - * - * @return float|int - */ - public function getUrx() - { - return $this->urx; - } - - /** - * Get the upper right ordinate. - * - * @return float|int - */ - public function getUry() - { - return $this->ury; - } - - /** - * Get the rectangle as an array. - * - * @return array - */ - public function toArray() - { - return [ - $this->llx, - $this->lly, - $this->urx, - $this->ury - ]; - } - - /** - * Get the rectangle as a PdfArray. - * - * @return PdfArray - */ - public function toPdfArray() - { - $array = new PdfArray(); - $array->value[] = PdfNumeric::create($this->llx); - $array->value[] = PdfNumeric::create($this->lly); - $array->value[] = PdfNumeric::create($this->urx); - $array->value[] = PdfNumeric::create($this->ury); - - return $array; - } -} diff --git a/vendor/setasign/fpdi/src/PdfReader/Page.php b/vendor/setasign/fpdi/src/PdfReader/Page.php deleted file mode 100644 index ad3c0c2..0000000 --- a/vendor/setasign/fpdi/src/PdfReader/Page.php +++ /dev/null @@ -1,420 +0,0 @@ -pageObject = $page; - $this->parser = $parser; - } - - /** - * Get the indirect object of this page. - * - * @return PdfIndirectObject - */ - public function getPageObject() - { - return $this->pageObject; - } - - /** - * Get the dictionary of this page. - * - * @return PdfDictionary - * @throws PdfParserException - * @throws PdfTypeException - * @throws CrossReferenceException - */ - public function getPageDictionary() - { - if ($this->pageDictionary === null) { - $this->pageDictionary = PdfDictionary::ensure(PdfType::resolve($this->getPageObject(), $this->parser)); - } - - return $this->pageDictionary; - } - - /** - * Get a page attribute. - * - * @param string $name - * @param bool $inherited - * @return PdfType|null - * @throws PdfParserException - * @throws PdfTypeException - * @throws CrossReferenceException - */ - public function getAttribute($name, $inherited = true) - { - $dict = $this->getPageDictionary(); - - if (isset($dict->value[$name])) { - return $dict->value[$name]; - } - - $inheritedKeys = ['Resources', 'MediaBox', 'CropBox', 'Rotate']; - if ($inherited && \in_array($name, $inheritedKeys, true)) { - if ($this->inheritedAttributes === null) { - $this->inheritedAttributes = []; - $inheritedKeys = \array_filter($inheritedKeys, function ($key) use ($dict) { - return !isset($dict->value[$key]); - }); - - if (\count($inheritedKeys) > 0) { - $parentDict = PdfType::resolve(PdfDictionary::get($dict, 'Parent'), $this->parser); - while ($parentDict instanceof PdfDictionary) { - foreach ($inheritedKeys as $index => $key) { - if (isset($parentDict->value[$key])) { - $this->inheritedAttributes[$key] = $parentDict->value[$key]; - unset($inheritedKeys[$index]); - } - } - - /** @noinspection NotOptimalIfConditionsInspection */ - if (isset($parentDict->value['Parent']) && \count($inheritedKeys) > 0) { - $parentDict = PdfType::resolve(PdfDictionary::get($parentDict, 'Parent'), $this->parser); - } else { - break; - } - } - } - } - - if (isset($this->inheritedAttributes[$name])) { - return $this->inheritedAttributes[$name]; - } - } - - return null; - } - - /** - * Get the rotation value. - * - * @return int - * @throws PdfParserException - * @throws PdfTypeException - * @throws CrossReferenceException - */ - public function getRotation() - { - $rotation = $this->getAttribute('Rotate'); - if ($rotation === null) { - return 0; - } - - $rotation = PdfNumeric::ensure(PdfType::resolve($rotation, $this->parser))->value % 360; - - if ($rotation < 0) { - $rotation += 360; - } - - return $rotation; - } - - /** - * Get a boundary of this page. - * - * @param string $box - * @param bool $fallback - * @return bool|Rectangle - * @throws PdfParserException - * @throws PdfTypeException - * @throws CrossReferenceException - * @see PageBoundaries - */ - public function getBoundary($box = PageBoundaries::CROP_BOX, $fallback = true) - { - $value = $this->getAttribute($box); - - if ($value !== null) { - return Rectangle::byPdfArray($value, $this->parser); - } - - if ($fallback === false) { - return false; - } - - switch ($box) { - case PageBoundaries::BLEED_BOX: - case PageBoundaries::TRIM_BOX: - case PageBoundaries::ART_BOX: - return $this->getBoundary(PageBoundaries::CROP_BOX, true); - case PageBoundaries::CROP_BOX: - return $this->getBoundary(PageBoundaries::MEDIA_BOX, true); - } - - return false; - } - - /** - * Get the width and height of this page. - * - * @param string $box - * @param bool $fallback - * @return array|bool - * @throws PdfParserException - * @throws PdfTypeException - * @throws CrossReferenceException - */ - public function getWidthAndHeight($box = PageBoundaries::CROP_BOX, $fallback = true) - { - $boundary = $this->getBoundary($box, $fallback); - if ($boundary === false) { - return false; - } - - $rotation = $this->getRotation(); - $interchange = ($rotation / 90) % 2; - - return [ - $interchange ? $boundary->getHeight() : $boundary->getWidth(), - $interchange ? $boundary->getWidth() : $boundary->getHeight() - ]; - } - - /** - * Get the raw content stream. - * - * @return string - * @throws PdfReaderException - * @throws PdfTypeException - * @throws FilterException - * @throws PdfParserException - */ - public function getContentStream() - { - $dict = $this->getPageDictionary(); - $contents = PdfType::resolve(PdfDictionary::get($dict, 'Contents'), $this->parser); - if ($contents instanceof PdfNull) { - return ''; - } - - if ($contents instanceof PdfArray) { - $result = []; - foreach ($contents->value as $content) { - $content = PdfType::resolve($content, $this->parser); - if (!($content instanceof PdfStream)) { - continue; - } - $result[] = $content->getUnfilteredStream(); - } - - return \implode("\n", $result); - } - - if ($contents instanceof PdfStream) { - return $contents->getUnfilteredStream(); - } - - throw new PdfReaderException( - 'Array or stream expected.', - PdfReaderException::UNEXPECTED_DATA_TYPE - ); - } - - /** - * Get information of all external links on this page. - * - * All coordinates are normalized in view to rotation and translation of the boundary-box, so that their - * origin is lower-left. - * - * @return array - */ - public function getExternalLinks($box = PageBoundaries::CROP_BOX) - { - try { - $dict = $this->getPageDictionary(); - $annotations = PdfType::resolve(PdfDictionary::get($dict, 'Annots'), $this->parser); - } catch (FpdiException $e) { - return []; - } - - if (!$annotations instanceof PdfArray) { - return []; - } - - $links = []; - - foreach ($annotations->value as $entry) { - try { - $annotation = PdfType::resolve($entry, $this->parser); - - $value = PdfType::resolve(PdfDictionary::get($annotation, 'Subtype'), $this->parser); - if (!$value instanceof PdfName || $value->value !== 'Link') { - continue; - } - - $dest = PdfType::resolve(PdfDictionary::get($annotation, 'Dest'), $this->parser); - if (!$dest instanceof PdfNull) { - continue; - } - - $action = PdfType::resolve(PdfDictionary::get($annotation, 'A'), $this->parser); - if (!$action instanceof PdfDictionary) { - continue; - } - - $actionType = PdfType::resolve(PdfDictionary::get($action, 'S'), $this->parser); - if (!$actionType instanceof PdfName || $actionType->value !== 'URI') { - continue; - } - - $uri = PdfType::resolve(PdfDictionary::get($action, 'URI'), $this->parser); - if ($uri instanceof PdfString) { - $uriValue = PdfString::unescape($uri->value); - } elseif ($uri instanceof PdfHexString) { - $uriValue = \hex2bin($uri->value); - } else { - continue; - } - - $rect = PdfType::resolve(PdfDictionary::get($annotation, 'Rect'), $this->parser); - if (!$rect instanceof PdfArray || count($rect->value) !== 4) { - continue; - } - - $rect = Rectangle::byPdfArray($rect, $this->parser); - if ($rect->getWidth() === 0 || $rect->getHeight() === 0) { - continue; - } - - $bbox = $this->getBoundary($box); - $rotation = $this->getRotation(); - - $gs = new GraphicsState(); - $gs->translate(-$bbox->getLlx(), -$bbox->getLly()); - $gs->rotate($bbox->getLlx(), $bbox->getLly(), -$rotation); - - switch ($rotation) { - case 90: - $gs->translate(-$bbox->getWidth(), 0); - break; - case 180: - $gs->translate(-$bbox->getWidth(), -$bbox->getHeight()); - break; - case 270: - $gs->translate(0, -$bbox->getHeight()); - break; - } - - $normalizedRect = Rectangle::byVectors( - $gs->toUserSpace(new Vector($rect->getLlx(), $rect->getLly())), - $gs->toUserSpace(new Vector($rect->getUrx(), $rect->getUry())) - ); - - $quadPoints = PdfType::resolve(PdfDictionary::get($annotation, 'QuadPoints'), $this->parser); - $normalizedQuadPoints = []; - if ($quadPoints instanceof PdfArray) { - $quadPointsCount = count($quadPoints->value); - if ($quadPointsCount % 8 === 0) { - for ($i = 0; ($i + 1) < $quadPointsCount; $i += 2) { - $x = PdfNumeric::ensure(PdfType::resolve($quadPoints->value[$i], $this->parser)); - $y = PdfNumeric::ensure(PdfType::resolve($quadPoints->value[$i + 1], $this->parser)); - - $v = $gs->toUserSpace(new Vector($x->value, $y->value)); - $normalizedQuadPoints[] = $v->getX(); - $normalizedQuadPoints[] = $v->getY(); - } - } - } - - // we remove unsupported/unneeded values here - unset( - $annotation->value['P'], - $annotation->value['NM'], - $annotation->value['AP'], - $annotation->value['AS'], - $annotation->value['Type'], - $annotation->value['Subtype'], - $annotation->value['Rect'], - $annotation->value['A'], - $annotation->value['QuadPoints'], - $annotation->value['Rotate'], - $annotation->value['M'], - $annotation->value['StructParent'], - $annotation->value['OC'] - ); - - // ...and flatten the PDF object to eliminate any indirect references. - // Indirect references are a problem when writing the output in FPDF - // because FPDF uses pre-calculated object numbers while FPDI creates - // them at runtime. - $annotation = PdfType::flatten($annotation, $this->parser); - - $links[] = [ - 'rect' => $normalizedRect, - 'quadPoints' => $normalizedQuadPoints, - 'uri' => $uriValue, - 'pdfObject' => $annotation - ]; - } catch (FpdiException $e) { - continue; - } - } - - return $links; - } -} diff --git a/vendor/setasign/fpdi/src/PdfReader/PageBoundaries.php b/vendor/setasign/fpdi/src/PdfReader/PageBoundaries.php deleted file mode 100644 index ec24cde..0000000 --- a/vendor/setasign/fpdi/src/PdfReader/PageBoundaries.php +++ /dev/null @@ -1,94 +0,0 @@ -parser = $parser; - } - - /** - * PdfReader destructor. - */ - public function __destruct() - { - if ($this->parser !== null) { - $this->parser->cleanUp(); - } - } - - /** - * Get the pdf parser instance. - * - * @return PdfParser - */ - public function getParser() - { - return $this->parser; - } - - /** - * Get the PDF version. - * - * @return string - * @throws PdfParserException - */ - public function getPdfVersion() - { - return \implode('.', $this->parser->getPdfVersion()); - } - - /** - * Get the page count. - * - * @return int - * @throws PdfTypeException - * @throws CrossReferenceException - * @throws PdfParserException - */ - public function getPageCount() - { - if ($this->pageCount === null) { - $catalog = $this->parser->getCatalog(); - - $pages = PdfType::resolve(PdfDictionary::get($catalog, 'Pages'), $this->parser); - $count = PdfType::resolve(PdfDictionary::get($pages, 'Count'), $this->parser); - - $this->pageCount = PdfNumeric::ensure($count)->value; - } - - return $this->pageCount; - } - - /** - * Get a page instance. - * - * @param int $pageNumber - * @return Page - * @throws PdfTypeException - * @throws CrossReferenceException - * @throws PdfParserException - * @throws \InvalidArgumentException - */ - public function getPage($pageNumber) - { - if (!\is_numeric($pageNumber)) { - throw new \InvalidArgumentException( - 'Page number needs to be a number.' - ); - } - - if ($pageNumber < 1 || $pageNumber > $this->getPageCount()) { - throw new \InvalidArgumentException( - \sprintf( - 'Page number "%s" out of available page range (1 - %s)', - $pageNumber, - $this->getPageCount() - ) - ); - } - - $this->readPages(); - - $page = $this->pages[$pageNumber - 1]; - - if ($page instanceof PdfIndirectObjectReference) { - $readPages = function ($kids) use (&$readPages) { - $kids = PdfArray::ensure($kids); - - /** @noinspection LoopWhichDoesNotLoopInspection */ - foreach ($kids->value as $reference) { - $reference = PdfIndirectObjectReference::ensure($reference); - $object = $this->parser->getIndirectObject($reference->value); - $type = PdfDictionary::get($object->value, 'Type'); - - if ($type->value === 'Pages') { - return $readPages(PdfDictionary::get($object->value, 'Kids')); - } - - return $object; - } - - throw new PdfReaderException( - 'Kids array cannot be empty.', - PdfReaderException::KIDS_EMPTY - ); - }; - - $page = $this->parser->getIndirectObject($page->value); - $dict = PdfType::resolve($page, $this->parser); - $type = PdfDictionary::get($dict, 'Type'); - - if ($type->value === 'Pages') { - $kids = PdfType::resolve(PdfDictionary::get($dict, 'Kids'), $this->parser); - try { - $page = $this->pages[$pageNumber - 1] = $readPages($kids); - } catch (PdfReaderException $e) { - if ($e->getCode() !== PdfReaderException::KIDS_EMPTY) { - throw $e; - } - - // let's reset the pages array and read all page objects - $this->pages = []; - $this->readPages(true); - // @phpstan-ignore-next-line - $page = $this->pages[$pageNumber - 1]; - } - } else { - $this->pages[$pageNumber - 1] = $page; - } - } - - return new Page($page, $this->parser); - } - - /** - * Walk the page tree and resolve all indirect objects of all pages. - * - * @param bool $readAll - * @throws CrossReferenceException - * @throws PdfParserException - * @throws PdfTypeException - */ - protected function readPages($readAll = false) - { - if (\count($this->pages) > 0) { - return; - } - - $expectedPageCount = $this->getPageCount(); - $readPages = function ($kids, $count) use (&$readPages, $readAll, $expectedPageCount) { - $kids = PdfArray::ensure($kids); - $isLeaf = ($count->value === \count($kids->value)); - - foreach ($kids->value as $reference) { - $reference = PdfIndirectObjectReference::ensure($reference); - - if (!$readAll && $isLeaf) { - $this->pages[] = $reference; - continue; - } - - $object = $this->parser->getIndirectObject($reference->value); - $type = PdfDictionary::get($object->value, 'Type'); - - if ($type->value === 'Pages') { - $readPages(PdfDictionary::get($object->value, 'Kids'), PdfDictionary::get($object->value, 'Count')); - } else { - $this->pages[] = $object; - } - - // stop if all pages are read - faulty documents exists with additional entries with invalid data. - if (count($this->pages) === $expectedPageCount) { - break; - } - } - }; - - $catalog = $this->parser->getCatalog(); - $pages = PdfType::resolve(PdfDictionary::get($catalog, 'Pages'), $this->parser); - $count = PdfType::resolve(PdfDictionary::get($pages, 'Count'), $this->parser); - $kids = PdfType::resolve(PdfDictionary::get($pages, 'Kids'), $this->parser); - $readPages($kids, $count); - } -} diff --git a/vendor/setasign/fpdi/src/PdfReader/PdfReaderException.php b/vendor/setasign/fpdi/src/PdfReader/PdfReaderException.php deleted file mode 100644 index 2b3487e..0000000 --- a/vendor/setasign/fpdi/src/PdfReader/PdfReaderException.php +++ /dev/null @@ -1,34 +0,0 @@ -cleanUp(); - } - - /** - * Get the next template id. - * - * @return int - */ - protected function getNextTemplateId() - { - return $this->templateId++; - } - - /** - * Draws an imported page onto the page or another template. - * - * Give only one of the size parameters (width, height) to calculate the other one automatically in view to the - * aspect ratio. - * - * @param mixed $tpl The template id - * @param float|int|array $x The abscissa of upper-left corner. Alternatively you could use an assoc array - * with the keys "x", "y", "width", "height", "adjustPageSize". - * @param float|int $y The ordinate of upper-left corner. - * @param float|int|null $width The width. - * @param float|int|null $height The height. - * @param bool $adjustPageSize - * @return array The size - * @see FpdiTrait::getTemplateSize() - */ - public function useTemplate($tpl, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false) - { - return $this->useImportedPage($tpl, $x, $y, $width, $height, $adjustPageSize); - } - - /** - * Draws an imported page onto the page. - * - * Give only one of the size parameters (width, height) to calculate the other one automatically in view to the - * aspect ratio. - * - * @param mixed $pageId The page id - * @param float|int|array $x The abscissa of upper-left corner. Alternatively you could use an assoc array - * with the keys "x", "y", "width", "height", "adjustPageSize". - * @param float|int $y The ordinate of upper-left corner. - * @param float|int|null $width The width. - * @param float|int|null $height The height. - * @param bool $adjustPageSize - * @return array The size. - * @see Fpdi::getTemplateSize() - */ - public function useImportedPage($pageId, $x = 0, $y = 0, $width = null, $height = null, $adjustPageSize = false) - { - $size = $this->fpdiUseImportedPage($pageId, $x, $y, $width, $height, $adjustPageSize); - if ($this->inxobj) { - $importedPage = $this->importedPages[$pageId]; - $this->xobjects[$this->xobjid]['importedPages'][$importedPage['id']] = $pageId; - } - - return $size; - } - - /** - * Get the size of an imported page. - * - * Give only one of the size parameters (width, height) to calculate the other one automatically in view to the - * aspect ratio. - * - * @param mixed $tpl The template id - * @param float|int|null $width The width. - * @param float|int|null $height The height. - * @return array|bool An array with following keys: width, height, 0 (=width), 1 (=height), orientation (L or P) - */ - public function getTemplateSize($tpl, $width = null, $height = null) - { - return $this->getImportedPageSize($tpl, $width, $height); - } - - /** - * @inheritdoc - * @return string - */ - protected function _getxobjectdict() - { - $out = parent::_getxobjectdict(); - - foreach ($this->importedPages as $pageData) { - $out .= '/' . $pageData['id'] . ' ' . $pageData['objectNumber'] . ' 0 R '; - } - - return $out; - } - - /** - * @inheritdoc - * @throws CrossReferenceException - * @throws PdfParserException - */ - protected function _putxobjects() - { - foreach ($this->importedPages as $key => $pageData) { - $this->currentObjectNumber = $this->_newobj(); - $this->importedPages[$key]['objectNumber'] = $this->currentObjectNumber; - $this->currentReaderId = $pageData['readerId']; - $this->writePdfType($pageData['stream']); - $this->_put('endobj'); - } - - foreach (\array_keys($this->readers) as $readerId) { - $parser = $this->getPdfReader($readerId)->getParser(); - $this->currentReaderId = $readerId; - - while (($objectNumber = \array_pop($this->objectsToCopy[$readerId])) !== null) { - try { - $object = $parser->getIndirectObject($objectNumber); - } catch (CrossReferenceException $e) { - if ($e->getCode() === CrossReferenceException::OBJECT_NOT_FOUND) { - $object = PdfIndirectObject::create($objectNumber, 0, new PdfNull()); - } else { - throw $e; - } - } - - $this->writePdfType($object); - } - } - - // let's prepare resources for imported pages in templates - foreach ($this->xobjects as $xObjectId => $data) { - if (!isset($data['importedPages'])) { - continue; - } - - foreach ($data['importedPages'] as $id => $pageKey) { - $page = $this->importedPages[$pageKey]; - $this->xobjects[$xObjectId]['xobjects'][$id] = ['n' => $page['objectNumber']]; - } - } - - - parent::_putxobjects(); - $this->currentObjectNumber = null; - } - - /** - * Append content to the buffer of TCPDF. - * - * @param string $s - * @param bool $newLine - */ - protected function _put($s, $newLine = true) - { - if ($newLine) { - $this->setBuffer($s . "\n"); - } else { - $this->setBuffer($s); - } - } - - /** - * Begin a new object and return the object number. - * - * @param int|string $objid Object ID (leave empty to get a new ID). - * @return int object number - */ - protected function _newobj($objid = '') - { - $this->_out($this->_getobj($objid)); - return $this->n; - } - - /** - * Writes a PdfType object to the resulting buffer. - * - * @param PdfType $value - * @throws PdfTypeException - */ - protected function writePdfType(PdfType $value) - { - if (!$this->encrypted) { - $this->fpdiWritePdfType($value); - return; - } - - if ($value instanceof PdfString) { - $string = PdfString::unescape($value->value); - $string = $this->_encrypt_data($this->currentObjectNumber, $string); - $value->value = PdfString::escape($string); - } elseif ($value instanceof PdfHexString) { - $filter = new AsciiHex(); - $string = $filter->decode($value->value); - $string = $this->_encrypt_data($this->currentObjectNumber, $string); - $value->value = $filter->encode($string, true); - } elseif ($value instanceof PdfStream) { - $stream = $value->getStream(); - $stream = $this->_encrypt_data($this->currentObjectNumber, $stream); - $dictionary = $value->value; - $dictionary->value['Length'] = PdfNumeric::create(\strlen($stream)); - $value = PdfStream::create($dictionary, $stream); - } elseif ($value instanceof PdfIndirectObject) { - /** - * @var PdfIndirectObject $value - */ - $this->currentObjectNumber = $this->objectMap[$this->currentReaderId][$value->objectNumber]; - } - - $this->fpdiWritePdfType($value); - } - - /** - * This method will add additional data to the last created link/annotation. - * - * It will copy styling properties (supported by TCPDF) of the imported link. - * - * @param array $externalLink - * @param float|int $xPt - * @param float|int $scaleX - * @param float|int $yPt - * @param float|int $newHeightPt - * @param float|int $scaleY - * @param array $importedPage - * @return void - */ - protected function adjustLastLink($externalLink, $xPt, $scaleX, $yPt, $newHeightPt, $scaleY, $importedPage) - { - $parser = $this->getPdfReader($importedPage['readerId'])->getParser(); - - if ($this->inxobj) { - // store parameters for later use on template - $lastAnnotationKey = count($this->xobjects[$this->xobjid]['annotations']) - 1; - $lastAnnotationOpt = &$this->xobjects[$this->xobjid]['annotations'][$lastAnnotationKey]['opt']; - } else { - $lastAnnotationKey = count($this->PageAnnots[$this->page]) - 1; - $lastAnnotationOpt = &$this->PageAnnots[$this->page][$lastAnnotationKey]['opt']; - } - - // ensure we have a default value - otherwise TCPDF will set it to 4 throughout - $lastAnnotationOpt['f'] = 0; - - // values in this dictonary are all direct objects and we don't need to resolve them here again. - $values = $externalLink['pdfObject']->value; - - foreach ($values as $key => $value) { - try { - switch ($key) { - case 'BS': - $value = PdfDictionary::ensure($value); - $bs = []; - if (isset($value->value['W'])) { - $bs['w'] = PdfNumeric::ensure($value->value['W'])->value; - } - - if (isset($value->value['S'])) { - $bs['s'] = PdfName::ensure($value->value['S'])->value; - } - - if (isset($value->value['D'])) { - $d = []; - foreach (PdfArray::ensure($value->value['D'])->value as $item) { - $d[] = PdfNumeric::ensure($item)->value; - } - $bs['d'] = $d; - } - - $lastAnnotationOpt['bs'] = $bs; - break; - - case 'Border': - $borderArray = PdfArray::ensure($value)->value; - if (count($borderArray) < 3) { - continue 2; - } - - $border = [ - PdfNumeric::ensure($borderArray[0])->value, - PdfNumeric::ensure($borderArray[1])->value, - PdfNumeric::ensure($borderArray[2])->value, - ]; - if (isset($borderArray[3])) { - $dashArray = []; - foreach (PdfArray::ensure($borderArray[3])->value as $item) { - $dashArray[] = PdfNumeric::ensure($item)->value; - } - $border[] = $dashArray; - } - - $lastAnnotationOpt['border'] = $border; - break; - - case 'C': - $c = []; - $colors = PdfArray::ensure(PdfType::resolve($value, $parser))->value; - $m = count($colors) === 4 ? 100 : 255; - foreach ($colors as $item) { - $c[] = PdfNumeric::ensure($item)->value * $m; - } - $lastAnnotationOpt['c'] = $c; - break; - - case 'F': - $lastAnnotationOpt['f'] = $value->value; - break; - - case 'BE': - // is broken in current TCPDF version: "bc" key is checked but "bs" is used. - break; - } - // let's silence invalid/not supported values - } catch (FpdiException $e) { - continue; - } - } - - // QuadPoints are not supported by TCPDF -// if (count($externalLink['quadPoints']) > 0) { -// $quadPoints = []; -// for ($i = 0, $n = count($externalLink['quadPoints']); $i < $n; $i += 2) { -// $quadPoints[] = $xPt + $externalLink['quadPoints'][$i] * $scaleX; -// $quadPoints[] = $this->hPt - $yPt - $newHeightPt + $externalLink['quadPoints'][$i + 1] * $scaleY; -// } -// -// ????? = $quadPoints; -// } - } -} diff --git a/vendor/setasign/fpdi/src/TcpdfFpdi.php b/vendor/setasign/fpdi/src/TcpdfFpdi.php deleted file mode 100644 index 8f3c095..0000000 --- a/vendor/setasign/fpdi/src/TcpdfFpdi.php +++ /dev/null @@ -1,23 +0,0 @@ - -* **copyright** 2002-2024 Nicola Asuni - Tecnick.com LTD +* **copyright** 2002-2025 Nicola Asuni - Tecnick.com LTD * **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT) * **link** http://www.tcpdf.org * **source** https://github.com/tecnickcom/TCPDF diff --git a/vendor/tecnickcom/tcpdf/VERSION b/vendor/tecnickcom/tcpdf/VERSION index c56facf..cf79bf9 100644 --- a/vendor/tecnickcom/tcpdf/VERSION +++ b/vendor/tecnickcom/tcpdf/VERSION @@ -1 +1 @@ -6.7.5 +6.10.0 diff --git a/vendor/tecnickcom/tcpdf/composer.json b/vendor/tecnickcom/tcpdf/composer.json index 7389d09..8d77919 100644 --- a/vendor/tecnickcom/tcpdf/composer.json +++ b/vendor/tecnickcom/tcpdf/composer.json @@ -12,7 +12,7 @@ "barcodes" ], "homepage": "http://www.tcpdf.org/", - "version": "6.7.5", + "version": "6.10.0", "license": "LGPL-3.0-or-later", "authors": [ { @@ -22,15 +22,14 @@ } ], "require": { - "php": ">=5.5.0" + "php": ">=7.1.0", + "ext-curl": "*" }, "autoload": { "classmap": [ "config", "include", "tcpdf.php", - "tcpdf_parser.php", - "tcpdf_import.php", "tcpdf_barcodes_1d.php", "tcpdf_barcodes_2d.php", "include/tcpdf_colors.php", @@ -43,10 +42,5 @@ "include/barcodes/pdf417.php", "include/barcodes/qrcode.php" ] - }, - "archive": { - "exclude": [ - "/examples" - ] } } diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_html.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_html.php deleted file mode 100644 index 6d3233b..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_html.php +++ /dev/null @@ -1,57 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_1d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_1d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.000 - * @group barcode - * @group 1d - * @group html - * @group comparable - */ - -// include 1D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128'); - -// output the barcode as HTML object -echo $barcodeobj->getBarcodeHTML(2, 30, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_png.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_png.php deleted file mode 100644 index 02ed166..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_png.php +++ /dev/null @@ -1,56 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_1d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_1d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.000 - * @group barcode - * @group 1d - * @group png - */ - -// include 1D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128'); - -// output the barcode as PNG image -$barcodeobj->getBarcodePNG(2, 30, array(0,0,0)); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_svg.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_svg.php deleted file mode 100644 index 5e5ccfc..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_svg.php +++ /dev/null @@ -1,57 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_1d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_1d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.000 - * @group barcode - * @group 1d - * @group svg - * @group comparable - */ - -// include 1D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128'); - -// output the barcode as SVG image -$barcodeobj->getBarcodeSVG(2, 30, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_svgi.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_svgi.php deleted file mode 100644 index 8c65b66..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_1d_svgi.php +++ /dev/null @@ -1,57 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_1d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_1d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.000 - * @group barcode - * @group 1d - * @group svg - * @group comparable - */ - -// include 1D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_1d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128'); - -// output the barcode as SVG inline code -echo $barcodeobj->getBarcodeSVGcode(2, 40, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_html.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_html.php deleted file mode 100644 index e0d200c..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_html.php +++ /dev/null @@ -1,57 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group datamatrix - * @group html - * @group comparable - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX'); - -// output the barcode as HTML object -echo $barcodeobj->getBarcodeHTML(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_png.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_png.php deleted file mode 100644 index 35d344d..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_png.php +++ /dev/null @@ -1,56 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group datamatrix - * @group png - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX'); - -// output the barcode as PNG image -$barcodeobj->getBarcodePNG(6, 6, array(0,0,0)); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svg.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svg.php deleted file mode 100644 index 10d0aa3..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svg.php +++ /dev/null @@ -1,57 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group datamatrix - * @group svg - * @group comparable - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX'); - -// output the barcode as SVG image -$barcodeobj->getBarcodeSVG(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svgi.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svgi.php deleted file mode 100644 index 4262700..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_datamatrix_svgi.php +++ /dev/null @@ -1,57 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group datamatrix - * @group svg - * @group comparable - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'DATAMATRIX'); - -// output the barcode as SVG inline code -echo $barcodeobj->getBarcodeSVGcode(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_html.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_html.php deleted file mode 100644 index 3d8de31..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_html.php +++ /dev/null @@ -1,57 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group pdf417 - * @group html - * @group comparable - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417'); - -// output the barcode as HTML object -echo $barcodeobj->getBarcodeHTML(4, 4, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_png.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_png.php deleted file mode 100644 index b7c9585..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_png.php +++ /dev/null @@ -1,56 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group pdf417 - * @group png - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417'); - -// output the barcode as PNG image -$barcodeobj->getBarcodePNG(4, 4, array(0,0,0)); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svg.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svg.php deleted file mode 100644 index 9017e5b..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svg.php +++ /dev/null @@ -1,57 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group pdf417 - * @group svg - * @group comparable - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417'); - -// output the barcode as SVG image -$barcodeobj->getBarcodeSVG(4, 4, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svgi.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svgi.php deleted file mode 100644 index 2075da7..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_svgi.php +++ /dev/null @@ -1,57 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group pdf417 - * @group svg - * @group comparable - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'PDF417'); - -// output the barcode as SVG inline code -echo $barcodeobj->getBarcodeSVGcode(4, 4, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_html.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_html.php deleted file mode 100644 index 7c05f00..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_html.php +++ /dev/null @@ -1,56 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group qrcode - * @group html - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H'); - -// output the barcode as HTML object -echo $barcodeobj->getBarcodeHTML(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_png.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_png.php deleted file mode 100644 index 75daa7c..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_png.php +++ /dev/null @@ -1,56 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group qrcode - * @group png - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H'); - -// output the barcode as PNG image -$barcodeobj->getBarcodePNG(6, 6, array(0,0,0)); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svg.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svg.php deleted file mode 100644 index c104ca6..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svg.php +++ /dev/null @@ -1,56 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group qrcode - * @group svg - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H'); - -// output the barcode as SVG image -$barcodeobj->getBarcodeSVG(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svgi.php b/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svgi.php deleted file mode 100644 index f31a100..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svgi.php +++ /dev/null @@ -1,56 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : Example for tcpdf_barcodes_2d.php class -// -//============================================================+ - -/** - * @file - * Example for tcpdf_barcodes_2d.php class - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.009 - * @group barcode - * @group qrcode - * @group svg - */ - -// include 2D barcode class (search for installation path) -require_once(dirname(__FILE__).'/tcpdf_barcodes_2d_include.php'); - -// set the barcode content and type -$barcodeobj = new TCPDF2DBarcode('http://www.tcpdf.org', 'QRCODE,H'); - -// output the barcode as SVG inline code -echo $barcodeobj->getBarcodeSVGcode(6, 6, 'black'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/barcodes/tcpdf_barcodes_1d_include.php b/vendor/tecnickcom/tcpdf/examples/barcodes/tcpdf_barcodes_1d_include.php deleted file mode 100644 index 0add5ec..0000000 --- a/vendor/tecnickcom/tcpdf/examples/barcodes/tcpdf_barcodes_1d_include.php +++ /dev/null @@ -1,46 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -//============================================================+ - -/** - * Example of alternative configuration file for TCPDF. - * @author Nicola Asuni - * @package com.tecnick.tcpdf - * @version 4.9.005 - * @since 2004-10-27 - */ - -/** - * Define the following constant to ignore the default configuration file. - */ -define ('K_TCPDF_EXTERNAL_CONFIG', true); - -/** - * Installation path (/var/www/tcpdf/). - * By default it is automatically calculated but you can also set it as a fixed string to improve performances. - */ -//define ('K_PATH_MAIN', ''); - -/** - * URL path to tcpdf installation folder (http://localhost/tcpdf/). - * By default it is automatically set but you can also set it as a fixed string to improve performances. - */ -//define ('K_PATH_URL', ''); - -/** - * Path for PDF fonts. - * By default it is automatically set but you can also set it as a fixed string to improve performances. - */ -//define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); - -/** - * Default images directory. - * By default it is automatically set but you can also set it as a fixed string to improve performances. - */ -define ('K_PATH_IMAGES', dirname(__FILE__).'/../images/'); - -/** - * Deafult image logo used be the default Header() method. - * Please set here your own logo or an empty string to disable it. - */ -define ('PDF_HEADER_LOGO', 'tcpdf_logo.jpg'); - -/** - * Header logo image width in user units. - */ -define ('PDF_HEADER_LOGO_WIDTH', 30); - -/** - * Cache directory for temporary files (full path). - */ -define ('K_PATH_CACHE', sys_get_temp_dir().'/'); - -/** - * Generic name for a blank image. - */ -define ('K_BLANK_IMAGE', '_blank.png'); - -/** - * Page format. - */ -define ('PDF_PAGE_FORMAT', 'A4'); - -/** - * Page orientation (P=portrait, L=landscape). - */ -define ('PDF_PAGE_ORIENTATION', 'P'); - -/** - * Document creator. - */ -define ('PDF_CREATOR', 'TCPDF'); - -/** - * Document author. - */ -define ('PDF_AUTHOR', 'TCPDF'); - -/** - * Header title. - */ -define ('PDF_HEADER_TITLE', 'TCPDF Example'); - -/** - * Header description string. - */ -define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org"); - -/** - * Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]. - */ -define ('PDF_UNIT', 'mm'); - -/** - * Header margin. - */ -define ('PDF_MARGIN_HEADER', 5); - -/** - * Footer margin. - */ -define ('PDF_MARGIN_FOOTER', 10); - -/** - * Top margin. - */ -define ('PDF_MARGIN_TOP', 27); - -/** - * Bottom margin. - */ -define ('PDF_MARGIN_BOTTOM', 25); - -/** - * Left margin. - */ -define ('PDF_MARGIN_LEFT', 15); - -/** - * Right margin. - */ -define ('PDF_MARGIN_RIGHT', 15); - -/** - * Default main font name. - */ -define ('PDF_FONT_NAME_MAIN', 'helvetica'); - -/** - * Default main font size. - */ -define ('PDF_FONT_SIZE_MAIN', 10); - -/** - * Default data font name. - */ -define ('PDF_FONT_NAME_DATA', 'helvetica'); - -/** - * Default data font size. - */ -define ('PDF_FONT_SIZE_DATA', 8); - -/** - * Default monospaced font name. - */ -define ('PDF_FONT_MONOSPACED', 'courier'); - -/** - * Ratio used to adjust the conversion of pixels to user units. - */ -define ('PDF_IMAGE_SCALE_RATIO', 1.25); - -/** - * Magnification factor for titles. - */ -define('HEAD_MAGNIFICATION', 1.1); - -/** - * Height of cell respect font height. - */ -define('K_CELL_HEIGHT_RATIO', 1.25); - -/** - * Title magnification respect main font size. - */ -define('K_TITLE_MAGNIFICATION', 1.3); - -/** - * Reduction factor for small font. - */ -define('K_SMALL_RATIO', 2/3); - -/** - * Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language. - */ -define('K_THAI_TOPCHARS', true); - -/** - * If true allows to call TCPDF methods using HTML syntax - * IMPORTANT: For security reason, disable this feature if you are printing user HTML content. - */ -define('K_TCPDF_CALLS_IN_HTML', true); - -/** - * List of TCPDF methods that are allowed to be called using HTML syntax. - * Note: each method name must end with surrounded with | (pipe) character. - * The constant K_TCPDF_CALLS_IN_HTML must be set to true. - * IMPORTANT: For security reason, disable this feature if you are allowing user HTML content. - */ -define('K_ALLOWED_TCPDF_TAGS', '|AddPage|Rect|SetDrawColor|write1DBarcode|'); - -/** - * If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution. - */ -define('K_TCPDF_THROW_EXCEPTION_ERROR', false); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.crt b/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.crt deleted file mode 100644 index f049139..0000000 --- a/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.crt +++ /dev/null @@ -1,40 +0,0 @@ -Bag Attributes - localKeyID: 7B AB 1B 7A BE 4C 85 C0 1A A6 DC 59 3F 79 48 C3 93 38 68 9C -subject=/CN=TCPDF DEMO/O=TCPDF/OU=DEMO/emailAddress=you@example.com/C=IT -issuer=/CN=TCPDF DEMO/O=TCPDF/OU=DEMO/emailAddress=you@example.com/C=IT ------BEGIN CERTIFICATE----- -MIIC1TCCAj6gAwIBAgIKkehOL/XGkB5cjjANBgkqhkiG9w0BAQUFADBhMRMwEQYD -VQQDEwpUQ1BERiBERU1PMQ4wDAYDVQQKEwVUQ1BERjENMAsGA1UECxMEREVNTzEe -MBwGCSqGSIb3DQEJARYPeW91QGV4YW1wbGUuY29tMQswCQYDVQQGEwJJVDAeFw0w -OTA4MjExMjU0NDhaFw0xNDA4MjExMjU0NDhaMGExEzARBgNVBAMTClRDUERGIERF -TU8xDjAMBgNVBAoTBVRDUERGMQ0wCwYDVQQLEwRERU1PMR4wHAYJKoZIhvcNAQkB -Fg95b3VAZXhhbXBsZS5jb20xCzAJBgNVBAYTAklUMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDAqIL0uGKmTR98Lxx2vEEE1OGKkMXFo0JViitALe7Onhxxqx0H -XMUDKF5mvEVu1rcvh7/oAnAfrCuEpL/up3u1mQCgBE7WXBnFFE/AE3jCksh9OkS0 -Z0Xj9woN5bzxRDsGoPiOu/4xzk5qSEXt8jf2Ep90QuNkqLIRT4swAzpDbwIDAQAB -o4GTMIGQMDcGA1UdEgQwMC6gEQYDVQQDDApUQ1BERiBERU1PoAwGA1UECgwFVENQ -REagCwYDVQQLDARERU1PMDcGA1UdEQQwMC6gEQYDVQQDDApUQ1BERiBERU1PoAwG -A1UECgwFVENQREagCwYDVQQLDARERU1PMA8GCSqGSIb3LwEBCgQCBQAwCwYDVR0P -BAQDAgSQMA0GCSqGSIb3DQEBBQUAA4GBAEhTQfqX3ZNdHmpTLDbIj22RHXii2roE -OavCbu9WsHoWpva0qSd+yIoD594VHvYAd29sfzDfiN+7W0aiZfDhq5jpaSQMVlN8 -RGYMupbHY/+a9Gz1wqxnR84mlTtIkZVRYAhsfPwy6M1BEjdMqfdh9h40JIdkdjtb -8faTCfXPePWQ ------END CERTIFICATE----- -Bag Attributes - localKeyID: 7B AB 1B 7A BE 4C 85 C0 1A A6 DC 59 3F 79 48 C3 93 38 68 9C -Key Attributes: ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDAqIL0uGKmTR98Lxx2vEEE1OGKkMXFo0JViitALe7Onhxxqx0H -XMUDKF5mvEVu1rcvh7/oAnAfrCuEpL/up3u1mQCgBE7WXBnFFE/AE3jCksh9OkS0 -Z0Xj9woN5bzxRDsGoPiOu/4xzk5qSEXt8jf2Ep90QuNkqLIRT4swAzpDbwIDAQAB -AoGAXc+wNMmz/5Z+RlIKYia44klmqbplEx+0JULqXI4BQsrqvs67i+I4bJkznoL+ -rEIRYSuQ3sCRKFsFtckjTGpxadnxkB+uwGKc6pZChv99BFX6HFR4hgBlT/BBRAQA -hMDlM2JIRr4S4SMVXR7MHwGMUf9mUeanGLR3ZWtU3aXJrIECQQD7OaYUVYNEEnM9 -uXyjm22CuHyqyEf5gb13sK0uQty67547yJTMUQZd/sQc9KGwhzBbhrob2LO2jAhh -S+f+NSRnAkEAxFHm3fMI5RgXmswxlGm4QW07a/Ueo7ZJG6xjTkFXluJhd+XHswRD -dQIO3zG9nGjNUoeMrPhXhPvKqFc2F9RDuQJAQBEGin74N77gxqfr4ik79y8nE8J5 -oGZ2s/RJZdfFRKLg3mwbjjNHhWb4Ck5UgZkoOt8TzRApXG8/n9hktE5HFwJBALur -M5AueO1Pl5kB489lNJ9OxUQRYUXMxpxuscuoCQwSwmv0O2+0/qtG2WKhUQnI4aYo -L+FV0YwtivBb1jj3T/kCQQDIWOxq8eRowdaMzvJpRUHFgMcf1AVZExKyrugwYOWd -KNsDxC4KaQOsPt8iT/Ulo4g/MJC0HolCOhWibKmR9Ayl ------END RSA PRIVATE KEY----- diff --git a/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.fdf b/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.fdf deleted file mode 100644 index a8f7c35..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.fdf and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.p12 b/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.p12 deleted file mode 100644 index 611f0df..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.p12 and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/data/chapter_demo_1.txt b/vendor/tecnickcom/tcpdf/examples/data/chapter_demo_1.txt deleted file mode 100644 index 4025de9..0000000 --- a/vendor/tecnickcom/tcpdf/examples/data/chapter_demo_1.txt +++ /dev/null @@ -1,19 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. - -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa. - -Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu. - -Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra. - -Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat. - -Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. - -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa. - -Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu. - -Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra. - -Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat. diff --git a/vendor/tecnickcom/tcpdf/examples/data/chapter_demo_2.txt b/vendor/tecnickcom/tcpdf/examples/data/chapter_demo_2.txt deleted file mode 100644 index a0210ff..0000000 --- a/vendor/tecnickcom/tcpdf/examples/data/chapter_demo_2.txt +++ /dev/null @@ -1,23 +0,0 @@ -

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.

- - - -

Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.

- -

Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.

- -

Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.

- -

Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.

- -

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.

- - - -

Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.

- -

Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.

- -

Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.

- -

Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.

diff --git a/vendor/tecnickcom/tcpdf/examples/data/table_data_demo.txt b/vendor/tecnickcom/tcpdf/examples/data/table_data_demo.txt deleted file mode 100644 index 5a48a42..0000000 --- a/vendor/tecnickcom/tcpdf/examples/data/table_data_demo.txt +++ /dev/null @@ -1,15 +0,0 @@ -Austria;Vienna;83859;8075 -Belgium;Brussels;30518;10192 -Denmark;Copenhagen;43094;5295 -Finland;Helsinki;304529;5147 -France;Paris;543965;58728 -Germany;Berlin;357022;82057 -Greece;Athens;131625;10511 -Ireland;Dublin;70723;3694 -Italy;Roma;301316;57563 -Luxembourg;Luxembourg;2586;424 -Netherlands;Amsterdam;41526;15654 -Portugal;Lisbon;91906;9957 -Spain;Madrid;504790;39348 -Sweden;Stockholm;410934;8839 -United Kingdom;London;243820;58862 diff --git a/vendor/tecnickcom/tcpdf/examples/data/utf8test.txt b/vendor/tecnickcom/tcpdf/examples/data/utf8test.txt deleted file mode 100644 index 291d4e7..0000000 --- a/vendor/tecnickcom/tcpdf/examples/data/utf8test.txt +++ /dev/null @@ -1,128 +0,0 @@ -Sentences that contain all letters commonly used in a language --------------------------------------------------------------- - -This file is UTF-8 encoded. - -Czech (cz) ---------- - - Příšerně žluťoučký kůň úpěl ďábelské ódy. - Hleď, toť přízračný kůň v mátožné póze šíleně úpí. - Zvlášť zákeřný učeň s ďolíčky běží podél zóny úlů. - Loď čeří kýlem tůň obzvlášť v Grónské úžině. - Ó, náhlý déšť již zvířil prach a čilá laň teď běží s houfcem gazel k úkrytům. - -Danish (da) ---------- - - Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen - Wolther spillede på xylofon. - (= Quiz contestants were eating strawbery with cream while Wolther - the circus clown played on xylophone.) - -German (de) ------------ - - Falsches Üben von Xylophonmusik quält jeden größeren Zwerg - (= Wrongful practicing of xylophone music tortures every larger dwarf) - - Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich - (= Twelve boxing fighters hunted Eva across the dike of Sylt) - - Heizölrückstoßabdämpfung - (= fuel oil recoil absorber) - (jqvwxy missing, but all non-ASCII letters in one word) - -English (en) ------------- - - The quick brown fox jumps over the lazy dog - -Spanish (es) ------------- - - El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y - frío, añoraba a su querido cachorro. - (Contains every letter and every accent, but not every combination - of vowel + acute.) - -French (fr) ------------ - - Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à - côté de l'alcôve ovoïde, où les bûches se consument dans l'âtre, ce - qui lui permet de penser à la cænogenèse de l'être dont il est question - dans la cause ambiguë entendue à Moÿ, dans un capharnaüm qui, - pense-t-il, diminue çà et là la qualité de son œuvre. - - l'île exiguë - Où l'obèse jury mûr - Fête l'haï volapük, - Âne ex aéquo au whist, - Ôtez ce vœu déçu. - - Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en - canoë au delà des îles, près du mälström où brûlent les novæ. - -Irish Gaelic (ga) ------------------ - - D'fhuascail Íosa, Úrmhac na hÓighe Beannaithe, pór Éava agus Ádhaimh - -Hungarian (hu) --------------- - - Árvíztűrő tükörfúrógép - (= flood-proof mirror-drilling machine, only all non-ASCII letters) - -Icelandic (is) --------------- - - Kæmi ný öxi hér ykist þjófum nú bæði víl og ádrepa - - Sævör grét áðan því úlpan var ónýt - (some ASCII letters missing) - -Greek (el) -------------- - - Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο - (= No more shall I see acacias or myrtles in the golden clearing) - - Ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία - (= I uncover the soul-destroying abhorrence) - -Hebrew (iw) ------------ - - ? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה - -Polish (pl) ------------ - - Pchnąć w tę łódź jeża lub osiem skrzyń fig - (= To push a hedgehog or eight bins of figs in this boat) - - Zażółć gęślą jaźń - -Russian (ru) ------------- - - В чащах юга жил бы цитрус? Да, но фальшивый экземпляр! - (= Would a citrus live in the bushes of south? Yes, but only a fake one!) - -Thai (th) ---------- - - [--------------------------|------------------------] - ๏ เป็นมนุษย์สุดประเสริฐเลิศคุณค่า กว่าบรรดาฝูงสัตว์เดรัจฉาน - จงฝ่าฟันพัฒนาวิชาการ อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร - ไม่ถือโทษโกรธแช่งซัดฮึดฮัดด่า หัดอภัยเหมือนกีฬาอัชฌาสัย - ปฏิบัติประพฤติกฎกำหนดใจ พูดจาให้จ๊ะๆ จ๋าๆ น่าฟังเอย ฯ - - [The copyright for the Thai example is owned by The Computer - Association of Thailand under the Royal Patronage of His Majesty the - King.] - -Please let me know if you find others! Special thanks to the people -from all over the world who contributed these sentences. diff --git a/vendor/tecnickcom/tcpdf/examples/example_001.php b/vendor/tecnickcom/tcpdf/examples/example_001.php deleted file mode 100644 index 82555e6..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_001.php +++ /dev/null @@ -1,110 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 001'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128)); -$pdf->setFooterData(array(0,64,0), array(0,64,128)); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set default font subsetting mode -$pdf->setFontSubsetting(true); - -// Set font -// dejavusans is a UTF-8 Unicode font, if you only need to -// print standard ASCII chars, you can use core fonts like -// helvetica or times to reduce file size. -$pdf->setFont('dejavusans', '', 14, '', true); - -// Add a page -// This method has several options, check the source code documentation for more information. -$pdf->AddPage(); - -// set text shadow effect -$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); - -// Set some content to print -$html = <<Welcome to  TCPDF ! -This is the first example of TCPDF library. -

This text is printed using the writeHTMLCell() method but you can also use: Multicell(), writeHTML(), Write(), Cell() and Text().

-

Please check the source code documentation and other examples for further information.

-

TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE MAKE A DONATION!

-EOD; - -// Print text using writeHTMLCell() -$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); - -// --------------------------------------------------------- - -// Close and output PDF document -// This method has several options, check the source code documentation for more information. -$pdf->Output('example_001.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_002.php b/vendor/tecnickcom/tcpdf/examples/example_002.php deleted file mode 100644 index f40a201..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_002.php +++ /dev/null @@ -1,91 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 002'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// remove default header/footer -$pdf->setPrintHeader(false); -$pdf->setPrintFooter(false); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', 'BI', 20); - -// add a page -$pdf->AddPage(); - -// set some text to print -$txt = <<Write(0, $txt, '', 0, 'C', true, 0, false, false, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_002.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_003.php b/vendor/tecnickcom/tcpdf/examples/example_003.php deleted file mode 100644 index eeeb0c8..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_003.php +++ /dev/null @@ -1,122 +0,0 @@ -Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false); - // Set font - $this->setFont('helvetica', 'B', 20); - // Title - $this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M'); - } - - // Page footer - public function Footer() { - // Position at 15 mm from bottom - $this->setY(-15); - // Set font - $this->setFont('helvetica', 'I', 8); - // Page number - $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M'); - } -} - -// create new PDF document -$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 003'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', 'BI', 12); - -// add a page -$pdf->AddPage(); - -// set some text to print -$txt = <<Write(0, $txt, '', 0, 'C', true, 0, false, false, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_003.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_004.php b/vendor/tecnickcom/tcpdf/examples/example_004.php deleted file mode 100644 index a1f69a5..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_004.php +++ /dev/null @@ -1,123 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 004'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 004', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', '', 11); - -// add a page -$pdf->AddPage(); - -//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') - -// test Cell stretching -$pdf->Cell(0, 0, 'TEST CELL STRETCH: no stretch', 1, 1, 'C', 0, '', 0); -$pdf->Cell(0, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1); -$pdf->Cell(0, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2); -$pdf->Cell(0, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3); -$pdf->Cell(0, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4); - -$pdf->Ln(5); - -$pdf->Cell(45, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1); -$pdf->Cell(45, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2); -$pdf->Cell(45, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3); -$pdf->Cell(45, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4); - -$pdf->AddPage(); - -// example using general stretching and spacing - -for ($stretching = 90; $stretching <= 110; $stretching += 10) { - for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) { - - // set general stretching (scaling) value - $pdf->setFontStretching($stretching); - - // set general spacing value - $pdf->setFontSpacing($spacing); - - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, no stretch', 1, 1, 'C', 0, '', 0); - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, scaling', 1, 1, 'C', 0, '', 1); - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force scaling', 1, 1, 'C', 0, '', 2); - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, spacing', 1, 1, 'C', 0, '', 3); - $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force spacing', 1, 1, 'C', 0, '', 4); - - $pdf->Ln(2); - } -} - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_004.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_005.php b/vendor/tecnickcom/tcpdf/examples/example_005.php deleted file mode 100644 index c27dfea..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_005.php +++ /dev/null @@ -1,160 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 005'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 005', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', '', 10); - -// add a page -$pdf->AddPage(); - -// set cell padding -$pdf->setCellPaddings(1, 1, 1, 1); - -// set cell margins -$pdf->setCellMargins(1, 1, 1, 1); - -// set color for background -$pdf->setFillColor(255, 255, 127); - -// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0) - -// set some text for example -$txt = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; - -// Multicell test -$pdf->MultiCell(55, 5, '[LEFT] '.$txt, 1, 'L', 1, 0, '', '', true); -$pdf->MultiCell(55, 5, '[RIGHT] '.$txt, 1, 'R', 0, 1, '', '', true); -$pdf->MultiCell(55, 5, '[CENTER] '.$txt, 1, 'C', 0, 0, '', '', true); -$pdf->MultiCell(55, 5, '[JUSTIFY] '.$txt."\n", 1, 'J', 1, 2, '' ,'', true); -$pdf->MultiCell(55, 5, '[DEFAULT] '.$txt, 1, '', 0, 1, '', '', true); - -$pdf->Ln(4); - -// set color for background -$pdf->setFillColor(220, 255, 220); - -// Vertical alignment -$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - TOP] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'T'); -$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - MIDDLE] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'M'); -$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - BOTTOM] '.$txt, 1, 'J', 1, 1, '', '', true, 0, false, true, 40, 'B'); - -$pdf->Ln(4); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// set color for background -$pdf->setFillColor(215, 235, 255); - -// set some text for example -$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. - -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.'; - -// print a blox of text using multicell() -$pdf->MultiCell(80, 5, $txt."\n", 1, 'J', 1, 1, '' ,'', true); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// AUTO-FITTING - -// set color for background -$pdf->setFillColor(255, 235, 235); - -// Fit text on cell by reducing font size -$pdf->MultiCell(55, 60, '[FIT CELL] '.$txt."\n", 1, 'J', 1, 1, 125, 145, true, 0, false, true, 60, 'M', true); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// CUSTOM PADDING - -// set color for background -$pdf->setFillColor(255, 255, 215); - -// set font -$pdf->setFont('helvetica', '', 8); - -// set cell padding -$pdf->setCellPaddings(2, 4, 6, 8); - -$txt = "CUSTOM PADDING:\nLeft=2, Top=4, Right=6, Bottom=8\nLorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue.\n"; - -$pdf->MultiCell(55, 5, $txt, 1, 'J', 1, 2, 125, 210, true); - -// move pointer to last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_005.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_006.php b/vendor/tecnickcom/tcpdf/examples/example_006.php deleted file mode 100644 index f2c7dbc..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_006.php +++ /dev/null @@ -1,347 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 006'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('dejavusans', '', 10); - -// add a page -$pdf->AddPage(); - -// writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='') -// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) - -// create some HTML content -$html = '

HTML Example

-Some special characters: < € € € & è è © > \\slash \\\\double-slash \\\\\\triple-slash -

List

-List example: -
    -
  1. test alt attribute test image
  2. -
  3. bold text
  4. -
  5. italic text
  6. -
  7. underlined text
  8. -
  9. bbibiubib
  10. -
  11. link to http://www.tecnick.com
  12. -
  13. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
    Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
  14. -
  15. SUBLIST -
      -
    1. row one -
        -
      • sublist
      • -
      -
    2. -
    3. row two
    4. -
    -
  16. -
  17. TEST line through
  18. -
  19. font + 3
  20. -
  21. small text normal small text normal subscript normal superscript normal
  22. -
-
-
Coffee
-
Black hot drink
-
Milk
-
White cold drink
-
-
IMAGES
-test alt attributetest alt attributetest alt attribute -
'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - - -// output some RTL HTML content -$html = '
The words “מזל [mazel] טוב [tov]” mean “Congratulations!”
'; -$pdf->writeHTML($html, true, false, true, false, ''); - -// test some inline CSS -$html = '

This is just an example of html code to demonstrate some supported CSS inline styles. -bold text -line-trough -underline and line-trough -color -background color -bold -xx-small -x-small -small -medium -large -x-large -xx-large -

'; - -$pdf->writeHTML($html, true, false, true, false, ''); - -// reset pointer to the last page -$pdf->lastPage(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Print a table - -// add a page -$pdf->AddPage(); - -// create some HTML content -$subtable = '
ab
cd
'; - -$html = '

HTML TABLE:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#RIGHT alignLEFT align4A
1A1 example link column span. One two tree four five six seven eight nine ten.
line after br
small text normal subscript normal superscript normal bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
  1. first
    1. sublist
    2. sublist
  2. second
small small small small small small small small small small small small small small small small small small small small
4B
'.$subtable.'A2 € € € & è è
A2 € € € & è è
Red Yellow BG4C
1A2AA
2AB
2AC
4D
1B4E
1C2C3C4F
'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// Print some HTML Cells - -$html = 'red green blue
red green blue'; - -$pdf->setFillColor(255,255,0); - -$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'L', true); -$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 1, true, 'C', true); -$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'R', true); - -// reset pointer to the last page -$pdf->lastPage(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Print a table - -// add a page -$pdf->AddPage(); - -// create some HTML content -$html = '

Image alignments on HTML table

- - - - - - - - -
'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// create some HTML content -$html = '

Embedded Images

- - - -
src="@..."
src="data..."
'; - -$data = base64_encode(file_get_contents("images/logo_example.png")); -$html = str_replace("@DATA1@", "@" . $data, $html); -$html = str_replace("@DATA2@", "data:image/png;base64," . $data, $html); - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// reset pointer to the last page -$pdf->lastPage(); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Print all HTML colors - -// add a page -$pdf->AddPage(); - -$textcolors = '

HTML Text Colors

'; -$bgcolors = '

HTML Background Colors

'; - -foreach(TCPDF_COLORS::$webcolor as $k => $v) { - $textcolors .= ''.$v.' '; - $bgcolors .= ''.$v.' '; -} - -// output the HTML content -$pdf->writeHTML($textcolors, true, false, true, false, ''); -$pdf->writeHTML($bgcolors, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Test word-wrap - -// create some HTML content -$html = '
-

Various tests

-link to page 2
-thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// Test fonts nesting -$html1 = 'Default Courier Helvetica Times dejavusans Times Helvetica Courier Default'; -$html2 = 'small text normal small text normal subscript normal superscript normal'; -$html3 = 'The quick brown fox jumps over the lazy dog.'; - -$html = $html1.'
'.$html2.'
'.$html3.'
'.$html3.'
'.$html2; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// test pre tag - -// add a page -$pdf->AddPage(); - -$html = << -Hello World!
-Hello - -
-int main() {
-    printf("HelloWorld");
-    return 0;
-}
-
-Monospace font, normal font, monospace font, normal font. -
-
DIV LEVEL 1
DIV LEVEL 2
DIV LEVEL 1
-
-SPAN LEVEL 1 SPAN LEVEL 2 SPAN LEVEL 1 -EOF; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// test custom bullet points for list - -// add a page -$pdf->AddPage(); - -$html = <<Test custom bullet image for list items -
    -
  • test custom bullet image
  • -
  • test custom bullet image
  • -
  • test custom bullet image
  • -
  • test custom bullet image
  • -
      -EOF; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_006.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_007.php b/vendor/tecnickcom/tcpdf/examples/example_007.php deleted file mode 100644 index 8edeb08..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_007.php +++ /dev/null @@ -1,117 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 007'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 007', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', '', 12); - -// add a page -$pdf->AddPage(); - -// create columns content -$left_column = 'LEFT COLUMN left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column'; - -$right_column = 'RIGHT COLUMN right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column'; - -// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) - -// get current vertical position -$y = $pdf->getY(); - -// set color for background -$pdf->setFillColor(255, 255, 200); - -// set color for text -$pdf->setTextColor(0, 63, 127); - -// write the first column -$pdf->writeHTMLCell(80, '', '', $y, $left_column, 1, 0, 1, true, 'J', true); - -// set color for background -$pdf->setFillColor(215, 235, 255); - -// set color for text -$pdf->setTextColor(127, 31, 0); - -// write the second column -$pdf->writeHTMLCell(80, '', '', '', $right_column, 1, 1, 1, true, 'J', true); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_007.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_008.php b/vendor/tecnickcom/tcpdf/examples/example_008.php deleted file mode 100644 index 2a3e716..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_008.php +++ /dev/null @@ -1,99 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 008'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 008', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set default font subsetting mode -$pdf->setFontSubsetting(true); - -// set font -$pdf->setFont('freeserif', '', 12); - -// add a page -$pdf->AddPage(); - -// get external file content -$utf8text = file_get_contents('data/utf8test.txt', false); - -// set color for text -$pdf->setTextColor(0, 63, 127); - -//Write($h, $txt, $link='', $fill=0, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0) - -// write the text -$pdf->Write(5, $utf8text, '', 0, '', false, 0, false, false, 0); - - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_008.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_009.php b/vendor/tecnickcom/tcpdf/examples/example_009.php deleted file mode 100644 index 1daf8ea..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_009.php +++ /dev/null @@ -1,148 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 009'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 009', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// ------------------------------------------------------------------- - -// add a page -$pdf->AddPage(); - -// set JPEG quality -$pdf->setJPEGQuality(75); - -// Image method signature: -// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false) - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Example of Image from data stream ('PHP rules') -$imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg=='); - -// The '@' character is used to indicate that follows an image data stream and not an image file name -$pdf->Image('@'.$imgdata); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Image example with resizing -$pdf->Image('images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// test fitbox with all alignment combinations - -$horizontal_alignments = array('L', 'C', 'R'); -$vertical_alignments = array('T', 'M', 'B'); - -$x = 15; -$y = 35; -$w = 30; -$h = 30; -// test all combinations of alignments -for ($i = 0; $i < 3; ++$i) { - $fitbox = $horizontal_alignments[$i].' '; - $x = 15; - for ($j = 0; $j < 3; ++$j) { - $fitbox[1] = $vertical_alignments[$j]; - $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128,255,128)); - $pdf->Image('images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false); - $x += 32; // new column - } - $y += 32; // new row -} - -$x = 115; -$y = 35; -$w = 25; -$h = 50; -for ($i = 0; $i < 3; ++$i) { - $fitbox = $horizontal_alignments[$i].' '; - $x = 115; - for ($j = 0; $j < 3; ++$j) { - $fitbox[1] = $vertical_alignments[$j]; - $pdf->Rect($x, $y, $w, $h, 'F', array(), array(128,255,255)); - $pdf->Image('images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false); - $x += 27; // new column - } - $y += 52; // new row -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Stretching, position and alignment example - -$pdf->setXY(110, 200); -$pdf->Image('images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false); -$pdf->Image('images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false); - -// ------------------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_009.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_010.php b/vendor/tecnickcom/tcpdf/examples/example_010.php deleted file mode 100644 index b99ca22..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_010.php +++ /dev/null @@ -1,152 +0,0 @@ -AddPage(); - // disable existing columns - $this->resetColumns(); - // print chapter title - $this->ChapterTitle($num, $title); - // set columns - $this->setEqualColumns(3, 57); - // print chapter body - $this->ChapterBody($file, $mode); - } - - /** - * Set chapter title - * @param int $num chapter number - * @param string $title chapter title - * @public - */ - public function ChapterTitle($num, $title) { - $this->setFont('helvetica', '', 14); - $this->setFillColor(200, 220, 255); - $this->Cell(180, 6, 'Chapter '.$num.' : '.$title, 0, 1, '', 1); - $this->Ln(4); - } - - /** - * Print chapter body - * @param string $file name of the file containing the chapter body - * @param boolean $mode if true the chapter body is in HTML, otherwise in simple text. - * @public - */ - public function ChapterBody($file, $mode=false) { - $this->selectColumn(); - // get esternal file content - $content = file_get_contents($file, false); - // set font - $this->setFont('times', '', 9); - $this->setTextColor(50, 50, 50); - // print content - if ($mode) { - // ------ HTML MODE ------ - $this->writeHTML($content, true, false, true, false, 'J'); - } else { - // ------ TEXT MODE ------ - $this->Write(0, $content, '', 0, 'J', true, 0, false, true, 0); - } - $this->Ln(); - } -} // end of extended class - -// --------------------------------------------------------- -// EXAMPLE -// --------------------------------------------------------- -// create new PDF document -$pdf = new MC_TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 010'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 010', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// print TEXT -$pdf->PrintChapter(1, 'LOREM IPSUM [TEXT]', 'data/chapter_demo_1.txt', false); - -// print HTML -$pdf->PrintChapter(2, 'LOREM IPSUM [HTML]', 'data/chapter_demo_2.txt', true); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_010.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_011.php b/vendor/tecnickcom/tcpdf/examples/example_011.php deleted file mode 100644 index 8656eb9..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_011.php +++ /dev/null @@ -1,141 +0,0 @@ -setFillColor(255, 0, 0); - $this->setTextColor(255); - $this->setDrawColor(128, 0, 0); - $this->setLineWidth(0.3); - $this->setFont('', 'B'); - // Header - $w = array(40, 35, 40, 45); - $num_headers = count($header); - for($i = 0; $i < $num_headers; ++$i) { - $this->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1); - } - $this->Ln(); - // Color and font restoration - $this->setFillColor(224, 235, 255); - $this->setTextColor(0); - $this->setFont(''); - // Data - $fill = 0; - foreach($data as $row) { - $this->Cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill); - $this->Cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill); - $this->Cell($w[2], 6, number_format($row[2]), 'LR', 0, 'R', $fill); - $this->Cell($w[3], 6, number_format($row[3]), 'LR', 0, 'R', $fill); - $this->Ln(); - $fill=!$fill; - } - $this->Cell(array_sum($w), 0, '', 'T'); - } -} - -// create new PDF document -$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 011'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 011', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 12); - -// add a page -$pdf->AddPage(); - -// column titles -$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)'); - -// data loading -$data = $pdf->LoadData('data/table_data_demo.txt'); - -// print colored table -$pdf->ColoredTable($header, $data); - -// --------------------------------------------------------- - -// close and output PDF document -$pdf->Output('example_011.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_012.pdf b/vendor/tecnickcom/tcpdf/examples/example_012.pdf deleted file mode 100644 index eec8ee0..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/example_012.pdf and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/example_012.php b/vendor/tecnickcom/tcpdf/examples/example_012.php deleted file mode 100644 index b8c03f4..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_012.php +++ /dev/null @@ -1,207 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 012'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// disable header and footer -$pdf->setPrintHeader(false); -$pdf->setPrintFooter(false); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 10); - -// add a page -$pdf->AddPage(); - -$style = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,20,5,10', 'phase' => 10, 'color' => array(255, 0, 0)); -$style2 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)); -$style3 = array('width' => 1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,10', 'color' => array(255, 0, 0)); -$style4 = array('L' => 0, - 'T' => array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => '20,10', 'phase' => 10, 'color' => array(100, 100, 255)), - 'R' => array('width' => 0.50, 'cap' => 'round', 'join' => 'miter', 'dash' => 0, 'color' => array(50, 50, 127)), - 'B' => array('width' => 0.75, 'cap' => 'square', 'join' => 'miter', 'dash' => '30,10,5,10')); -$style5 = array('width' => 0.25, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 64, 128)); -$style6 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10,10', 'color' => array(0, 128, 0)); -$style7 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 128, 0)); - -// Line -$pdf->Text(5, 4, 'Line examples'); -$pdf->Line(5, 10, 80, 30, $style); -$pdf->Line(5, 10, 5, 30, $style2); -$pdf->Line(5, 10, 80, 10, $style3); - -// Rect -$pdf->Text(100, 4, 'Rectangle examples'); -$pdf->Rect(100, 10, 40, 20, 'DF', $style4, array(220, 220, 200)); -$pdf->Rect(145, 10, 40, 20, 'D', array('all' => $style3)); - -// Curve -$pdf->Text(5, 34, 'Curve examples'); -$pdf->Curve(5, 40, 30, 55, 70, 45, 60, 75, '', $style6); -$pdf->Curve(80, 40, 70, 75, 150, 45, 100, 75, 'F', $style6); -$pdf->Curve(140, 40, 150, 55, 180, 45, 200, 75, 'DF', $style6, array(200, 220, 200)); - -// Circle and ellipse -$pdf->Text(5, 79, 'Circle and ellipse examples'); -$pdf->setLineStyle($style5); -$pdf->Circle(25,105,20); -$pdf->Circle(25,105,10, 90, 180, '', $style6); -$pdf->Circle(25,105,10, 270, 360, 'F'); -$pdf->Circle(25,105,10, 270, 360, 'C', $style6); - -$pdf->setLineStyle($style5); -$pdf->Ellipse(100,103,40,20); -$pdf->Ellipse(100,105,20,10, 0, 90, 180, '', $style6); -$pdf->Ellipse(100,105,20,10, 0, 270, 360, 'DF', $style6); - -$pdf->setLineStyle($style5); -$pdf->Ellipse(175,103,30,15,45); -$pdf->Ellipse(175,105,15,7.50, 45, 90, 180, '', $style6); -$pdf->Ellipse(175,105,15,7.50, 45, 270, 360, 'F', $style6, array(220, 200, 200)); - -// Polygon -$pdf->Text(5, 129, 'Polygon examples'); -$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); -$pdf->Polygon(array(5,135,45,135,15,165)); -$pdf->Polygon(array(60,135,80,135,80,155,70,165,50,155), 'DF', array($style6, $style7, $style7, 0, $style6), array(220, 200, 200)); -$pdf->Polygon(array(120,135,140,135,150,155,110,155), 'D', array($style6, 0, $style7, $style6)); -$pdf->Polygon(array(160,135,190,155,170,155,200,160,160,165), 'DF', array('all' => $style6), array(220, 220, 220)); - -// Polygonal Line -$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 164))); -$pdf->PolyLine(array(80,165,90,160,100,165,110,160,120,165,130,160,140,165), 'D', array(), array()); - -// Regular polygon -$pdf->Text(5, 169, 'Regular polygon examples'); -$pdf->setLineStyle($style5); -$pdf->RegularPolygon(20, 190, 15, 6, 0, 1, 'F'); -$pdf->RegularPolygon(55, 190, 15, 6); -$pdf->RegularPolygon(55, 190, 10, 6, 45, false, 'DF', array($style6, 0, $style7, 0, $style7, $style7)); -$pdf->RegularPolygon(90, 190, 15, 3, 0, true, 'DF', array('all' => $style5), array(200, 220, 200), 'F', array(255, 200, 200)); -$pdf->RegularPolygon(125, 190, 15, 4, 30, true, '', array('all' => $style5), array(), '', $style6); -$pdf->RegularPolygon(160, 190, 15, 10); - -// Star polygon -$pdf->Text(5, 209, 'Star polygon examples'); -$pdf->setLineStyle($style5); -$pdf->StarPolygon(20, 230, 15, 20, 3, 0, 1, 'F'); -$pdf->StarPolygon(55, 230, 15, 12, 5); -$pdf->StarPolygon(55, 230, 7, 12, 5, 45, false, 'DF', array('all' => $style7), array(220, 220, 200), 'F', array(255, 200, 200)); -$pdf->StarPolygon(90, 230, 15, 20, 6, 0, true, 'DF', array('all' => $style5), array(220, 220, 200), 'F', array(255, 200, 200)); -$pdf->StarPolygon(125, 230, 15, 5, 2, 30, true, '', array('all' => $style5), array(), '', $style6); -$pdf->StarPolygon(160, 230, 15, 10, 3); -$pdf->StarPolygon(160, 230, 7, 50, 26); - -// Rounded rectangle -$pdf->Text(5, 249, 'Rounded rectangle examples'); -$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); -$pdf->RoundedRect(5, 255, 40, 30, 3.50, '1111', 'DF'); -$pdf->RoundedRect(50, 255, 40, 30, 6.50, '1000'); -$pdf->RoundedRect(95, 255, 40, 30, 10.0, '1111', '', $style6); -$pdf->RoundedRect(140, 255, 40, 30, 8.0, '0101', 'DF', $style6, array(200, 200, 200)); - -// Arrows -$pdf->Text(185, 249, 'Arrows'); -$pdf->setLineStyle($style5); -$pdf->setFillColor(255, 0, 0); -$pdf->Arrow(200, 280, 185, 266, 0, 5, 15); -$pdf->Arrow(200, 280, 190, 263, 1, 5, 15); -$pdf->Arrow(200, 280, 195, 261, 2, 5, 15); -$pdf->Arrow(200, 280, 200, 260, 3, 5, 15); - -// - . - . - . - . - . - . - . - . - . - . - . - . - . - . - - -// ellipse - -// add a page -$pdf->AddPage(); - -$pdf->Cell(0, 0, 'Arc of Ellipse'); - -// center of ellipse -$xc=100; -$yc=100; - -// X Y axis -$pdf->setDrawColor(200, 200, 200); -$pdf->Line($xc-50, $yc, $xc+50, $yc); -$pdf->Line($xc, $yc-50, $xc, $yc+50); - -// ellipse axis -$pdf->setDrawColor(200, 220, 255); -$pdf->Line($xc-50, $yc-50, $xc+50, $yc+50); -$pdf->Line($xc-50, $yc+50, $xc+50, $yc-50); - -// ellipse -$pdf->setDrawColor(200, 255, 200); -$pdf->Ellipse($xc, $yc, 30, 15, 45, 0, 360, 'D', array(), array(), 2); - -// ellipse arc -$pdf->setDrawColor(255, 0, 0); -$pdf->Ellipse($xc, $yc, 30, 15, 45, 45, 90, 'D', array(), array(), 2); - - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_012.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_013.php b/vendor/tecnickcom/tcpdf/examples/example_013.php deleted file mode 100644 index 0430e8f..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_013.php +++ /dev/null @@ -1,231 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 013'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 013', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Graphic Transformations', '', 0, 'C', 1, 0, false, false, 0); - -// set font -$pdf->setFont('helvetica', '', 10); - -// --- Scaling --------------------------------------------- -$pdf->setDrawColor(200); -$pdf->setTextColor(200); -$pdf->Rect(50, 70, 40, 10, 'D'); -$pdf->Text(50, 66, 'Scale'); -$pdf->setDrawColor(0); -$pdf->setTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// Scale by 150% centered by (50,80) which is the lower left corner of the rectangle -$pdf->ScaleXY(150, 50, 80); -$pdf->Rect(50, 70, 40, 10, 'D'); -$pdf->Text(50, 66, 'Scale'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Translation ----------------------------------------- -$pdf->setDrawColor(200); -$pdf->setTextColor(200); -$pdf->Rect(125, 70, 40, 10, 'D'); -$pdf->Text(125, 66, 'Translate'); -$pdf->setDrawColor(0); -$pdf->setTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// Translate 7 to the right, 5 to the bottom -$pdf->Translate(7, 5); -$pdf->Rect(125, 70, 40, 10, 'D'); -$pdf->Text(125, 66, 'Translate'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Rotation -------------------------------------------- -$pdf->setDrawColor(200); -$pdf->setTextColor(200); -$pdf->Rect(70, 100, 40, 10, 'D'); -$pdf->Text(70, 96, 'Rotate'); -$pdf->setDrawColor(0); -$pdf->setTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// Rotate 20 degrees counter-clockwise centered by (70,110) which is the lower left corner of the rectangle -$pdf->Rotate(20, 70, 110); -$pdf->Rect(70, 100, 40, 10, 'D'); -$pdf->Text(70, 96, 'Rotate'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Skewing --------------------------------------------- -$pdf->setDrawColor(200); -$pdf->setTextColor(200); -$pdf->Rect(125, 100, 40, 10, 'D'); -$pdf->Text(125, 96, 'Skew'); -$pdf->setDrawColor(0); -$pdf->setTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// skew 30 degrees along the x-axis centered by (125,110) which is the lower left corner of the rectangle -$pdf->SkewX(30, 125, 110); -$pdf->Rect(125, 100, 40, 10, 'D'); -$pdf->Text(125, 96, 'Skew'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Mirroring horizontally ------------------------------ -$pdf->setDrawColor(200); -$pdf->setTextColor(200); -$pdf->Rect(70, 130, 40, 10, 'D'); -$pdf->Text(70, 126, 'MirrorH'); -$pdf->setDrawColor(0); -$pdf->setTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// mirror horizontally with axis of reflection at x-position 70 (left side of the rectangle) -$pdf->MirrorH(70); -$pdf->Rect(70, 130, 40, 10, 'D'); -$pdf->Text(70, 126, 'MirrorH'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Mirroring vertically -------------------------------- -$pdf->setDrawColor(200); -$pdf->setTextColor(200); -$pdf->Rect(125, 130, 40, 10, 'D'); -$pdf->Text(125, 126, 'MirrorV'); -$pdf->setDrawColor(0); -$pdf->setTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// mirror vertically with axis of reflection at y-position 140 (bottom side of the rectangle) -$pdf->MirrorV(140); -$pdf->Rect(125, 130, 40, 10, 'D'); -$pdf->Text(125, 126, 'MirrorV'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Point reflection ------------------------------------ -$pdf->setDrawColor(200); -$pdf->setTextColor(200); -$pdf->Rect(70, 160, 40, 10, 'D'); -$pdf->Text(70, 156, 'MirrorP'); -$pdf->setDrawColor(0); -$pdf->setTextColor(0); -// Start Transformation -$pdf->StartTransform(); -// point reflection at the lower left point of rectangle -$pdf->MirrorP(70,170); -$pdf->Rect(70, 160, 40, 10, 'D'); -$pdf->Text(70, 156, 'MirrorP'); -// Stop Transformation -$pdf->StopTransform(); - -// --- Mirroring against a straigth line described by a point (120, 120) and an angle -20° -$angle=-20; -$px=120; -$py=170; - -// just for visualisation: the straight line to mirror against - -$pdf->setDrawColor(200); -$pdf->Line($px-1,$py-1,$px+1,$py+1); -$pdf->Line($px-1,$py+1,$px+1,$py-1); -$pdf->StartTransform(); -$pdf->Rotate($angle, $px, $py); -$pdf->Line($px-5, $py, $px+60, $py); -$pdf->StopTransform(); - -$pdf->setDrawColor(200); -$pdf->setTextColor(200); -$pdf->Rect(125, 160, 40, 10, 'D'); -$pdf->Text(125, 156, 'MirrorL'); -$pdf->setDrawColor(0); -$pdf->setTextColor(0); -//Start Transformation -$pdf->StartTransform(); -//mirror against the straight line -$pdf->MirrorL($angle, $px, $py); -$pdf->Rect(125, 160, 40, 10, 'D'); -$pdf->Text(125, 156, 'MirrorL'); -//Stop Transformation -$pdf->StopTransform(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_013.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_014.php b/vendor/tecnickcom/tcpdf/examples/example_014.php deleted file mode 100644 index eac3f6a..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_014.php +++ /dev/null @@ -1,197 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 014'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 014', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// IMPORTANT: disable font subsetting to allow users editing the document -$pdf->setFontSubsetting(false); - -// set font. 'helvetica' MUST be used to avoid a PHP notice from PHP 7.4+ -$pdf->setFont('helvetica', '', 10, '', false); - -// add a page -$pdf->AddPage(); - -/* -It is possible to create text fields, combo boxes, check boxes and buttons. -Fields are created at the current position and are given a name. -This name allows to manipulate them via JavaScript in order to perform some validation for instance. -*/ - -// set default form properties -$pdf->setFormDefaultProp(array('lineWidth'=>1, 'borderStyle'=>'solid', 'fillColor'=>array(255, 255, 200), 'strokeColor'=>array(255, 128, 128))); - -$pdf->setFont('helvetica', 'BI', 18); -$pdf->Cell(0, 5, 'Example of Form', 0, 1, 'C'); -$pdf->Ln(10); - -$pdf->setFont('helvetica', '', 12); - -// First name -$pdf->Cell(35, 5, 'First name:'); -$pdf->TextField('firstname', 50, 5); -$pdf->Ln(6); - -// Last name -$pdf->Cell(35, 5, 'Last name:'); -$pdf->TextField('lastname', 50, 5); -$pdf->Ln(6); - -// Gender -$pdf->Cell(35, 5, 'Gender:'); -$pdf->ComboBox('gender', 30, 5, array(array('', '-'), array('M', 'Male'), array('F', 'Female'))); -$pdf->Ln(6); - -// Drink -$pdf->Cell(35, 5, 'Drink:'); -//$pdf->RadioButton('drink', 5, array('readonly' => 'true'), array(), 'Water'); -$pdf->RadioButton('drink', 5, array(), array(), 'Water'); -$pdf->Cell(35, 5, 'Water'); -$pdf->Ln(6); -$pdf->Cell(35, 5, ''); -$pdf->RadioButton('drink', 5, array(), array(), 'Beer', true); -$pdf->Cell(35, 5, 'Beer'); -$pdf->Ln(6); -$pdf->Cell(35, 5, ''); -$pdf->RadioButton('drink', 5, array(), array(), 'Wine'); -$pdf->Cell(35, 5, 'Wine'); -$pdf->Ln(6); -$pdf->Cell(35, 5, ''); -$pdf->RadioButton('drink', 5, array(), array(), 'Milk'); -$pdf->Cell(35, 5, 'Milk'); -$pdf->Ln(10); - -// Newsletter -$pdf->Cell(35, 5, 'Newsletter:'); -$pdf->CheckBox('newsletter', 5, true, array(), array(), 'OK'); - -$pdf->Ln(10); -// Address -$pdf->Cell(35, 5, 'Address:'); -$pdf->TextField('address', 60, 18, array('multiline'=>true, 'lineWidth'=>0, 'borderStyle'=>'none'), array('v'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'dv'=>'Lorem ipsum dolor sit amet, consectetur adipiscing elit.')); -$pdf->Ln(19); - -// Listbox -$pdf->Cell(35, 5, 'List:'); -$pdf->ListBox('listbox', 60, 15, array('', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7'), array('multipleSelection'=>'true')); -$pdf->Ln(20); - -// E-mail -$pdf->Cell(35, 5, 'E-mail:'); -$pdf->TextField('email', 50, 5); -$pdf->Ln(6); - -// Date of the day -$pdf->Cell(35, 5, 'Date:'); -$pdf->TextField('date', 30, 5, array(), array('v'=>date('Y-m-d'), 'dv'=>date('Y-m-d'))); -$pdf->Ln(10); - -$pdf->setX(50); - -// Button to validate and print -$pdf->Button('print', 30, 10, 'Print', 'Print()', array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64))); - -// Reset Button -$pdf->Button('reset', 30, 10, 'Reset', array('S'=>'ResetForm'), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64))); - -// Submit Button -$pdf->Button('submit', 30, 10, 'Submit', array('S'=>'SubmitForm', 'F'=>'http://localhost/printvars.php', 'Flags'=>array('ExportFormat')), array('lineWidth'=>2, 'borderStyle'=>'beveled', 'fillColor'=>array(128, 196, 255), 'strokeColor'=>array(64, 64, 64))); - -// Form validation functions -$js = <<IncludeJS($js); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_014.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_015.php b/vendor/tecnickcom/tcpdf/examples/example_015.php deleted file mode 100644 index 416883b..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_015.php +++ /dev/null @@ -1,164 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 015'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 015', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0)) - -// set font -$pdf->setFont('times', 'B', 20); - -// add a page -$pdf->AddPage(); - -// set a bookmark for the current position -$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128)); - -// print a line using Cell() -$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); - -$pdf->setFont('times', 'I', 14); -$pdf->Write(0, 'You can set PDF Bookmarks using the Bookmark() method. -You can set PDF Named Destinations using the setDestination() method.'); - -$pdf->setFont('times', 'B', 20); - -// add other pages and bookmarks - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(0,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(0,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,0,0)); -$pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(0,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); - -$pdf->AddPage(); -// add a named destination so you can open this document at this page using the link: "example_015.pdf#chapter2" -$pdf->setDestination('chapter2', 0, ''); -// add a bookmark that points to a named destination -$pdf->Bookmark('Chapter 2', 0, 0, '', 'BI', array(128,0,0), -1, '#chapter2'); -$pdf->Cell(0, 10, 'Chapter 2', 0, 1, 'L'); -$pdf->setFont('times', 'I', 14); -$pdf->Write(0, 'Once saved, you can open this document at this page using the link: "example_015.pdf#chapter2".'); - -$pdf->AddPage(); -$pdf->setDestination('chapter3', 0, ''); -$pdf->setFont('times', 'B', 20); -$pdf->Bookmark('Chapter 3', 0, 0, '', 'B', array(0,64,128)); -$pdf->Cell(0, 10, 'Chapter 3', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->setDestination('chapter4', 0, ''); -$pdf->setFont('times', 'B', 20); -$pdf->Bookmark('Chapter 4', 0, 0, '', 'B', array(0,64,128)); -$pdf->Cell(0, 10, 'Chapter 4', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Chapter 5', 0, 0, '', 'B', array(0,128,0)); -$pdf->Cell(0, 10, 'Chapter 5', 0, 1, 'L'); -$txt = 'Example of File Attachment. -Double click on the icon to open the attached file.'; -$pdf->setFont('helvetica', '', 10); -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// attach an external file TXT file -$pdf->Annotation(20, 50, 5, 5, 'TXT file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => 'data/utf8test.txt')); - -// attach an external file -$pdf->Annotation(50, 50, 5, 5, 'PDF file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => 'example_012.pdf')); - -// add a bookmark that points to an embedded file -// NOTE: prefix the file name with the * character for generic file and with % character for PDF file -$pdf->Bookmark('TXT file', 0, 0, '', 'B', array(128,0,255), -1, '*utf8test.txt'); - -// add a bookmark that points to an embedded file -// NOTE: prefix the file name with the * character for generic file and with % character for PDF file -$pdf->Bookmark('PDF file', 0, 0, '', 'B', array(128,0,255), -1, '%example_012.pdf'); - -// add a bookmark that points to an external URL -$pdf->Bookmark('External URL', 0, 0, '', 'B', array(0,0,255), -1, 'http://www.tcpdf.org'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_015.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_016.php b/vendor/tecnickcom/tcpdf/examples/example_016.php deleted file mode 100644 index f54a746..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_016.php +++ /dev/null @@ -1,136 +0,0 @@ -setProtection(array('print', 'copy'), '', null, 0, null); - -// Example with public-key -// To open the document you need to install the private key (tcpdf.p12) on the Acrobat Reader. The password is: 1234 -//$pdf->setProtection($permissions=array('print', 'copy'), $user_pass='', $owner_pass=null, $mode=1, $pubkeys=array(array('c' => 'file://../config/cert/tcpdf.crt', 'p' => array('print')))); - -// ********************************************************* - - -// set document information -$pdf->setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 016'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 016', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array('helvetica', '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array('helvetica', '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', '', 16); - -// add a page -$pdf->AddPage(); - -// set some text to print -$txt = <<Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_016.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_017.php b/vendor/tecnickcom/tcpdf/examples/example_017.php deleted file mode 100644 index 94f571b..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_017.php +++ /dev/null @@ -1,120 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 017'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 017', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of independent Multicell() columns', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(5); - -$pdf->setFont('times', '', 12); - -// create columns content -// create columns content -$left_column = '[LEFT COLUMN] left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column'."\n"; - -$right_column = '[RIGHT COLUMN] right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column'."\n"; - -// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0) - -// set color for background -$pdf->setFillColor(255, 255, 200); - -// set color for text -$pdf->setTextColor(0, 63, 127); - -// write the first column -$pdf->MultiCell(80, 0, $left_column, 1, 'J', 1, 0, '', '', true, 0, false, true, 0); - -// set color for background -$pdf->setFillColor(215, 235, 255); - -// set color for text -$pdf->setTextColor(127, 31, 0); - -// write the second column -$pdf->MultiCell(80, 0, $right_column, 1, 'J', 1, 1, '', '', true, 0, false, true, 0); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_017.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_018.php b/vendor/tecnickcom/tcpdf/examples/example_018.php deleted file mode 100644 index bacc94a..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_018.php +++ /dev/null @@ -1,130 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 018'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 018', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language dependent data: -$lg = Array(); -$lg['a_meta_charset'] = 'UTF-8'; -$lg['a_meta_dir'] = 'rtl'; -$lg['a_meta_language'] = 'fa'; -$lg['w_page'] = 'page'; - -// set some language-dependent strings (optional) -$pdf->setLanguageArray($lg); - -// --------------------------------------------------------- - -// set font -$pdf->setFont('dejavusans', '', 12); - -// add a page -$pdf->AddPage(); - -// Persian and English content -$htmlpersian = 'Persian example:
      سلام بالاخره مشکل PDF فارسی به طور کامل حل شد. اینم یک نمونش.
      مشکل حرف \"ژ\" در بعضی کلمات مانند کلمه ویژه نیز بر طرف شد.
      نگارش حروف لام و الف پشت سر هم نیز تصحیح شد.
      با تشکر از "Asuni Nicola" و محمد علی گل کار برای پشتیبانی زبان فارسی.'; -$pdf->WriteHTML($htmlpersian, true, 0, true, 0); - -// set LTR direction for english translation -$pdf->setRTL(false); - -$pdf->setFontSize(10); - -// print newline -$pdf->Ln(); - -// Persian and English content -$htmlpersiantranslation = 'Hi, At last Problem of Persian PDF Solved completely. This is a example for it.
      Problem of "jeh" letter in some word like "ویژه" (=special) fix too.
      The joining of laa and alf letter fix now.
      Special thanks to "Nicola Asuni" and "Mohamad Ali Golkar" for Persian support.
      '; -$pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0); - -// Restore RTL direction -$pdf->setRTL(true); - -// set font -$pdf->setFont('aefurat', '', 18); - -// print newline -$pdf->Ln(); - -// Arabic and English content -$pdf->Cell(0, 12, 'بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ',0,1,'C'); -$htmlcontent = 'تمَّ بِحمد الله حلّ مشكلة الكتابة باللغة العربية في ملفات الـPDF مع دعم الكتابة من اليمين إلى اليسار والحركَات .
      تم الحل بواسطة صالح المطرفي و Asuni Nicola . '; -$pdf->WriteHTML($htmlcontent, true, 0, true, 0); - -// set LTR direction for english translation -$pdf->setRTL(false); - -// print newline -$pdf->Ln(); - -$pdf->setFont('aealarabiya', '', 18); - -// Arabic and English content -$htmlcontent2 = 'This is Arabic "العربية" Example With TCPDF.'; -$pdf->WriteHTML($htmlcontent2, true, 0, true, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_018.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_019.php b/vendor/tecnickcom/tcpdf/examples/example_019.php deleted file mode 100644 index f53a34e..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_019.php +++ /dev/null @@ -1,100 +0,0 @@ -setDocInfoUnicode(true); - -// set document information -$pdf->setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni [€]'); -$pdf->setTitle('TCPDF Example 019'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 019', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language dependent data: -$lg = Array(); -$lg['a_meta_charset'] = 'ISO-8859-1'; -$lg['a_meta_dir'] = 'ltr'; -$lg['a_meta_language'] = 'en'; -$lg['w_page'] = 'page'; - -// set some language-dependent strings (optional) -$pdf->setLanguageArray($lg); - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 12); - -// add a page -$pdf->AddPage(); - -// set color for background -$pdf->setFillColor(200, 255, 200); - -$txt = 'An alternative configuration file is used on this example. -Check the definition of the K_TCPDF_EXTERNAL_CONFIG constant on the source code.'; - -// print some text -$pdf->MultiCell(0, 0, $txt."\n", 1, 'J', 1, 1, '', '', true, 0, false, true, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_019.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_020.php b/vendor/tecnickcom/tcpdf/examples/example_020.php deleted file mode 100644 index 32c16ea..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_020.php +++ /dev/null @@ -1,149 +0,0 @@ -getPage(); - $y_start = $this->GetY(); - - // write the left cell - $this->MultiCell(40, 0, $left, 1, 'R', 1, 2, '', '', true, 0); - - $page_end_1 = $this->getPage(); - $y_end_1 = $this->GetY(); - - $this->setPage($page_start); - - // write the right cell - $this->MultiCell(0, 0, $right, 1, 'J', 0, 1, $this->GetX() ,$y_start, true, 0); - - $page_end_2 = $this->getPage(); - $y_end_2 = $this->GetY(); - - // set the new row position by case - if (max($page_end_1,$page_end_2) == $page_start) { - $ynew = max($y_end_1, $y_end_2); - } elseif ($page_end_1 == $page_end_2) { - $ynew = max($y_end_1, $y_end_2); - } elseif ($page_end_1 > $page_end_2) { - $ynew = $y_end_1; - } else { - $ynew = $y_end_2; - } - - $this->setPage(max($page_end_1,$page_end_2)); - $this->setXY($this->GetX(),$ynew); - } - -} - -// create new PDF document -$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 020'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 020', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 20); -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of text layout using Multicell()', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(5); - -$pdf->setFont('times', '', 9); - -//$pdf->setCellPadding(0); -//$pdf->setLineWidth(2); - -// set color for background -$pdf->setFillColor(255, 255, 200); - -$text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. - -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.'; - -// print some rows just as example -for ($i = 0; $i < 10; ++$i) { - $pdf->MultiRow('Row '.($i+1), $text."\n"); -} - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_020.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_021.php b/vendor/tecnickcom/tcpdf/examples/example_021.php deleted file mode 100644 index 98ae49b..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_021.php +++ /dev/null @@ -1,93 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 021'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 021', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 9); - -// add a page -$pdf->AddPage(); - -// create some HTML content -$html = '

      Example of HTML text flow

      Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?

      A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B    ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B ->    A + B = C    ->    C - B = A    ->    C - A = B

      BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined BoldItalicUnderlined'; - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, 0); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_021.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_022.php b/vendor/tecnickcom/tcpdf/examples/example_022.php deleted file mode 100644 index 416108a..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_022.php +++ /dev/null @@ -1,148 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 022'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 022', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// check also the following methods: -// setDrawColorArray() -// setFillColorArray() -// setTextColorArray() - -// set font -$pdf->setFont('helvetica', 'B', 18); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of CMYK, RGB and Grayscale colours', '', 0, 'L', true, 0, false, false, 0); - -// define style for border -$border_style = array('all' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'phase' => 0)); - -// --- CMYK ------------------------------------------------ - -$pdf->setDrawColor(50, 0, 0, 0); -$pdf->setFillColor(100, 0, 0, 0); -$pdf->setTextColor(100, 0, 0, 0); -$pdf->Rect(30, 60, 30, 30, 'DF', $border_style); -$pdf->Text(30, 92, 'Cyan'); - -$pdf->setDrawColor(0, 50, 0, 0); -$pdf->setFillColor(0, 100, 0, 0); -$pdf->setTextColor(0, 100, 0, 0); -$pdf->Rect(70, 60, 30, 30, 'DF', $border_style); -$pdf->Text(70, 92, 'Magenta'); - -$pdf->setDrawColor(0, 0, 50, 0); -$pdf->setFillColor(0, 0, 100, 0); -$pdf->setTextColor(0, 0, 100, 0); -$pdf->Rect(110, 60, 30, 30, 'DF', $border_style); -$pdf->Text(110, 92, 'Yellow'); - -$pdf->setDrawColor(0, 0, 0, 50); -$pdf->setFillColor(0, 0, 0, 100); -$pdf->setTextColor(0, 0, 0, 100); -$pdf->Rect(150, 60, 30, 30, 'DF', $border_style); -$pdf->Text(150, 92, 'Black'); - -// --- RGB ------------------------------------------------- - -$pdf->setDrawColor(255, 127, 127); -$pdf->setFillColor(255, 0, 0); -$pdf->setTextColor(255, 0, 0); -$pdf->Rect(30, 110, 30, 30, 'DF', $border_style); -$pdf->Text(30, 142, 'Red'); - -$pdf->setDrawColor(127, 255, 127); -$pdf->setFillColor(0, 255, 0); -$pdf->setTextColor(0, 255, 0); -$pdf->Rect(70, 110, 30, 30, 'DF', $border_style); -$pdf->Text(70, 142, 'Green'); - -$pdf->setDrawColor(127, 127, 255); -$pdf->setFillColor(0, 0, 255); -$pdf->setTextColor(0, 0, 255); -$pdf->Rect(110, 110, 30, 30, 'DF', $border_style); -$pdf->Text(110, 142, 'Blue'); - -// --- GRAY ------------------------------------------------ - -$pdf->setDrawColor(191); -$pdf->setFillColor(127); -$pdf->setTextColor(127); -$pdf->Rect(30, 160, 30, 30, 'DF', $border_style); -$pdf->Text(30, 192, 'Gray'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_022.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_023.php b/vendor/tecnickcom/tcpdf/examples/example_023.php deleted file mode 100644 index 5a509ef..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_023.php +++ /dev/null @@ -1,115 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 023'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 023', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', 'BI', 14); - -// Start First Page Group -$pdf->startPageGroup(); - -// add a page -$pdf->AddPage(); - -// set some text to print -$txt = <<Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// add second page -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the second page of group 1', 0, 1, 'L'); - -// Start Second Page Group -$pdf->startPageGroup(); - -// add some pages -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the first page of group 2', 0, 1, 'L'); -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the second page of group 2', 0, 1, 'L'); -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the third page of group 2', 0, 1, 'L'); -$pdf->AddPage(); -$pdf->Cell(0, 10, 'This is the fourth page of group 2', 0, 1, 'L'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_023.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_024.php b/vendor/tecnickcom/tcpdf/examples/example_024.php deleted file mode 100644 index f786b11..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_024.php +++ /dev/null @@ -1,142 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 024'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 024', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', '', 18); - -// add a page -$pdf->AddPage(); - -/* - * setVisibility() allows to restrict the rendering of some - * elements to screen or printout. This can be useful, for - * instance, to put a background image or color that will - * show on screen but won't print. - */ - -$txt = 'You can limit the visibility of PDF objects to screen or printer by using the setVisibility() method. -Check the print preview of this document to display the alternative text.'; - -$pdf->Write(0, $txt, '', 0, '', true, 0, false, false, 0); - -// change font size -$pdf->setFontSize(40); - -// change text color -$pdf->setTextColor(0,63,127); - -// set visibility only for screen -$pdf->setVisibility('screen'); - -// write something only for screen -$pdf->Write(0, '[This line is for display]', '', 0, 'C', true, 0, false, false, 0); - -// set visibility only for print -$pdf->setVisibility('print'); - -// change text color -$pdf->setTextColor(127,0,0); - -// write something only for print -$pdf->Write(0, '[This line is for printout]', '', 0, 'C', true, 0, false, false, 0); - -// restore visibility -$pdf->setVisibility('all'); - -// --------------------------------------------------------- - -// LAYERS - -// start a new layer -$pdf->startLayer('layer1', true, true); - -// change font size -$pdf->setFontSize(18); - -// change text color -$pdf->setTextColor(0,127,0); - -$txt = 'Using the startLayer() method you can group PDF objects into layers. -This text is on "layer1".'; - -// write something -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// close the current layer -$pdf->endLayer(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_024.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_025.php b/vendor/tecnickcom/tcpdf/examples/example_025.php deleted file mode 100644 index 9e441be..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_025.php +++ /dev/null @@ -1,120 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 025'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 025', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 12); - -// add a page -$pdf->AddPage(); - -$txt = 'You can set the transparency of PDF objects using the setAlpha() method.'; -$pdf->Write(0, $txt, '', 0, '', true, 0, false, false, 0); - -/* - * setAlpha() gives transparency support. You can set the - * alpha channel from 0 (fully transparent) to 1 (fully - * opaque). It applies to all elements (text, drawings, - * images). - */ - -$pdf->setLineWidth(2); - -// draw opaque red square -$pdf->setFillColor(255, 0, 0); -$pdf->setDrawColor(127, 0, 0); -$pdf->Rect(30, 40, 60, 60, 'DF'); - -// set alpha to semi-transparency -$pdf->setAlpha(0.5); - -// draw green square -$pdf->setFillColor(0, 255, 0); -$pdf->setDrawColor(0, 127, 0); -$pdf->Rect(50, 60, 60, 60, 'DF'); - -// draw blue square -$pdf->setFillColor(0, 0, 255); -$pdf->setDrawColor(0, 0, 127); -$pdf->Rect(70, 80, 60, 60, 'DF'); - -// draw jpeg image -$pdf->Image('images/image_demo.jpg', 90, 100, 60, 60, '', 'http://www.tcpdf.org', '', true, 72); - -// restore full opacity -$pdf->setAlpha(1); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_025.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_026.php b/vendor/tecnickcom/tcpdf/examples/example_026.php deleted file mode 100644 index 8cde971..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_026.php +++ /dev/null @@ -1,146 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 026'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 026', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 22); - -// add a page -$pdf->AddPage(); - -// set color for text stroke -$pdf->setDrawColor(255,0,0); - - -$pdf->setTextRenderingMode($stroke=0, $fill=true, $clip=false); -$pdf->Write(0, 'Fill text', '', 0, '', true, 0, false, false, 0); - -$pdf->setTextRenderingMode($stroke=0.2, $fill=false, $clip=false); -$pdf->Write(0, 'Stroke text', '', 0, '', true, 0, false, false, 0); - -$pdf->setTextRenderingMode($stroke=0.2, $fill=true, $clip=false); -$pdf->Write(0, 'Fill, then stroke text', '', 0, '', true, 0, false, false, 0); - -$pdf->setTextRenderingMode($stroke=0, $fill=false, $clip=false); -$pdf->Write(0, 'Neither fill nor stroke text (invisible)', '', 0, '', true, 0, false, false, 0); - - -// * * * CLIPPING MODES * * * * * * * * * * * * * * * * * * - -$pdf->StartTransform(); -$pdf->setTextRenderingMode($stroke=0, $fill=true, $clip=true); -$pdf->Write(0, 'Fill text and add to path for clipping', '', 0, '', true, 0, false, false, 0); -$pdf->Image('images/image_demo.jpg', 15, 65, 170, 10, '', '', '', true, 72); -$pdf->StopTransform(); - -$pdf->StartTransform(); -$pdf->setTextRenderingMode($stroke=0.3, $fill=false, $clip=true); -$pdf->Write(0, 'Stroke text and add to path for clipping', '', 0, '', true, 0, false, false, 0); -$pdf->Image('images/image_demo.jpg', 15, 75, 170, 10, '', '', '', true, 72); -$pdf->StopTransform(); - -$pdf->StartTransform(); -$pdf->setTextRenderingMode($stroke=0.3, $fill=true, $clip=true); -$pdf->Write(0, 'Fill, then stroke text and add to path for clipping', '', 0, '', true, 0, false, false, 0); -$pdf->Image('images/image_demo.jpg', 15, 85, 170, 10, '', '', '', true, 72); -$pdf->StopTransform(); - -$pdf->StartTransform(); -$pdf->setTextRenderingMode($stroke=0, $fill=false, $clip=true); -$pdf->Write(0, 'Add text to path for clipping', '', 0, '', true, 0, false, false, 0); -$pdf->Image('images/image_demo.jpg', 15, 95, 170, 10, '', '', '', true, 72); -$pdf->StopTransform(); - -// reset text rendering mode -$pdf->setTextRenderingMode($stroke=0, $fill=true, $clip=false); - -// * * * HTML MODE * * * * * * * * * * * * * * * * * * * * * - -// The following attributes were added to HTML: -// stroke : stroke width -// strokecolor : stroke color -// fill : true (default) to fill the font, false otherwise - - -// create some HTML content with text rendering modes -$html = 'HTML Fill text
      '; -$html .= 'HTML Stroke text
      '; -$html .= 'HTML Fill, then stroke text
      '; -$html .= 'HTML Neither fill nor stroke text (invisible)
      '; - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_026.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_027.php b/vendor/tecnickcom/tcpdf/examples/example_027.php deleted file mode 100644 index d739984..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_027.php +++ /dev/null @@ -1,420 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 027'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 027', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set a barcode on the page footer -$pdf->setBarcode(date('Y-m-d H:i:s')); - -// set font -$pdf->setFont('helvetica', '', 11); - -// add a page -$pdf->AddPage(); - -// print a message -$txt = "You can also export 1D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcodes directory.\n"; -$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false); -$pdf->setY(30); - -// ----------------------------------------------------------------------------- - -$pdf->setFont('helvetica', '', 10); - -// define barcode style -$style = array( - 'position' => '', - 'align' => 'C', - 'stretch' => false, - 'fitwidth' => true, - 'cellfitalign' => '', - 'border' => true, - 'hpadding' => 'auto', - 'vpadding' => 'auto', - 'fgcolor' => array(0,0,0), - 'bgcolor' => false, //array(255,255,255), - 'text' => true, - 'font' => 'helvetica', - 'fontsize' => 8, - 'stretchtext' => 4 -); - -// PRINT VARIOUS 1D BARCODES - -// CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9. -$pdf->Cell(0, 0, 'CODE 39 - ANSI MH10.8M-1983 - USD-3 - 3 of 9', 0, 1); -$pdf->write1DBarcode('CODE 39', 'C39', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 39 + CHECKSUM -$pdf->Cell(0, 0, 'CODE 39 + CHECKSUM', 0, 1); -$pdf->write1DBarcode('CODE 39 +', 'C39+', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 39 EXTENDED -$pdf->Cell(0, 0, 'CODE 39 EXTENDED', 0, 1); -$pdf->write1DBarcode('CODE 39 E', 'C39E', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 39 EXTENDED + CHECKSUM -$pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1); -$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 93 - USS-93 -$pdf->Cell(0, 0, 'CODE 93 - USS-93', 0, 1); -$pdf->write1DBarcode('TEST93', 'C93', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// Standard 2 of 5 -$pdf->Cell(0, 0, 'Standard 2 of 5', 0, 1); -$pdf->write1DBarcode('1234567', 'S25', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// Standard 2 of 5 + CHECKSUM -$pdf->Cell(0, 0, 'Standard 2 of 5 + CHECKSUM', 0, 1); -$pdf->write1DBarcode('1234567', 'S25+', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// Interleaved 2 of 5 -$pdf->Cell(0, 0, 'Interleaved 2 of 5', 0, 1); -$pdf->write1DBarcode('1234567', 'I25', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// Interleaved 2 of 5 + CHECKSUM -$pdf->Cell(0, 0, 'Interleaved 2 of 5 + CHECKSUM', 0, 1); -$pdf->write1DBarcode('1234567', 'I25+', '', '', '', 18, 0.4, $style, 'N'); - - -// add a page ---------- -$pdf->AddPage(); - -// CODE 128 AUTO -$pdf->Cell(0, 0, 'CODE 128 AUTO', 0, 1); -$pdf->write1DBarcode('CODE 128 AUTO', 'C128', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 128 A -$pdf->Cell(0, 0, 'CODE 128 A', 0, 1); -$pdf->write1DBarcode('CODE 128 A', 'C128A', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 128 B -$pdf->Cell(0, 0, 'CODE 128 B', 0, 1); -$pdf->write1DBarcode('CODE 128 B', 'C128B', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 128 C -$pdf->Cell(0, 0, 'CODE 128 C', 0, 1); -$pdf->write1DBarcode('0123456789', 'C128C', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// EAN 8 -$pdf->Cell(0, 0, 'EAN 8', 0, 1); -$pdf->write1DBarcode('1234567', 'EAN8', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// EAN 13 -$pdf->Cell(0, 0, 'EAN 13', 0, 1); -$pdf->write1DBarcode('1234567890128', 'EAN13', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// UPC-A -$pdf->Cell(0, 0, 'UPC-A', 0, 1); -$pdf->write1DBarcode('12345678901', 'UPCA', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// UPC-E -$pdf->Cell(0, 0, 'UPC-E', 0, 1); -$pdf->write1DBarcode('04210000526', 'UPCE', '', '', '', 18, 0.4, $style, 'N'); - -// add a page ---------- -$pdf->AddPage(); - -// 5-Digits UPC-Based Extension -$pdf->Cell(0, 0, '5-Digits UPC-Based Extension', 0, 1); -$pdf->write1DBarcode('51234', 'EAN5', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// 2-Digits UPC-Based Extension -$pdf->Cell(0, 0, '2-Digits UPC-Based Extension', 0, 1); -$pdf->write1DBarcode('34', 'EAN2', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// MSI -$pdf->Cell(0, 0, 'MSI', 0, 1); -$pdf->write1DBarcode('80523', 'MSI', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// MSI + CHECKSUM (module 11) -$pdf->Cell(0, 0, 'MSI + CHECKSUM (module 11)', 0, 1); -$pdf->write1DBarcode('80523', 'MSI+', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODABAR -$pdf->Cell(0, 0, 'CODABAR', 0, 1); -$pdf->write1DBarcode('123456789', 'CODABAR', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// CODE 11 -$pdf->Cell(0, 0, 'CODE 11', 0, 1); -$pdf->write1DBarcode('123-456-789', 'CODE11', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// PHARMACODE -$pdf->Cell(0, 0, 'PHARMACODE', 0, 1); -$pdf->write1DBarcode('789', 'PHARMA', '', '', '', 18, 0.4, $style, 'N'); - -$pdf->Ln(); - -// PHARMACODE TWO-TRACKS -$pdf->Cell(0, 0, 'PHARMACODE TWO-TRACKS', 0, 1); -$pdf->write1DBarcode('105', 'PHARMA2T', '', '', '', 18, 2, $style, 'N'); - -// add a page ---------- -$pdf->AddPage(); - -// IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200 -$pdf->Cell(0, 0, 'IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200', 0, 1); -$pdf->write1DBarcode('01234567094987654321-01234567891', 'IMB', '', '', '', 15, 0.6, $style, 'N'); - -$pdf->Ln(); - -// POSTNET -$pdf->Cell(0, 0, 'POSTNET', 0, 1); -$pdf->write1DBarcode('98000', 'POSTNET', '', '', '', 15, 0.6, $style, 'N'); - -$pdf->Ln(); - -// PLANET -$pdf->Cell(0, 0, 'PLANET', 0, 1); -$pdf->write1DBarcode('98000', 'PLANET', '', '', '', 15, 0.6, $style, 'N'); - -$pdf->Ln(); - -// RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code) -$pdf->Cell(0, 0, 'RMS4CC (Royal Mail 4-state Customer Code) - CBC (Customer Bar Code)', 0, 1); -$pdf->write1DBarcode('SN34RD1A', 'RMS4CC', '', '', '', 15, 0.6, $style, 'N'); - -$pdf->Ln(); - -// KIX (Klant index - Customer index) -$pdf->Cell(0, 0, 'KIX (Klant index - Customer index)', 0, 1); -$pdf->write1DBarcode('SN34RDX1A', 'KIX', '', '', '', 15, 0.6, $style, 'N'); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// TEST BARCODE ALIGNMENTS - -// add a page -$pdf->AddPage(); - -// set a background color -$style['bgcolor'] = array(255,255,240); -$style['fgcolor'] = array(127,0,0); - -// Left position -$style['position'] = 'L'; -$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Center position -$style['position'] = 'C'; -$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Right position -$style['position'] = 'R'; -$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -$style['fgcolor'] = array(0,127,0); -$style['position'] = ''; -$style['stretch'] = false; // disable stretch -$style['fitwidth'] = false; // disable fitwidth - -// Left alignment -$style['align'] = 'L'; -$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Center alignment -$style['align'] = 'C'; -$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Right alignment -$style['align'] = 'R'; -$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -$style['fgcolor'] = array(0,64,127); -$style['position'] = ''; -$style['stretch'] = false; // disable stretch -$style['fitwidth'] = true; // disable fitwidth - -// Left alignment -$style['cellfitalign'] = 'L'; -$pdf->write1DBarcode('LEFT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Center alignment -$style['cellfitalign'] = 'C'; -$pdf->write1DBarcode('CENTER', 'C128A', 105, '', 90, 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Right alignment -$style['cellfitalign'] = 'R'; -$pdf->write1DBarcode('RIGHT', 'C128A', 105, '', 90, 15, 0.4, $style, 'N'); - -$pdf->Ln(2); -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -$style['fgcolor'] = array(127,0,127); - -// Left alignment -$style['position'] = 'L'; -$pdf->write1DBarcode('LEFT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Center alignment -$style['position'] = 'C'; -$pdf->write1DBarcode('CENTER', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -$pdf->Ln(2); - -// Right alignment -$style['position'] = 'R'; -$pdf->write1DBarcode('RIGHT', 'C128A', '', '', '', 15, 0.4, $style, 'N'); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// TEST BARCODE STYLE - -// define barcode style -$style = array( - 'position' => '', - 'align' => '', - 'stretch' => true, - 'fitwidth' => false, - 'cellfitalign' => '', - 'border' => true, - 'hpadding' => 'auto', - 'vpadding' => 'auto', - 'fgcolor' => array(0,0,128), - 'bgcolor' => array(255,255,128), - 'text' => true, - 'label' => 'CUSTOM LABEL', - 'font' => 'helvetica', - 'fontsize' => 8, - 'stretchtext' => 4 -); - -// CODE 39 EXTENDED + CHECKSUM -$pdf->Cell(0, 0, 'CODE 39 EXTENDED + CHECKSUM', 0, 1); -$pdf->setLineStyle(array('width' => 1, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0))); -$pdf->write1DBarcode('CODE 39 E+', 'C39E+', '', '', 120, 25, 0.4, $style, 'N'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_027.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_028.php b/vendor/tecnickcom/tcpdf/examples/example_028.php deleted file mode 100644 index 312de99..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_028.php +++ /dev/null @@ -1,140 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 028'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// remove default header/footer -$pdf->setPrintHeader(false); -$pdf->setPrintFooter(false); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(10, PDF_MARGIN_TOP, 10); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -$pdf->setDisplayMode('fullpage', 'SinglePage', 'UseNone'); - -// set font -$pdf->setFont('times', 'B', 20); - -$pdf->AddPage('P', 'A4'); -$pdf->Cell(0, 0, 'A4 PORTRAIT', 1, 1, 'C'); - -$pdf->AddPage('L', 'A4'); -$pdf->Cell(0, 0, 'A4 LANDSCAPE', 1, 1, 'C'); - -$pdf->AddPage('P', 'A5'); -$pdf->Cell(0, 0, 'A5 PORTRAIT', 1, 1, 'C'); - -$pdf->AddPage('L', 'A5'); -$pdf->Cell(0, 0, 'A5 LANDSCAPE', 1, 1, 'C'); - -$pdf->AddPage('P', 'A6'); -$pdf->Cell(0, 0, 'A6 PORTRAIT', 1, 1, 'C'); - -$pdf->AddPage('L', 'A6'); -$pdf->Cell(0, 0, 'A6 LANDSCAPE', 1, 1, 'C'); - -$pdf->AddPage('P', 'A7'); -$pdf->Cell(0, 0, 'A7 PORTRAIT', 1, 1, 'C'); - -$pdf->AddPage('L', 'A7'); -$pdf->Cell(0, 0, 'A7 LANDSCAPE', 1, 1, 'C'); - - -// --- test backward editing --- - - -$pdf->setPage(1, true); -$pdf->setY(50); -$pdf->Cell(0, 0, 'A4 test', 1, 1, 'C'); - -$pdf->setPage(2, true); -$pdf->setY(50); -$pdf->Cell(0, 0, 'A4 test', 1, 1, 'C'); - -$pdf->setPage(3, true); -$pdf->setY(50); -$pdf->Cell(0, 0, 'A5 test', 1, 1, 'C'); - -$pdf->setPage(4, true); -$pdf->setY(50); -$pdf->Cell(0, 0, 'A5 test', 1, 1, 'C'); - -$pdf->setPage(5, true); -$pdf->setY(50); -$pdf->Cell(0, 0, 'A6 test', 1, 1, 'C'); - -$pdf->setPage(6, true); -$pdf->setY(50); -$pdf->Cell(0, 0, 'A6 test', 1, 1, 'C'); - -$pdf->setPage(7, true); -$pdf->setY(40); -$pdf->Cell(0, 0, 'A7 test', 1, 1, 'C'); - -$pdf->setPage(8, true); -$pdf->setY(40); -$pdf->Cell(0, 0, 'A7 test', 1, 1, 'C'); - -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_028.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_029.php b/vendor/tecnickcom/tcpdf/examples/example_029.php deleted file mode 100644 index fd7b6d8..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_029.php +++ /dev/null @@ -1,126 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 029'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 029', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set array for viewer preferences -$preferences = array( - 'HideToolbar' => true, - 'HideMenubar' => true, - 'HideWindowUI' => true, - 'FitWindow' => true, - 'CenterWindow' => true, - 'DisplayDocTitle' => true, - 'NonFullScreenPageMode' => 'UseNone', // UseNone, UseOutlines, UseThumbs, UseOC - 'ViewArea' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox - 'ViewClip' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox - 'PrintArea' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox - 'PrintClip' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox - 'PrintScaling' => 'AppDefault', // None, AppDefault - 'Duplex' => 'DuplexFlipLongEdge', // Simplex, DuplexFlipShortEdge, DuplexFlipLongEdge - 'PickTrayByPDFSize' => true, - 'PrintPageRange' => array(1,1,2,3), - 'NumCopies' => 2 -); - -// Check the example n. 60 for advanced page settings - -// set pdf viewer preferences -$pdf->setViewerPreferences($preferences); - -// set font -$pdf->setFont('times', '', 14); - -// add a page -$pdf->AddPage(); - -// print a line -$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 1', 1, 1, 'C'); - -$pdf->Ln(5); - -$pdf->Write(0, 'You can use the setViewerPreferences() method to change viewer preferences.', '', 0, 'L', true, 0, false, false, 0); - -// add a page -$pdf->AddPage(); -// print a line -$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 2', 0, 0, 'C'); - -// add a page -$pdf->AddPage(); -// print a line -$pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 3', 0, 0, 'C'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_029.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_030.php b/vendor/tecnickcom/tcpdf/examples/example_030.php deleted file mode 100644 index 4b57b7a..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_030.php +++ /dev/null @@ -1,190 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 030'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 030', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 20); - -// --- first page ------------------------------------------ - -// add a page -$pdf->AddPage(); - -$pdf->Cell(0, 0, 'TCPDF Gradients', 0, 1, 'C', 0, '', 0, false, 'T', 'M'); - -// set colors for gradients (r,g,b) or (grey 0-255) -$red = array(255, 0, 0); -$blue = array(0, 0, 200); -$yellow = array(255, 255, 0); -$green = array(0, 255, 0); -$white = array(255); -$black = array(0); - -// set the coordinates x1,y1,x2,y2 of the gradient (see linear_gradient_coords.jpg) -$coords = array(0, 0, 1, 0); - -// paint a linear gradient -$pdf->LinearGradient(20, 45, 80, 80, $red, $blue, $coords); - -// write label -$pdf->Text(20, 130, 'LinearGradient()'); - -// set the coordinates fx,fy,cx,cy,r of the gradient (see radial_gradient_coords.jpg) -$coords = array(0.5, 0.5, 1, 1, 1.2); - -// paint a radial gradient -$pdf->RadialGradient(110, 45, 80, 80, $white, $black, $coords); - -// write label -$pdf->Text(110, 130, 'RadialGradient()'); - -// paint a coons patch mesh with default coordinates -$pdf->CoonsPatchMesh(20, 155, 80, 80, $yellow, $blue, $green, $red); - -// write label -$pdf->Text(20, 240, 'CoonsPatchMesh()'); - -// set the coordinates for the cubic Bézier points x1,y1 ... x12, y12 of the patch (see coons_patch_mesh_coords.jpg) -$coords = array( - 0.00,0.00, 0.33,0.20, //lower left - 0.67,0.00, 1.00,0.00, 0.80,0.33, //lower right - 0.80,0.67, 1.00,1.00, 0.67,0.80, //upper right - 0.33,1.00, 0.00,1.00, 0.20,0.67, //upper left - 0.00,0.33); //lower left -$coords_min = 0; //minimum value of the coordinates -$coords_max = 1; //maximum value of the coordinates - -// paint a coons patch gradient with the above coordinates -$pdf->CoonsPatchMesh(110, 155, 80, 80, $yellow, $blue, $green, $red, $coords, $coords_min, $coords_max); - -// write label -$pdf->Text(110, 240, 'CoonsPatchMesh()'); - -// --- second page ----------------------------------------- -$pdf->AddPage(); - -// first patch: f = 0 -$patch_array[0]['f'] = 0; -$patch_array[0]['points'] = array( - 0.00,0.00, 0.33,0.00, - 0.67,0.00, 1.00,0.00, 1.00,0.33, - 0.8,0.67, 1.00,1.00, 0.67,0.8, - 0.33,1.80, 0.00,1.00, 0.00,0.67, - 0.00,0.33); -$patch_array[0]['colors'][0] = array('r' => 255, 'g' => 255, 'b' => 0); -$patch_array[0]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 255); -$patch_array[0]['colors'][2] = array('r' => 0, 'g' => 255,'b' => 0); -$patch_array[0]['colors'][3] = array('r' => 255, 'g' => 0,'b' => 0); - -// second patch - above the other: f = 2 -$patch_array[1]['f'] = 2; -$patch_array[1]['points'] = array( - 0.00,1.33, - 0.00,1.67, 0.00,2.00, 0.33,2.00, - 0.67,2.00, 1.00,2.00, 1.00,1.67, - 1.5,1.33); -$patch_array[1]['colors'][0]=array('r' => 0, 'g' => 0, 'b' => 0); -$patch_array[1]['colors'][1]=array('r' => 255, 'g' => 0, 'b' => 255); - -// third patch - right of the above: f = 3 -$patch_array[2]['f'] = 3; -$patch_array[2]['points'] = array( - 1.33,0.80, - 1.67,1.50, 2.00,1.00, 2.00,1.33, - 2.00,1.67, 2.00,2.00, 1.67,2.00, - 1.33,2.00); -$patch_array[2]['colors'][0] = array('r' => 0, 'g' => 255, 'b' => 255); -$patch_array[2]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 0); - -// fourth patch - below the above, which means left(?) of the above: f = 1 -$patch_array[3]['f'] = 1; -$patch_array[3]['points'] = array( - 2.00,0.67, - 2.00,0.33, 2.00,0.00, 1.67,0.00, - 1.33,0.00, 1.00,0.00, 1.00,0.33, - 0.8,0.67); -$patch_array[3]['colors'][0] = array('r' => 0, 'g' => 0, 'b' => 0); -$patch_array[3]['colors'][1] = array('r' => 0, 'g' => 0, 'b' => 255); - -$coords_min = 0; -$coords_max = 2; - -$pdf->CoonsPatchMesh(10, 45, 190, 200, '', '', '', '', $patch_array, $coords_min, $coords_max); - -// write label -$pdf->Text(10, 250, 'CoonsPatchMesh()'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_030.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_031.php b/vendor/tecnickcom/tcpdf/examples/example_031.php deleted file mode 100644 index 354ffcd..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_031.php +++ /dev/null @@ -1,105 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 031'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 031', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of PieSector() method.'); - -$xc = 105; -$yc = 100; -$r = 50; - -$pdf->setFillColor(0, 0, 255); -$pdf->PieSector($xc, $yc, $r, 20, 120, 'FD', false, 0, 2); - -$pdf->setFillColor(0, 255, 0); -$pdf->PieSector($xc, $yc, $r, 120, 250, 'FD', false, 0, 2); - -$pdf->setFillColor(255, 0, 0); -$pdf->PieSector($xc, $yc, $r, 250, 20, 'FD', false, 0, 2); - -// write labels -$pdf->setTextColor(255,255,255); -$pdf->Text(105, 65, 'BLUE'); -$pdf->Text(60, 95, 'GREEN'); -$pdf->Text(120, 115, 'RED'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_031.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_032.php b/vendor/tecnickcom/tcpdf/examples/example_032.php deleted file mode 100644 index dbba89a..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_032.php +++ /dev/null @@ -1,93 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 032'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 032', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 12); - -$pdf->AddPage(); - -$html = << -NOTE: Please use SVG format for a better vector support. -EOD; - -// Print text using writeHTMLCell() -$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); - -$pdf->ImageEps('images/tcpdf_box.ai', 10, 40, 150, '', 'http://www.tcpdf.org', true, '', '', 0, false); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_032.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_033.php b/vendor/tecnickcom/tcpdf/examples/example_033.php deleted file mode 100644 index 3696e52..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_033.php +++ /dev/null @@ -1,107 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 033'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 033', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// add a page -$pdf->AddPage(); - -// set default font subsetting mode -$pdf->setFontSubsetting(false); - -$pdf->setFont('helvetica', 'B', 20); - -$pdf->Write(0, 'Font Types', '', 0, 'C', 1, 0, false, false, 0); - -$pdf->Ln(10); - -$pdf->setFont('times', '', 10); - -$pdf->MultiCell(80, 0, "[Core font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0); - -$pdf->Ln(2); - -$pdf->setFont('dejavusans', '', 10); - -$pdf->MultiCell(80, 0, "[True Type Unicode font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0); - -$pdf->Ln(2); - -$pdf->setFont('cid0jp', '', 9); - -$pdf->MultiCell(80, 0, "[CID-0 font] : Cras eros leo, porttitor porta, accumsan fermentum, ornare ac, est. Praesent dui lorem, imperdiet at, cursus sed, facilisis aliquam, nibh. Nulla accumsan nonummy diam. Donec tempus. Etiam posuere. Proin lectus. Donec purus. Duis in sem pretium urna feugiat vehicula. Ut suscipit velit eget massa. Nam nonummy, enim commodo euismod placerat, tortor elit tempus lectus, quis suscipit metus lorem blandit turpis.\n", 1, 'J', 0, 1, '', '', true, 0); - - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_033.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_034.php b/vendor/tecnickcom/tcpdf/examples/example_034.php deleted file mode 100644 index 29b1563..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_034.php +++ /dev/null @@ -1,98 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 034'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 034', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Image Clipping using geometric functions', '', 0, 'C', 1, 0, false, false, 0); - -//Start Graphic Transformation -$pdf->StartTransform(); - -// set clipping mask -$pdf->StarPolygon(105, 100, 30, 10, 3, 0, 1, 'CNZ'); - -// draw jpeg image to be clipped -$pdf->Image('images/image_demo.jpg', 75, 70, 60, 60, '', 'http://www.tcpdf.org', '', true, 72); - -//Stop Graphic Transformation -$pdf->StopTransform(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_034.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_035.php b/vendor/tecnickcom/tcpdf/examples/example_035.php deleted file mode 100644 index 78cf993..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_035.php +++ /dev/null @@ -1,113 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 035'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 035', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', 'BI', 16); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of SetLineStyle() method', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(); - -$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 4, 'color' => array(255, 0, 0))); -$pdf->setFillColor(255,255,128); -$pdf->setTextColor(0,0,128); - -$text="DUMMY"; - -$pdf->Cell(0, 0, $text, 1, 1, 'L', 1, 0); - -$pdf->Ln(); - -$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255))); -$pdf->setFillColor(255,255,0); -$pdf->setTextColor(0,0,255); -$pdf->MultiCell(60, 4, $text, 1, 'C', 1, 0); - -$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 255, 0))); -$pdf->setFillColor(0,0,255); -$pdf->setTextColor(255,255,0); -$pdf->MultiCell(60, 4, $text, 'TB', 'C', 1, 0); - -$pdf->setLineStyle(array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 255))); -$pdf->setFillColor(0,255,0); -$pdf->setTextColor(255,0,255); -$pdf->MultiCell(60, 4, $text, 1, 'C', 1, 1); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_035.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_036.php b/vendor/tecnickcom/tcpdf/examples/example_036.php deleted file mode 100644 index 195d139..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_036.php +++ /dev/null @@ -1,91 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 036'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 036', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', '', 16); - -// add a page -$pdf->AddPage(); - -$txt = 'Example of Text Annotation. -Move your mouse over the yellow box or double click on it to display the annotation text.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// text annotation -$pdf->Annotation(83, 27, 10, 10, "Text annotation example\naccented letters test: àèéìòù", array('Subtype'=>'Text', 'Name' => 'Comment', 'T' => 'title example', 'Subj' => 'example', 'C' => array(255, 255, 0))); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_036.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_037.php b/vendor/tecnickcom/tcpdf/examples/example_037.php deleted file mode 100644 index af705b4..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_037.php +++ /dev/null @@ -1,149 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 037'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 037', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 11); - -// add a page -$pdf->AddPage(); - -$html = '

      Example of Spot Colors

      Spot colors are single ink colors, rather than colors produced by four (CMYK), six (CMYKOG) or more inks in the printing process (process colors). They can be obtained by special vendors, but often the printers have found their own way of mixing inks to match defined colors.

      As long as no open standard for spot colours exists, TCPDF users will have to buy a colour book by one of the colour manufacturers and insert the values and names of spot colours directly into the $spotcolor array in include/tcpdf_colors.php file, or define them using the AddSpotColor() method.

      Common industry standard spot colors are:
      ANPA-COLOR, DIC, FOCOLTONE, GCMI, HKS, PANTONE, TOYO, TRUMATCH.'; - -// Print text using writeHTMLCell() -$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, 'J', true); - - -$pdf->setFont('helvetica', '', 10); - -// Define some new spot colors -// $c, $m, $y and $k (2nd, 3rd, 4th and 5th parameter) are the CMYK color components. -// AddSpotColor($name, $c, $m, $y, $k) - -$pdf->AddSpotColor('My TCPDF Dark Green', 100, 50, 80, 45); -$pdf->AddSpotColor('My TCPDF Light Yellow', 0, 0, 55, 0); -$pdf->AddSpotColor('My TCPDF Black', 0, 0, 0, 100); -$pdf->AddSpotColor('My TCPDF Red', 30, 100, 90, 10); -$pdf->AddSpotColor('My TCPDF Green', 100, 30, 100, 0); -$pdf->AddSpotColor('My TCPDF Blue', 100, 60, 10, 5); -$pdf->AddSpotColor('My TCPDF Yellow', 0, 20, 100, 0); - -// Select the spot color -// $tint (the second parameter) is the intensity of the color (0-100). -// setTextSpotColor($name, $tint=100) -// setDrawSpotColor($name, $tint=100) -// setFillSpotColor($name, $tint=100) - -$pdf->setTextSpotColor('My TCPDF Black', 100); -$pdf->setDrawSpotColor('My TCPDF Black', 100); - -$starty = 100; - -// print some spot colors - -$pdf->setFillSpotColor('My TCPDF Dark Green', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Dark Green'); - -$starty += 24; -$pdf->setFillSpotColor('My TCPDF Light Yellow', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Light Yellow'); - - -// --- default values defined on spotcolors.php --- - -$starty += 24; -$pdf->setFillSpotColor('My TCPDF Red', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Red'); - -$starty += 24; -$pdf->setFillSpotColor('My TCPDF Green', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Green'); - -$starty += 24; -$pdf->setFillSpotColor('My TCPDF Blue', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Blue'); - -$starty += 24; -$pdf->setFillSpotColor('My TCPDF Yellow', 100); -$pdf->Rect(30, $starty, 40, 20, 'DF'); -$pdf->Text(73, $starty + 8, 'My TCPDF Yellow'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_037.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_038.php b/vendor/tecnickcom/tcpdf/examples/example_038.php deleted file mode 100644 index 568610a..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_038.php +++ /dev/null @@ -1,94 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 038'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 038', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 20); - -// add a page -$pdf->AddPage(); - -$txt = 'Example of CID-0 CJK unembedded font. -To display extended text you must have CJK fonts installed for your PDF reader:'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// set font -$pdf->setFont('cid0jp', '', 40); - -$txt = 'こんにちは世界'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_038.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_039.php b/vendor/tecnickcom/tcpdf/examples/example_039.php deleted file mode 100644 index 0eabd08..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_039.php +++ /dev/null @@ -1,106 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 039'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 039', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// add a page -$pdf->AddPage(); - -// set font -$pdf->setFont('helvetica', 'B', 20); - -$pdf->Write(0, 'Example of HTML Justification', '', 0, 'L', true, 0, false, false, 0); - -// create some HTML content -$html = 'a abc abcdefghijkl (abcdef) abcdefg abcdefghi a ((abc)) abcd test alt attribute abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc \(abcd\) abcdef abcdefg abcdefghi a abc \\\(abcd\\\) abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg start a abc before yellow color after a abc abcd abcdef abcdefg abcdefghi a abc abcd end abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi a abc abcd abcdef abcdefg abcdefghi
      abcd abcdef abcdefg abcdefghi
      abcd abcde abcdef
      '; - -// set core font -$pdf->setFont('helvetica', '', 10); - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, true); - -$pdf->Ln(); - -// set UTF-8 Unicode font -$pdf->setFont('dejavusans', '', 10); - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, true); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_039.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_040.php b/vendor/tecnickcom/tcpdf/examples/example_040.php deleted file mode 100644 index 9703708..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_040.php +++ /dev/null @@ -1,118 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 040'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 040', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set display mode -$pdf->setDisplayMode($zoom='fullpage', $layout='TwoColumnRight', $mode='UseNone'); - -// set pdf viewer preferences -$pdf->setViewerPreferences(array('Duplex' => 'DuplexFlipLongEdge')); - -// set booklet mode -$pdf->setBooklet(true, 10, 30); - -// set core font -$pdf->setFont('helvetica', '', 18); - -// add a page (left page) -$pdf->AddPage(); - -$pdf->Write(0, 'Example of booklet mode', '', 0, 'L', true, 0, false, false, 0); - -// print a line using Cell() -$pdf->Cell(0, 0, 'PAGE 1', 1, 1, 'C'); - - -// add a page (right page) -$pdf->AddPage(); - -// print a line using Cell() -$pdf->Cell(0, 0, 'PAGE 2', 1, 1, 'C'); - - -// add a page (left page) -$pdf->AddPage(); - -// print a line using Cell() -$pdf->Cell(0, 0, 'PAGE 3', 1, 1, 'C'); - -// add a page (right page) -$pdf->AddPage(); - -// print a line using Cell() -$pdf->Cell(0, 0, 'PAGE 4', 1, 1, 'C'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_040.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_041.php b/vendor/tecnickcom/tcpdf/examples/example_041.php deleted file mode 100644 index 68ba81c..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_041.php +++ /dev/null @@ -1,93 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 041'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 041', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', '', 16); - -// add a page -$pdf->AddPage(); - - -$txt = 'Example of File Attachment. -Double click on the icon to open the attached file.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// attach an external file -$pdf->Annotation(85, 27, 5, 5, 'text file', array('Subtype'=>'FileAttachment', 'Name' => 'PushPin', 'FS' => 'data/utf8test.txt')); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_041.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_042.php b/vendor/tecnickcom/tcpdf/examples/example_042.php deleted file mode 100644 index 039e3e1..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_042.php +++ /dev/null @@ -1,104 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 042'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 042', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set JPEG quality -//$pdf->setJPEGQuality(75); - -$pdf->setFont('helvetica', '', 18); - -// add a page -$pdf->AddPage(); - -// create background text -$background_text = str_repeat('TCPDF test PNG Alpha Channel ', 50); -$pdf->MultiCell(0, 5, $background_text, 0, 'J', 0, 2, '', '', true, 0, false); - -// --- Method (A) ------------------------------------------ -// the Image() method recognizes the alpha channel embedded on the image: - -$pdf->Image('images/image_with_alpha.png', 50, 50, 100, '', '', 'http://www.tcpdf.org', '', false, 300); - -// --- Method (B) ------------------------------------------ -// provide image + separate 8-bit mask - -// first embed mask image (w, h, x and y will be ignored, the image will be scaled to the target image's size) -$mask = $pdf->Image('images/alpha.png', 50, 140, 100, '', '', '', '', false, 300, '', true); - -// embed image, masked with previously embedded mask -$pdf->Image('images/img.png', 50, 140, 100, '', '', 'http://www.tcpdf.org', '', false, 300, '', false, $mask); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_042.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_043.php b/vendor/tecnickcom/tcpdf/examples/example_043.php deleted file mode 100644 index d73e46a..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_043.php +++ /dev/null @@ -1,87 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 043'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 043', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 16); - -// add a page -$pdf->AddPage(); - -// Multicell test -$pdf->MultiCell(0, 0, 'DISK CACHING TEST: check the parameters of the class constructor.', 1, 'L', 0, 0, '', '', true); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_043.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_044.php b/vendor/tecnickcom/tcpdf/examples/example_044.php deleted file mode 100644 index 668ccc5..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_044.php +++ /dev/null @@ -1,130 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 044'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 044', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 40); - -// print a line using Cell() -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: A', 0, 1, 'L'); - -// add some vertical space -$pdf->Ln(10); - -// print some text -$pdf->setFont('times', 'I', 16); -$txt = 'TCPDF allows you to Copy, Move and Delete pages.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -$pdf->setFont('helvetica', 'B', 40); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: B', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: D', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: E', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: E-2', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: F', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: C', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: G', 0, 1, 'L'); - -// Move page 7 to page 3 -$pdf->movePage(7, 3); - -// Delete page 6 -$pdf->deletePage(6); - -$pdf->AddPage(); -$pdf->Cell(0, 10, 'PAGE: H', 0, 1, 'L'); - -// copy the second page -$pdf->copyPage(2); - -// NOTE: to insert a page to a previous position, you can add a new page to the end of document and then move it using movePage(). - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_044.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_045.php b/vendor/tecnickcom/tcpdf/examples/example_045.php deleted file mode 100644 index a7f6137..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_045.php +++ /dev/null @@ -1,143 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 045'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 045', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', 'B', 20); - -// add a page -$pdf->AddPage(); - -// set a bookmark for the current position -$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128)); - -// print a line using Cell() -$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); - -// Create a fixed link to the first page using the * character -$index_link = $pdf->AddLink(); -$pdf->setLink($index_link, 0, '*1'); -$pdf->Cell(0, 10, 'Link to INDEX', 0, 1, 'R', false, $index_link); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,128,0)); -$pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); - -// fixed link to the first page using the * character -$html = 'link to INDEX (page 1)'; -$pdf->writeHTML($html, true, false, true, false, ''); - - -// add some pages and bookmarks -for ($i = 2; $i < 12; $i++) { - $pdf->AddPage(); - $pdf->Bookmark('Chapter '.$i, 0, 0, '', 'B', array(0,64,128)); - $pdf->Cell(0, 10, 'Chapter '.$i, 0, 1, 'L'); -} - -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -// add a new page for TOC -$pdf->addTOCPage(); - -// write the TOC title -$pdf->setFont('times', 'B', 16); -$pdf->MultiCell(0, 0, 'Table Of Content', 0, 'C', 0, 1, '', '', true, 0); -$pdf->Ln(); - -$pdf->setFont('dejavusans', '', 12); - -// add a simple Table Of Content at first page -// (check the example n. 59 for the HTML version) -$pdf->addTOC(1, 'courier', '.', 'INDEX', 'B', array(128,0,0)); - -// end of TOC page -$pdf->endTOCPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_045.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_046.php b/vendor/tecnickcom/tcpdf/examples/example_046.php deleted file mode 100644 index 1071b54..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_046.php +++ /dev/null @@ -1,125 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 046'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 046', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of Text Hyphenation', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(10); - -/* -Unicode Data for SHY: - Name : SOFT HYPHEN, commonly abbreviated as SHY - HTML Entity (decimal): ­ - HTML Entity (hex): ­ - HTML Entity (named): ­ - How to type in Microsoft Windows: [Alt +00AD] or [Alt 0173] - UTF-8 (hex): 0xC2 0xAD (c2ad) -*/ - -/* -// You can automatically add SOFT HYPHENS to your text using -// the hyphenateText() method, but this requires either an -// hyphenation pattern array of a hyphenation pattern TEX file. -// You can download hyphenation TEX patterns from: -// http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/ - -// EXAMPLE: - -$html = 'On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.'; - -$hyphen_patterns = $pdf->getHyphenPatternsFromTEX('hyphens/hyph-en-gb.tex'); - -$html = $pdf->hyphenateText($html, $hyphen_patterns, array(), 1, 2, 1, 8); -*/ - - -// HTML text with soft hyphens (­) -$html = 'On the other hand, we de­nounce with righ­teous in­dig­na­tion and dis­like men who are so be­guiled and de­mo­r­al­ized by the charms of plea­sure of the mo­ment, so blind­ed by de­sire, that they can­not fore­see the pain and trou­ble that are bound to en­sue; and equal blame be­longs to those who fail in their du­ty through weak­ness of will, which is the same as say­ing through shrink­ing from toil and pain. Th­ese cas­es are per­fect­ly sim­ple and easy to distin­guish. In a free hour, when our pow­er of choice is un­tram­melled and when noth­ing pre­vents our be­ing able to do what we like best, ev­ery plea­sure is to be wel­comed and ev­ery pain avoid­ed. But in cer­tain cir­cum­s­tances and ow­ing to the claims of du­ty or the obli­ga­tions of busi­ness it will fre­quent­ly oc­cur that plea­sures have to be re­pu­di­at­ed and an­noy­ances ac­cept­ed. The wise man there­fore al­ways holds in th­ese mat­ters to this prin­ci­ple of se­lec­tion: he re­jects plea­sures to se­cure other greater plea­sures, or else he en­dures pains to avoid worse pains.'; - -$pdf->setFont('times', '', 10); -$pdf->setDrawColor(255,0,0); -$pdf->setTextColor(0,63,127); - -// print a cell -$pdf->writeHTMLCell(50, 0, '', '', $html, 1, 1, 0, true, 'J'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_046.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_047.php b/vendor/tecnickcom/tcpdf/examples/example_047.php deleted file mode 100644 index a6bd1f5..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_047.php +++ /dev/null @@ -1,119 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 047'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 047', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 16); - -// add a page -$pdf->AddPage(); - -$txt = 'Example of Transactions. -TCPDF allows you to undo some operations using the Transactions. -Check the source code for further information.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(5); - -$pdf->setFont('times', '', 12); - -// start transaction -$pdf->startTransaction(); - -$pdf->Write(0, "LINE 1\n"); -$pdf->Write(0, "LINE 2\n"); - -// restarts transaction -$pdf->startTransaction(); - -$pdf->Write(0, "LINE 3\n"); -$pdf->Write(0, "LINE 4\n"); - -// rolls back to the last (re)start -$pdf = $pdf->rollbackTransaction(); - -$pdf->Write(0, "LINE 5\n"); -$pdf->Write(0, "LINE 6\n"); - -// start transaction -$pdf->startTransaction(); - -$pdf->Write(0, "LINE 7\n"); - -// commit transaction (actually just frees memory) -$pdf->commitTransaction(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_047.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_048.php b/vendor/tecnickcom/tcpdf/examples/example_048.php deleted file mode 100644 index b7226fe..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_048.php +++ /dev/null @@ -1,316 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 048'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 048', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0); - -$pdf->setFont('helvetica', '', 8); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
      COLSPAN 3 - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
      text line
      text line
      text line
      text line - COL 3 - ROW 2 - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
      COLSPAN 3
      text line
      text line
      text line
      text line
      text line
      text line - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
      text line
      text line
      text line
      text line - COL 3 - ROW 2 - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
      COLSPAN 3
      text line
      text line
      text line
      text line
      text line
      text line - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
      text line
      text line
      text line
      text line - COL 3 - ROW 2
      text line
      text line - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - -Left column -Heading Column Span 5 -Heading Column Span 9 - - -Rowspan 2
      This is some text that fills the table cell. -span 2 -span 2 -2 rows -Colspan 8 - - -1a -2a -1b -2b -1 -2 -3 -4 -5 -6 -7 -8 - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -// Table with rowspans and THEAD -$tbl = << - - - A - XXXX - XXXX - XXXX - XXXX - XXXX - - - B - XXXX - XXXX - XXXX - XXXX - XXXX - - - - 1. - XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX - XXXX
      XXXX - XXXX
      XXXX - XXXX - XXXX
      XXXX - - - 2. - XXXX
      XXXX - XXXX
      XXXX - XXXX
      XXXX - XXXX
      XXXX - - - XXXX
      XXXX
      XXXX
      XXXX - XXXX
      XXXX - XXXX
      XXXX - - - RRRRRR
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX - XXXX
      XXXX - XXXX
      XXXX - - - 3. - XXXX1
      XXXX - XXXX
      XXXX - XXXX
      XXXX - - - 4. - XXXX
      XXXX - XXXX
      XXXX - XXXX
      XXXX - XXXX
      XXXX - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -// NON-BREAKING TABLE (nobr="true") - -$tbl = << - - NON-BREAKING TABLE - - - 1-1 - 1-2 - 1-3 - - - 2-1 - 3-2 - 3-3 - - - 3-1 - 3-2 - 3-3 - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -// NON-BREAKING ROWS (nobr="true") - -$tbl = << - - NON-BREAKING ROWS - - - ROW 1
      COLUMN 1 - ROW 1
      COLUMN 2 - ROW 1
      COLUMN 3 - - - ROW 2
      COLUMN 1 - ROW 2
      COLUMN 2 - ROW 2
      COLUMN 3 - - - ROW 3
      COLUMN 1 - ROW 3
      COLUMN 2 - ROW 3
      COLUMN 3 - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_048.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_049.php b/vendor/tecnickcom/tcpdf/examples/example_049.php deleted file mode 100644 index c8a8186..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_049.php +++ /dev/null @@ -1,128 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 049'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 049', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 10); - -// add a page -$pdf->AddPage(); - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - -IMPORTANT: -If you are printing user-generated content, the tcpdf tag should be considered unsafe. -This tag is disabled by default by the K_TCPDF_CALLS_IN_HTML constant on TCPDF configuration file. -Please use this feature only if you are in control of the HTML content and you are sure that it does not contain any harmful code. - -For security reasons, the content of the TCPDF tag must be prepared and encoded with the serializeTCPDFtag() method (see the example below). - - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - -$html = '

      Test TCPDF Methods in HTML

      -

      IMPORTANT:

      -If you are using user-generated content, the tcpdf tag should be considered unsafe.
      -Please use this feature only if you are in control of the HTML content and you are sure that it does not contain any harmful code.
      -This feature is disabled by default by the K_TCPDF_CALLS_IN_HTML constant on TCPDF configuration file.
      -

      write1DBarcode method in HTML

      '; - -$data = $pdf->serializeTCPDFtag('write1DBarcode', array('CODE 39', 'C39', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N')); -$html .= ''; - -$data = $pdf->serializeTCPDFtag('write1DBarcode', array('CODE 128', 'C128', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N')); -$html .= ''; - -$data = $pdf->serializeTCPDFtag('AddPage'); -$html .= '

      Graphic Functions

      '; - -$data = $pdf->serializeTCPDFtag('SetDrawColor', array(0)); -$html .= ''; - -$data = $pdf->serializeTCPDFtag('Rect', array(50, 50, 40, 10, 'DF', array(), array(0,128,255))); -$html .= ''; - - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, 0); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_049.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_050.php b/vendor/tecnickcom/tcpdf/examples/example_050.php deleted file mode 100644 index 6bbb299..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_050.php +++ /dev/null @@ -1,212 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 050'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 050', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// NOTE: 2D barcode algorithms must be implemented on 2dbarcode.php class file. - -// set font -$pdf->setFont('helvetica', '', 11); - -// add a page -$pdf->AddPage(); - -// print a message -$txt = "You can also export 2D barcodes in other formats (PNG, SVG, HTML). Check the examples inside the barcode directory.\n"; -$pdf->MultiCell(70, 50, $txt, 0, 'J', false, 1, 125, 30, true, 0, false, true, 0, 'T', false); - - -$pdf->setFont('helvetica', '', 10); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// set style for barcode -$style = array( - 'border' => true, - 'vpadding' => 'auto', - 'hpadding' => 'auto', - 'fgcolor' => array(0,0,0), - 'bgcolor' => false, //array(255,255,255) - 'module_width' => 1, // width of a single module in points - 'module_height' => 1 // height of a single module in points -); - -// write RAW 2D Barcode - -$code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010'; -$pdf->write2DBarcode($code, 'RAW', 80, 30, 30, 20, $style, 'N'); - -// write RAW2 2D Barcode -$code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]'; -$pdf->write2DBarcode($code, 'RAW2', 80, 60, 30, 20, $style, 'N'); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// set style for barcode -$style = array( - 'border' => 2, - 'vpadding' => 'auto', - 'hpadding' => 'auto', - 'fgcolor' => array(0,0,0), - 'bgcolor' => false, //array(255,255,255) - 'module_width' => 1, // width of a single module in points - 'module_height' => 1 // height of a single module in points -); - -// QRCODE,L : QR-CODE Low error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,L', 20, 30, 50, 50, $style, 'N'); -$pdf->Text(20, 25, 'QRCODE L'); - -// QRCODE,M : QR-CODE Medium error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,M', 20, 90, 50, 50, $style, 'N'); -$pdf->Text(20, 85, 'QRCODE M'); - -// QRCODE,Q : QR-CODE Better error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,Q', 20, 150, 50, 50, $style, 'N'); -$pdf->Text(20, 145, 'QRCODE Q'); - -// QRCODE,H : QR-CODE Best error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 20, 210, 50, 50, $style, 'N'); -$pdf->Text(20, 205, 'QRCODE H'); - -// ------------------------------------------------------------------- -// PDF417 (ISO/IEC 15438:2006) - -/* - - The $type parameter can be simple 'PDF417' or 'PDF417' followed by a - number of comma-separated options: - - 'PDF417,a,e,t,s,f,o0,o1,o2,o3,o4,o5,o6' - - Possible options are: - - a = aspect ratio (width/height); - e = error correction level (0-8); - - Macro Control Block options: - - t = total number of macro segments; - s = macro segment index (0-99998); - f = file ID; - o0 = File Name (text); - o1 = Segment Count (numeric); - o2 = Time Stamp (numeric); - o3 = Sender (text); - o4 = Addressee (text); - o5 = File Size (numeric); - o6 = Checksum (numeric). - - Parameters t, s and f are required for a Macro Control Block, all other parameters are optional. - To use a comma character ',' on text options, replace it with the character 255: "\xff". - -*/ - -$pdf->write2DBarcode('www.tcpdf.org', 'PDF417', 80, 90, 0, 30, $style, 'N'); -$pdf->Text(80, 85, 'PDF417 (ISO/IEC 15438:2006)'); - -// ------------------------------------------------------------------- -// DATAMATRIX (ISO/IEC 16022:2006) - -$pdf->write2DBarcode('http://www.tcpdf.org', 'DATAMATRIX', 80, 150, 50, 50, $style, 'N'); -$pdf->Text(80, 145, 'DATAMATRIX (ISO/IEC 16022:2006)'); - -// ------------------------------------------------------------------- - -// new style -$style = array( - 'border' => 2, - 'padding' => 'auto', - 'fgcolor' => array(0,0,255), - 'bgcolor' => array(255,255,64) -); - -// QRCODE,H : QR-CODE Best error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 80, 210, 50, 50, $style, 'N'); -$pdf->Text(80, 205, 'QRCODE H - COLORED'); - -// new style -$style = array( - 'border' => false, - 'padding' => 0, - 'fgcolor' => array(128,0,0), - 'bgcolor' => false -); - -// QRCODE,H : QR-CODE Best error correction -$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,H', 140, 210, 50, 50, $style, 'N'); -$pdf->Text(140, 205, 'QRCODE H - NO PADDING'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_050.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_051.php b/vendor/tecnickcom/tcpdf/examples/example_051.php deleted file mode 100644 index c3a9ce2..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_051.php +++ /dev/null @@ -1,148 +0,0 @@ -getBreakMargin(); - // get current auto-page-break mode - $auto_page_break = $this->AutoPageBreak; - // disable auto-page-break - $this->setAutoPageBreak(false, 0); - // set bacground image - $img_file = K_PATH_IMAGES.'image_demo.jpg'; - $this->Image($img_file, null, 0, 210, 297, '', '', '', false, 300, 'C', false, false, 0); - // restore auto-page-break status - $this->setAutoPageBreak($auto_page_break, $bMargin); - // set the starting point for the page content - $this->setPageMark(); - } -} - -// create new PDF document -$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 051'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(0); -$pdf->setFooterMargin(0); - -// remove default footer -$pdf->setPrintFooter(false); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', '', 48); - -// add a page -$pdf->AddPage(); - -// Print a text -$html = ' PAGE 1  -

      You can set a full page background.

      '; -$pdf->writeHTML($html, true, false, true, false, ''); - - -// add a page -$pdf->AddPage(); - -// Print a text -$html = ' PAGE 2 '; -$pdf->writeHTML($html, true, false, true, false, ''); - -// --- example with background set on page --- - -// remove default header -$pdf->setPrintHeader(false); - -// add a page -$pdf->AddPage(); - - -// -- set new background --- - -// get the current page break margin -$bMargin = $pdf->getBreakMargin(); -// get current auto-page-break mode -$auto_page_break = $pdf->getAutoPageBreak(); -// disable auto-page-break -$pdf->setAutoPageBreak(false, 0); -// set bacground image -$img_file = K_PATH_IMAGES.'image_demo.jpg'; -$pdf->Image($img_file, null, 0, 210, 297, '', '', '', false, 300, 'C', false, false, 0); -// restore auto-page-break status -$pdf->setAutoPageBreak($auto_page_break, $bMargin); -// set the starting point for the page content -$pdf->setPageMark(); - - -// Print a text -$html = 'PAGE 3'; -$pdf->writeHTML($html, true, false, true, false, ''); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_051.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_052.php b/vendor/tecnickcom/tcpdf/examples/example_052.php deleted file mode 100644 index 10cfb2e..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_052.php +++ /dev/null @@ -1,123 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 052'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 052', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -/* -NOTES: - - To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt - - To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12 - - To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes -*/ - -// set certificate file -$certificate = 'file://data/cert/tcpdf.crt'; - -// set additional information -$info = array( - 'Name' => 'TCPDF', - 'Location' => 'Office', - 'Reason' => 'Testing TCPDF', - 'ContactInfo' => 'http://www.tcpdf.org', - ); - -// set document signature -$pdf->setSignature($certificate, $certificate, 'tcpdfdemo', '', 2, $info); - -// set font. 'helvetica' MUST be used to avoid a PHP notice from PHP 7.4+ -$pdf->setFont('helvetica', '', 12); - -// add a page -$pdf->AddPage(); - -// print a line of text -$text = 'This is a digitally signed document using the default (example) tcpdf.crt certificate.
      To validate this signature you have to load the tcpdf.fdf on the Arobat Reader to add the certificate to List of Trusted Identities.

      For more information check the source code of this example and the source code documentation for the setSignature() method.

      www.tcpdf.org'; -$pdf->writeHTML($text, true, 0, true, 0); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// *** set signature appearance *** - -// create content for signature (image and/or text) -$pdf->Image('images/tcpdf_signature.png', 180, 60, 15, 15, 'PNG'); - -// define active area for signature appearance -$pdf->setSignatureAppearance(180, 60, 15, 15); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// *** set an empty signature appearance *** -$pdf->addEmptySignatureAppearance(180, 80, 15, 15); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_052.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_053.php b/vendor/tecnickcom/tcpdf/examples/example_053.php deleted file mode 100644 index dbeb67e..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_053.php +++ /dev/null @@ -1,110 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 053'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 053', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('times', '', 14); - -// add a page -$pdf->AddPage(); - -// print a some of text -$text = 'This is an example of JavaScript usage on PDF documents.

      For more information check the source code of this example, the source code documentation for the IncludeJS() method and the JavaScript for Acrobat API Reference guide.

      www.tcpdf.org'; -$pdf->writeHTML($text, true, 0, true, 0); - -// write some JavaScript code -$js = <<IncludeJS($js); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_053.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_054.php b/vendor/tecnickcom/tcpdf/examples/example_054.php deleted file mode 100644 index 3a5011d..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_054.php +++ /dev/null @@ -1,131 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 054'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 054', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// IMPORTANT: disable font subsetting to allow users editing the document -$pdf->setFontSubsetting(false); - -// set font. 'helvetica' MUST be used to avoid a PHP notice from PHP 7.4+ -$pdf->setFont('helvetica', '', 10, '', false); - -// add a page -$pdf->AddPage(); - -// create some HTML content -$html = <<XHTML Form Example -
      -
      -

      -

      -

      -
      -
      -

      - -

      - -


      -
      -
      -


      - - - - -
      -
      -EOD; - -// output the HTML content -$pdf->writeHTML($html, true, 0, true, 0); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_054.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_055.php b/vendor/tecnickcom/tcpdf/examples/example_055.php deleted file mode 100644 index 0f50da0..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_055.php +++ /dev/null @@ -1,118 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 055'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 055', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 14); - -// array of font names -$core_fonts = array('courier', 'courierB', 'courierI', 'courierBI', 'helvetica', 'helveticaB', 'helveticaI', 'helveticaBI', 'times', 'timesB', 'timesI', 'timesBI', 'symbol', 'zapfdingbats'); - -// set fill color -$pdf->setFillColor(221,238,255); - -// create one HTML table for each core font -foreach($core_fonts as $font) { - // add a page - $pdf->AddPage(); - - // Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') - - // set font for title - $pdf->setFont('helvetica', 'B', 16); - - // print font name - $pdf->Cell(0, 10, 'FONT: '.$font, 1, 1, 'C', true, '', 0, false, 'T', 'M'); - - // set font for chars - $pdf->setFont($font, '', 16); - - // print each character - for ($i = 0; $i < 256; ++$i) { - if (($i > 0) AND (($i % 16) == 0)) { - $pdf->Ln(); - } - $pdf->Cell(11.25, 11.25, TCPDF_FONTS::unichr($i), 1, 0, 'C', false, '', 0, false, 'T', 'M'); - } - - $pdf->Ln(20); - - // print a pangram - $pdf->Cell(0, 0, 'The quick brown fox jumps over the lazy dog', 0, 1, 'C', false, '', 0, false, 'T', 'M'); -} - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_055.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_056.php b/vendor/tecnickcom/tcpdf/examples/example_056.php deleted file mode 100644 index 40ef250..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_056.php +++ /dev/null @@ -1,135 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 056'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 056', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 18); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of Registration Marks, Crop Marks and Color Bars', '', 0, 'L', true, 0, false, false, 0); - -$pdf->Ln(5); - -// color registration bars - -// A,W,R,G,B,C,M,Y,K,RGB,CMYK,ALL,ALLSPOT, -$pdf->colorRegistrationBar(50, 70, 40, 40, true, false, 'A,R,G,B,C,M,Y,K'); -$pdf->colorRegistrationBar(90, 70, 40, 40, true, true, 'A,R,G,B,C,M,Y,K'); -$pdf->colorRegistrationBar(50, 115, 80, 5, false, true, 'A,W,R,G,B,C,M,Y,K,ALL'); -$pdf->colorRegistrationBar(135, 70, 5, 50, false, false, 'A,W,R,G,B,C,M,Y,K,ALL'); - -// corner crop marks - -$pdf->cropMark(50, 70, 10, 10, 'TL'); -$pdf->cropMark(140, 70, 10, 10, 'TR'); -$pdf->cropMark(50, 120, 10, 10, 'BL'); -$pdf->cropMark(140, 120, 10, 10, 'BR'); - -// various crop marks - -$pdf->cropMark(95, 65, 5, 5, 'LEFT,TOP,RIGHT', array(255,0,0)); -$pdf->cropMark(95, 125, 5, 5, 'LEFT,BOTTOM,RIGHT', array(255,0,0)); - -$pdf->cropMark(45, 95, 5, 5, 'TL,BL', array(0,255,0)); -$pdf->cropMark(145, 95, 5, 5, 'TR,BR', array(0,255,0)); - -$pdf->cropMark(95, 140, 5, 5, 'A,D', array(0,0,255)); - -// registration marks - -$pdf->registrationMark(40, 60, 5, false); -$pdf->registrationMark(150, 60, 5, true, array(0,0,0), array(255,255,0)); -$pdf->registrationMark(40, 130, 5, true, array(0,0,0), array(255,255,0)); -$pdf->registrationMark(150, 130, 5, false, array(100,100,100,100,'All'), array(0,0,0,0,'None')); - -// test registration bar with spot colors - -$pdf->AddSpotColor('My TCPDF Dark Green', 100, 50, 80, 45); -$pdf->AddSpotColor('My TCPDF Light Yellow', 0, 0, 55, 0); -$pdf->AddSpotColor('My TCPDF Black', 0, 0, 0, 100); -$pdf->AddSpotColor('My TCPDF Red', 30, 100, 90, 10); -$pdf->AddSpotColor('My TCPDF Green', 100, 30, 100, 0); -$pdf->AddSpotColor('My TCPDF Blue', 100, 60, 10, 5); -$pdf->AddSpotColor('My TCPDF Yellow', 0, 20, 100, 0); - -$pdf->colorRegistrationBar(50, 150, 80, 10, false, true, 'ALLSPOT'); - -// CMYK registration mark -$pdf->registrationMarkCMYK(150, 155, 8); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_056.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_057.php b/vendor/tecnickcom/tcpdf/examples/example_057.php deleted file mode 100644 index c0bbe4a..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_057.php +++ /dev/null @@ -1,270 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 057'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 057', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0); - -$pdf->setFont('helvetica', '', 11); - -// set border width -$pdf->setLineWidth(0.7); - -// set color for cell border -$pdf->setDrawColor(0,128,255); - -$pdf->setCellHeightRatio(3); - -$pdf->setXY(15, 60); - -// text on center -$pdf->Cell(30, 0, 'Top-Center', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'C'); -$pdf->Cell(30, 0, 'Center-Center', 1, $ln=0, 'C', 0, '', 0, false, 'C', 'C'); -$pdf->Cell(30, 0, 'Bottom-Center', 1, $ln=0, 'C', 0, '', 0, false, 'B', 'C'); -$pdf->Cell(30, 0, 'Ascent-Center', 1, $ln=0, 'C', 0, '', 0, false, 'A', 'C'); -$pdf->Cell(30, 0, 'Baseline-Center', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'C'); -$pdf->Cell(30, 0, 'Descent-Center', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'C'); - - -$pdf->setXY(15, 90); - -// text on top -$pdf->Cell(30, 0, 'Top-Top', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'T'); -$pdf->Cell(30, 0, 'Center-Top', 1, $ln=0, 'C', 0, '', 0, false, 'C', 'T'); -$pdf->Cell(30, 0, 'Bottom-Top', 1, $ln=0, 'C', 0, '', 0, false, 'B', 'T'); -$pdf->Cell(30, 0, 'Ascent-Top', 1, $ln=0, 'C', 0, '', 0, false, 'A', 'T'); -$pdf->Cell(30, 0, 'Baseline-Top', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'T'); -$pdf->Cell(30, 0, 'Descent-Top', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'T'); - - -$pdf->setXY(15, 120); - -// text on bottom -$pdf->Cell(30, 0, 'Top-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'B'); -$pdf->Cell(30, 0, 'Center-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'C', 'B'); -$pdf->Cell(30, 0, 'Bottom-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'B', 'B'); -$pdf->Cell(30, 0, 'Ascent-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'A', 'B'); -$pdf->Cell(30, 0, 'Baseline-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'B'); -$pdf->Cell(30, 0, 'Descent-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'B'); - - -// draw some reference lines -$linestyle = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(255, 0, 0)); -$pdf->Line(15, 60, 195, 60, $linestyle); -$pdf->Line(15, 90, 195, 90, $linestyle); -$pdf->Line(15, 120, 195, 120, $linestyle); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Print an image to explain cell measures - -$pdf->Image('images/tcpdf_cell.png', 15, 160, 100, 100, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false); -$legend = 'LEGEND: - -X: cell x top-left origin (top-right for RTL) -Y: cell y top-left origin (top-right for RTL) -CW: cell width -CH: cell height -LW: line width -NRL: normal line position -EXT: external line position -INT: internal line position -ML: margin left -MR: margin right -MT: margin top -MB: margin bottom -PL: padding left -PR: padding right -PT: padding top -PB: padding bottom -TW: text width -FA: font ascent -FB: font baseline -FD: font descent'; -$pdf->setFont('helvetica', '', 10); -$pdf->setCellHeightRatio(1.25); -$pdf->MultiCell(0, 0, $legend, 0, 'L', false, 1, 125, 160, true, 0, false, true, 0, 'T', false); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// CELL BORDERS - -// add a page -$pdf->AddPage(); - -$pdf->setFont('helvetica', 'B', 20); - -$pdf->Write(0, 'Example of borders for Cell()', '', 0, 'L', true, 0, false, false, 0); - -$pdf->setFont('helvetica', '', 11); - -// set border width -$pdf->setLineWidth(0.508); - -// set color for cell border -$pdf->setDrawColor(0,128,255); - -// set filling color -$pdf->setFillColor(255,255,128); - -// set cell height ratio -$pdf->setCellHeightRatio(3); - -$pdf->Cell(30, 0, '1', 1, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LTRB', 'LTRB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LTR', 'LTR', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'TRB', 'TRB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LRB', 'LRB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LTB', 'LTB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LT', 'LT', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'TR', 'TR', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'RB', 'RB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LB', 'LB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'LR', 'LR', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'TB', 'TB', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'L', 'L', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'T', 'T', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'R', 'R', 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(2); -$pdf->Cell(30, 0, 'B', 'B', 1, 'C', 1, '', 0, false, 'T', 'C'); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// ADVANCED SETTINGS FOR CELL BORDERS - -// add a page -$pdf->AddPage(); - -$pdf->setFont('helvetica', 'B', 20); - -$pdf->Write(0, 'Example of advanced border settings for Cell()', '', 0, 'L', true, 0, false, false, 0); - -$pdf->setFont('helvetica', '', 11); - -// set border width -$pdf->setLineWidth(1); - -// set color for cell border -$pdf->setDrawColor(0,128,255); - -// set filling color -$pdf->setFillColor(255,255,128); - -$border = array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0))); -$pdf->Cell(30, 0, 'LTRB', $border, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(5); - -$border = array( -'L' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)), -'R' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 255)), -'T' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 255, 0)), -'B' => array('width' => 2, 'cap' => 'square', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 255))); -$pdf->Cell(30, 0, 'LTRB', $border, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(5); - -$border = array('mode' => 'ext', 'LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0))); -$pdf->Cell(30, 0, 'LTRB EXT', $border, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(5); - -$border = array('mode' => 'int', 'LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0))); -$pdf->Cell(30, 0, 'LTRB INT', $border, 1, 'C', 1, '', 0, false, 'T', 'C'); -$pdf->Ln(5); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_057.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_058.php b/vendor/tecnickcom/tcpdf/examples/example_058.php deleted file mode 100644 index 583228b..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_058.php +++ /dev/null @@ -1,97 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 058'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 058', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 10); - -// add a page -$pdf->AddPage(); - -// NOTE: Uncomment the following line to rasterize SVG image using the ImageMagick library. -//$pdf->setRasterizeVectorImages(true); - -$pdf->ImageSVG($file='images/testsvg.svg', $x=15, $y=30, $w='', $h='', $link='http://www.tcpdf.org', $align='', $palign='', $border=1, $fitonpage=false); - -$pdf->ImageSVG($file='images/tux.svg', $x=30, $y=100, $w='', $h=100, $link='', $align='', $palign='', $border=0, $fitonpage=false); - -$pdf->setFont('helvetica', '', 8); -$pdf->setY(195); -$txt = '© The copyright holder of the above Tux image is Larry Ewing, allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted.'; -$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_058.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_059.php b/vendor/tecnickcom/tcpdf/examples/example_059.php deleted file mode 100644 index 6f05b2e..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_059.php +++ /dev/null @@ -1,193 +0,0 @@ -tocpage) { - // *** replace the following parent::Header() with your code for TOC page - parent::Header(); - } else { - // *** replace the following parent::Header() with your code for normal pages - parent::Header(); - } - } - - /** - * Overwrite Footer() method. - * @public - */ - public function Footer() { - if ($this->tocpage) { - // *** replace the following parent::Footer() with your code for TOC page - parent::Footer(); - } else { - // *** replace the following parent::Footer() with your code for normal pages - parent::Footer(); - } - } - -} // end of class - -// create new PDF document -$pdf = new TOC_TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); - -// set document information -$pdf->setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 059'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 059', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// set font -$pdf->setFont('helvetica', '', 10); - -// --------------------------------------------------------- - -// create some content ... - -// add a page -$pdf->AddPage(); - -// set a bookmark for the current position -$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128)); - -// print a line using Cell() -$pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,128,0)); -$pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); - -$pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(128,0,0)); -$pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); - -// add some pages and bookmarks -for ($i = 2; $i < 12; $i++) { - $pdf->AddPage(); - $pdf->Bookmark('Chapter '.$i, 0, 0, '', 'B', array(0,64,128)); - $pdf->Cell(0, 10, 'Chapter '.$i, 0, 1, 'L'); -} - - -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - - -// add a new page for TOC -$pdf->addTOCPage(); - -// write the TOC title and/or other elements on the TOC page -$pdf->setFont('times', 'B', 16); -$pdf->MultiCell(0, 0, 'Table Of Content', 0, 'C', 0, 1, '', '', true, 0); -$pdf->Ln(); -$pdf->setFont('helvetica', '', 10); - -// define styles for various bookmark levels -$bookmark_templates = array(); - -/* - * The key of the $bookmark_templates array represent the bookmark level (from 0 to n). - * The following templates will be replaced with proper content: - * #TOC_DESCRIPTION# this will be replaced with the bookmark description; - * #TOC_PAGE_NUMBER# this will be replaced with page number. - * - * NOTES: - * If you want to align the page number on the right you have to use a monospaced font like courier, otherwise you can left align using any font type. - * The following is just an example, you can get various styles by combining various HTML elements. - */ - -// A monospaced font for the page number is mandatory to get the right alignment -$bookmark_templates[0] = '
      #TOC_DESCRIPTION##TOC_PAGE_NUMBER#
      '; -$bookmark_templates[1] = '
       #TOC_DESCRIPTION##TOC_PAGE_NUMBER#
      '; -$bookmark_templates[2] = '
       #TOC_DESCRIPTION##TOC_PAGE_NUMBER#
      '; -// add other bookmark level templates here ... - -// add table of content at page 1 -// (check the example n. 45 for a text-only TOC -$pdf->addHTMLTOC(1, 'INDEX', $bookmark_templates, true, 'B', array(128,0,0)); - -// end of TOC page -$pdf->endTOCPage(); - -// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_059.pdf', 'D'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_060.php b/vendor/tecnickcom/tcpdf/examples/example_060.php deleted file mode 100644 index dcdd9cc..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_060.php +++ /dev/null @@ -1,110 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 060'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 060', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// set font -$pdf->setFont('helvetica', '', 20); - -// --------------------------------------------------------- - -// set page format (read source code documentation for further information) -$page_format = array( - 'MediaBox' => array ('llx' => 0, 'lly' => 0, 'urx' => 210, 'ury' => 297), - 'CropBox' => array ('llx' => 0, 'lly' => 0, 'urx' => 210, 'ury' => 297), - 'BleedBox' => array ('llx' => 5, 'lly' => 5, 'urx' => 205, 'ury' => 292), - 'TrimBox' => array ('llx' => 10, 'lly' => 10, 'urx' => 200, 'ury' => 287), - 'ArtBox' => array ('llx' => 15, 'lly' => 15, 'urx' => 195, 'ury' => 282), - 'Dur' => 3, - 'trans' => array( - 'D' => 1.5, - 'S' => 'Split', - 'Dm' => 'V', - 'M' => 'O' - ), - 'Rotate' => 90, - 'PZ' => 1, -); - -// Check the example n. 29 for viewer preferences - -// add first page --- -$pdf->AddPage('P', $page_format, false, false); -$pdf->Cell(0, 12, 'First Page', 1, 1, 'C'); - -// add second page --- -$page_format['Rotate'] = 270; -$pdf->AddPage('P', $page_format, false, false); -$pdf->Cell(0, 12, 'Second Page', 1, 1, 'C'); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_060.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_061.php b/vendor/tecnickcom/tcpdf/examples/example_061.php deleted file mode 100644 index 607547d..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_061.php +++ /dev/null @@ -1,267 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 061'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 061', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 10); - -// add a page -$pdf->AddPage(); - -/* NOTE: - * ********************************************************* - * You can load external XHTML using : - * - * $html = file_get_contents('/path/to/your/file.html'); - * - * External CSS files will be automatically loaded. - * Sometimes you need to fix the path of the external CSS. - * ********************************************************* - */ - -// define some HTML content with style -$html = << - - -

      Example of XHTML + CSS

      - -

      Example of paragraph with class selector. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc.

      - -

      Example of paragraph with ID selector. Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.

      - -
      example of DIV with border and fill. -
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. -
      text-transform LOWERCASE Lorem ipsum dolor sit amet, consectetur adipiscing elit. -
      text-transform uppercase Lorem ipsum dolor sit amet, consectetur adipiscing elit. -
      text-transform cAPITALIZE Lorem ipsum dolor sit amet, consectetur adipiscing elit. -
      - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      No.XXXXXXXX XXXXXXXXXXXX
      1.XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXXXXXX
      XXXX
      2.XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      3.XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      4.XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      XXXX
      -EOF; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// add a page -$pdf->AddPage(); - -$html = ' -

      HTML TIPS & TRICKS

      - -

      REMOVE CELL PADDING

      -
      $pdf->setCellPadding(0);
      -This is used to remove any additional vertical space inside a single cell of text. - -

      REMOVE TAG TOP AND BOTTOM MARGINS

      -
      $tagvs = array(\'p\' => array(0 => array(\'h\' => 0, \'n\' => 0), 1 => array(\'h\' => 0, \'n\' => 0)));
      -$pdf->setHtmlVSpace($tagvs);
      -Since the CSS margin command is not yet implemented on TCPDF, you need to set the spacing of block tags using the following method. - -

      SET LINE HEIGHT

      -
      $pdf->setCellHeightRatio(1.25);
      -You can use the following method to fine tune the line height (the number is a percentage relative to font height). - -

      CHANGE THE PIXEL CONVERSION RATIO

      -
      $pdf->setImageScale(0.47);
      -This is used to adjust the conversion ratio between pixels and document units. Increase the value to get smaller objects.
      -Since you are using pixel unit, this method is important to set theright zoom factor.

      -Suppose that you want to print a web page larger 1024 pixels to fill all the available page width.
      -An A4 page is larger 210mm equivalent to 8.268 inches, if you subtract 13mm (0.512") of margins for each side, the remaining space is 184mm (7.244 inches).
      -The default resolution for a PDF document is 300 DPI (dots per inch), so you have 7.244 * 300 = 2173.2 dots (this is the maximum number of points you can print at 300 DPI for the given width).
      -The conversion ratio is approximatively 1024 / 2173.2 = 0.47 px/dots
      -If the web page is larger 1280 pixels, on the same A4 page the conversion ratio to use is 1280 / 2173.2 = 0.59 pixels/dots'; - -// output the HTML content -$pdf->writeHTML($html, true, false, true, false, ''); - -// reset pointer to the last page -$pdf->lastPage(); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_061.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_062.php b/vendor/tecnickcom/tcpdf/examples/example_062.php deleted file mode 100644 index d0bf89f..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_062.php +++ /dev/null @@ -1,142 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 062'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 062', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'XObject Templates', '', 0, 'C', 1, 0, false, false, 0); - -/* - * An XObject Template is a PDF block that is a self-contained - * description of any sequence of graphics objects (including path - * objects, text objects, and sampled images). - * An XObject Template may be painted multiple times, either on - * several pages or at several locations on the same page and produces - * the same results each time, subject only to the graphics state at - * the time it is invoked. - */ - - -// start a new XObject Template and set transparency group option -$template_id = $pdf->startTemplate(60, 60, true); - -// create Template content -// ................................................................... -//Start Graphic Transformation -$pdf->StartTransform(); - -// set clipping mask -$pdf->StarPolygon(30, 30, 29, 10, 3, 0, 1, 'CNZ'); - -// draw jpeg image to be clipped -$pdf->Image('images/image_demo.jpg', 0, 0, 60, 60, '', '', '', true, 72, '', false, false, 0, false, false, false); - -//Stop Graphic Transformation -$pdf->StopTransform(); - -$pdf->setXY(0, 0); - -$pdf->setFont('times', '', 40); - -$pdf->setTextColor(255, 0, 0); - -// print a text -$pdf->Cell(60, 60, 'Template', 0, 0, 'C', false, '', 0, false, 'T', 'M'); -// ................................................................... - -// end the current Template -$pdf->endTemplate(); - - -// print the selected Template various times using various transparencies - -$pdf->setAlpha(0.4); -$pdf->printTemplate($template_id, 15, 50, 20, 20, '', '', false); - -$pdf->setAlpha(0.6); -$pdf->printTemplate($template_id, 27, 62, 40, 40, '', '', false); - -$pdf->setAlpha(0.8); -$pdf->printTemplate($template_id, 55, 85, 60, 60, '', '', false); - -$pdf->setAlpha(1); -$pdf->printTemplate($template_id, 95, 125, 80, 80, '', '', false); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_062.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_063.php b/vendor/tecnickcom/tcpdf/examples/example_063.php deleted file mode 100644 index f68f4f9..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_063.php +++ /dev/null @@ -1,133 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 063'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 063', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 16); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of Text Stretching and Spacing (tracking)', '', 0, 'L', true, 0, false, false, 0); -$pdf->Ln(5); - -// create several cells to display all cases of stretching and spacing combinations. - -$fonts = array('times', 'dejavuserif'); -$alignments = array('L' => 'LEFT', 'C' => 'CENTER', 'R' => 'RIGHT', 'J' => 'JUSTIFY'); - - -// Test all cases using direct stretching/spacing methods -foreach ($fonts as $fkey => $font) { - $pdf->setFont($font, '', 14); - foreach ($alignments as $align_mode => $align_name) { - for ($stretching = 90; $stretching <= 110; $stretching += 10) { - for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) { - $pdf->setFontStretching($stretching); - $pdf->setFontSpacing($spacing); - $txt = $align_name.' | Stretching = '.$stretching.'% | Spacing = '.sprintf('%+.3F', $spacing).'mm'; - $pdf->Cell(0, 0, $txt, 1, 1, $align_mode); - } - } - } - $pdf->AddPage(); -} - - -// Test all cases using CSS stretching/spacing properties -foreach ($fonts as $fkey => $font) { - $pdf->setFont($font, '', 11); - foreach ($alignments as $align_mode => $align_name) { - for ($stretching = 90; $stretching <= 110; $stretching += 10) { - for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) { - $html = ''.$align_name.' | Stretching = '.$stretching.'% | Spacing = '.sprintf('%+.3F', $spacing).'mm
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
      '; - $pdf->writeHTMLCell(0, 0, '', '', $html, 1, 1, false, true, $align_mode, false); - } - } - if (!(($fkey == 1) AND ($align_mode == 'J'))) { - $pdf->AddPage(); - } - } -} - - -// reset font stretching -$pdf->setFontStretching(100); - -// reset font spacing -$pdf->setFontSpacing(0); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_063.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_064.php b/vendor/tecnickcom/tcpdf/examples/example_064.php deleted file mode 100644 index 8efaf4f..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_064.php +++ /dev/null @@ -1,178 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 064'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 064', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', '', 8); - - -// define some html content for testing -$txt = '

      TEST PAGE REGIONS: A no-write region is a portion of the page with a rectangular or trapezium shape that will not be covered when writing text or html code. A region is always aligned on the left or right side of the page ad is defined using a vertical segment. You can set multiple regions for the same page. You can combine several adjacent regions to approximate curved shapes. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. -Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa. -Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu. -Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra. -Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.

      '; - - -// add a page -$pdf->AddPage(); - -// print some graphic content -$pdf->Image('images/image_demo.jpg', 155, 30, 40, 40, 'JPG', '', '', true); -$pdf->Image('images/image_demo.jpg', 15, 230, 40, 40, 'JPG', '', '', true); - -// define some graphic styles -$styleA = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)); -$styleB = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 3, 'color' => array(127, 127, 127)); -$pdf->setFillColor(220, 255, 220); - -// write a trapezoid with some information about no-write page regions -$pdf->Polygon(array(15,90, 57,90, 67,140, 15,140), 'DF', array($styleB, $styleA, $styleB, $styleB)); -$pdf->setXY(15, 90); -$pdf->Cell(42, 0, 'xt,yt', 0, 0, 'R', false, '', 0, false, 'T', 'T'); -$pdf->setXY(15, 140); -$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'R', false, '', 0, false, 'B', 'B'); -$pdf->setXY(15, 115); -$pdf->Cell(40, 0, 'side', 0, 0, 'R', false, '', 0, false, 'B', 'B'); -$pdf->setLineStyle(array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); -$pdf->Arrow(60, 115, 35, 115, 2, 5, 15); - -// write a trapezoid with some information about no-write page regions -$pdf->Polygon(array(145,130, 195,130, 195,180, 155,180), 'DF', array($styleB, $styleB, $styleB, $styleA)); -$pdf->setXY(145, 130); -$pdf->Cell(42, 0, 'xt,yt', 0, 0, 'L', false, '', 0, false, 'T', 'T'); -$pdf->setXY(155, 180); -$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'L', false, '', 0, false, 'B', 'B'); -$pdf->setXY(160, 155); -$pdf->Cell(30, 0, 'side', 0, 0, 'L', false, '', 0, false, 'B', 'B'); -$pdf->setLineStyle(array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0))); -$pdf->Arrow(155, 155, 180, 155, 2, 5, 15); - -// reset x,y position -$pdf->setXY(15, 30); - - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// define no-write page regions to avoid text overlapping images -/* - 'page' => page number or empy for current page - 'xt' => X top - 'yt' => Y top - 'yb' => Y bottom - 'side' => page side ('L' = left or 'R' = right) -*/ -$regions = array( -array('page' => '', 'xt' => 153, 'yt' => 30, 'xb' => 153, 'yb' => 70, 'side' => 'R'), -array('page' => '', 'xt' => 60, 'yt' => 90, 'xb' => 70, 'yb' => 140, 'side' => 'L'), -array('page' => '', 'xt' => 143, 'yt' => 130, 'xb' => 153, 'yb' => 180, 'side' => 'R'), -array('page' => '', 'xt' => 58, 'yt' => 230, 'xb' => 58, 'yb' => 270, 'side' => 'L') -); - -// set page regions, check also getPageRegions(), addPageRegion() and removePageRegion() -$pdf->setPageRegions($regions); - -// write html text -$pdf->writeHTML($txt, true, false, true, false, ''); - - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// set a circular no-write region on the second page -$regions = array( -array('page' => 2, 'xt' => 195, 'yt' => 110, 'xb' => 179.693, 'yb' => 113.045, 'side' => 'R'), -array('page' => 2, 'xt' => 179.693, 'yt' => 113.045, 'xb' => 166.716, 'yb' => 121.716, 'side' => 'R'), -array('page' => 2, 'xt' => 166.716, 'yt' => 121.716, 'xb' => 158.045, 'yb' => 134.693, 'side' => 'R'), -array('page' => 2, 'xt' => 158.045, 'yt' => 134.693, 'xb' => 155, 'yb' => 150, 'side' => 'R'), -array('page' => 2, 'xt' => 155, 'yt' => 150, 'xb' => 158.045, 'yb' => 165.307, 'side' => 'R'), -array('page' => 2, 'xt' => 158.045, 'yt' => 165.307, 'xb' => 166.716, 'yb' => 178.284, 'side' => 'R'), -array('page' => 2, 'xt' => 166.716, 'yt' => 178.284, 'xb' => 179.693, 'yb' => 186.955, 'side' => 'R'), -array('page' => 2, 'xt' => 179.693, 'yt' => 186.955, 'xb' => 195, 'yb' => 190, 'side' => 'R') -); -$pdf->setPageRegions($regions); - -$pdf->Polygon(array(195,110, 179.693,113.045, 166.716,121.716, 158.045,134.693, 155,150, 158.045,165.307, 166.716,178.284, 179.693,186.955, 195,190), 'DF'); - -$pdf->Ln(15); - -// define some html content for testing -$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa. Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu. Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra. Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.'."\n"; - -// write text -$pdf->MultiCell(0, 0, $txt, 0, 'J', false, 1, '', '', true, 0, false, true, 0, 'T', false); - -// --------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_064.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_065.php b/vendor/tecnickcom/tcpdf/examples/example_065.php deleted file mode 100644 index 9079480..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_065.php +++ /dev/null @@ -1,100 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 065'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 065', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set default font subsetting mode -$pdf->setFontSubsetting(true); - -// Set font -$pdf->setFont('helvetica', '', 14, '', true); - -// Add a page -// This method has several options, check the source code documentation for more information. -$pdf->AddPage(); - -// Set some content to print -$html = <<Example of  TCPDF  document in PDF/A-1b mode. -This document conforms to the standard PDF/A-1b (ISO 19005-1:2005). -

      Please check the source code documentation and other examples for further information (http://www.tcpdf.org).

      -

      TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE MAKE A DONATION!

      -EOD; - -// Print text using writeHTMLCell() -$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); - -// --------------------------------------------------------- - -// Close and output PDF document -// This method has several options, check the source code documentation for more information. -$pdf->Output('example_065.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/example_066.php b/vendor/tecnickcom/tcpdf/examples/example_066.php deleted file mode 100644 index 41b8b47..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_066.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @license LGPL-3.0 - */ - -/** - * Creates an example PDF/A-1b document using TCPDF - * - * @abstract TCPDF - Example: PDF/A-1b mode - * @author Nicola Asuni - * @since 2021-03-26 - * @group A-1b - * @group pdf - */ - -// Include the main TCPDF library (search for installation path). -require_once('tcpdf_include.php'); - -// create new PDF document -$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, true); - -// set document information -$pdf->setCreator(PDF_CREATOR); -$pdf->setAuthor('Nicola Asuni'); -$pdf->setTitle('TCPDF Example 066'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 066', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(true, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(__DIR__ . '/lang/eng.php')) { - require_once __DIR__ . '/lang/eng.php'; - - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set default font subsetting mode -$pdf->setFontSubsetting(true); - -// Set font -$pdf->setFont('helvetica', '', 14, '', true); - -// Add a page -// This method has several options, check the source code documentation for more information. -$pdf->AddPage(); - -// Set some content to print -$html = <<Example of  TCPDF  document in PDF/A-1b mode. -This document conforms to the standard PDF/A-1b (ISO 19005-1:2005). -

      Please check the source code documentation and other examples for further information (http://www.tcpdf.org).

      -HTML; - -// Print text using writeHTMLCell() -$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); - -// --------------------------------------------------------- - -// Close and output PDF document -// This method has several options, check the source code documentation for more information. -$pdf->Output('example_066.pdf', 'I'); diff --git a/vendor/tecnickcom/tcpdf/examples/example_067.php b/vendor/tecnickcom/tcpdf/examples/example_067.php deleted file mode 100644 index e0262bf..0000000 --- a/vendor/tecnickcom/tcpdf/examples/example_067.php +++ /dev/null @@ -1,223 +0,0 @@ -setCreator(PDF_CREATOR); -$pdf->setAuthor('Owen Leibman'); -$pdf->setTitle('TCPDF Example 067'); -$pdf->setSubject('TCPDF Tutorial'); -$pdf->setKeywords('TCPDF, PDF, example, test, guide'); - -// set default header data -$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 067', PDF_HEADER_STRING); - -// set header and footer fonts -$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); -$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); - -// set default monospaced font -$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED); - -// set margins -$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); -$pdf->setHeaderMargin(PDF_MARGIN_HEADER); -$pdf->setFooterMargin(PDF_MARGIN_FOOTER); - -// set auto page breaks -$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); - -// set image scale factor -$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); - -// set some language-dependent strings (optional) -if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { - require_once(dirname(__FILE__).'/lang/eng.php'); - $pdf->setLanguageArray($l); -} - -// --------------------------------------------------------- - -// set font -$pdf->setFont('helvetica', 'B', 20); - -// add a page -$pdf->AddPage(); - -$pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0); - -$pdf->setFont('helvetica', '', 8); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
      COLSPAN 3 - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
      text line
      text line
      text line
      text line - COL 3 - ROW 2 - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
      COLSPAN 3 - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
      text line
      text line
      text line
      text line - COL 3 - ROW 2 - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
      COLSPAN 3 - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
      text line
      text line
      text line
      text line - COL 3 - ROW 2 - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
      COLSPAN 3 - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
      text line
      text line
      text line
      text line - COL 3 - ROW 2 - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -$tbl = << - - COL 1 - ROW 1
      COLSPAN 3 - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
      text line
      text line
      text line
      text line - COL 3 - ROW 2 - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); - -// ----------------------------------------------------------------------------- - -// At medium thickness, which is what you get with only one -// setting for style, everything looks the same. -// Included just for completeness. -$tbl = << - - COL 1 - ROW 1
      COLSPAN 3 - COL 2 - ROW 1 - COL 3 - ROW 1 - - - COL 2 - ROW 2 - COLSPAN 2
      text line
      text line
      text line
      text line - COL 3 - ROW 2 - - - COL 3 - ROW 3 - - - -EOD; - -$pdf->writeHTML($tbl, true, false, false, false, ''); -// ----------------------------------------------------------------------------- - -//Close and output PDF document -$pdf->Output('example_067.pdf', 'I'); - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/examples/images/_blank.png b/vendor/tecnickcom/tcpdf/examples/images/_blank.png deleted file mode 100644 index 38f7b2f..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/_blank.png and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/alpha.png b/vendor/tecnickcom/tcpdf/examples/images/alpha.png deleted file mode 100644 index 4980117..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/alpha.png and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/image_demo.jpg b/vendor/tecnickcom/tcpdf/examples/images/image_demo.jpg deleted file mode 100644 index 262bce2..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/image_demo.jpg and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/image_with_alpha.png b/vendor/tecnickcom/tcpdf/examples/images/image_with_alpha.png deleted file mode 100644 index f87dc9a..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/image_with_alpha.png and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/img.png b/vendor/tecnickcom/tcpdf/examples/images/img.png deleted file mode 100644 index 2461637..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/img.png and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/logo_example.gif b/vendor/tecnickcom/tcpdf/examples/images/logo_example.gif deleted file mode 100644 index 010b487..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/logo_example.gif and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/logo_example.jpg b/vendor/tecnickcom/tcpdf/examples/images/logo_example.jpg deleted file mode 100644 index 6d9b8fd..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/logo_example.jpg and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/logo_example.png b/vendor/tecnickcom/tcpdf/examples/images/logo_example.png deleted file mode 100644 index a57be4c..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/logo_example.png and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/tcpdf_box.ai b/vendor/tecnickcom/tcpdf/examples/images/tcpdf_box.ai deleted file mode 100644 index 0c14846..0000000 --- a/vendor/tecnickcom/tcpdf/examples/images/tcpdf_box.ai +++ /dev/null @@ -1,214 +0,0 @@ -%!PS-Adobe-3.0 EPSF -%%Creator: Adobe Illustrator -%%BoundingBox: -7 0 487 327 -%%HiResBoundingBox: -6.66162 2.44007e-05 486.662 326.648 -%AI5_FileFormat 3 -%%EndComments -%%BeginProlog -%%EndProlog -%%BeginSetup -%%EndSetup -1 XR -%AI5_BeginLayer -1 1 1 1 0 0 -1 49 80 161 Lb -(New Layer) Ln -0.620000 0.580000 0.435000 0.996000 K -[] 0 d -1.402287 w -0 j -0 J -0.263000 0.290000 0.898000 0.263000 k -72.7885 255.643 m -277.08 286.778 L -425.478 260.993 L -408.269 190.301 L -113.504 181.247 L -113.504 181.247 72.9813 241.769 72.7885 255.643 C -b -0.620000 0.580000 0.435000 0.996000 K -1 j -0.094000 0.102000 0.369000 0.016000 k -423.247 259.914 m -240.217 207.097 L -240.635 0.701168 L -397.776 116.053 L -423.247 259.914 L -b -0.620000 0.580000 0.435000 0.996000 K -0.133000 0.141000 0.541000 0.035000 k -72.1745 254.207 m -240.217 207.097 L -240.561 0.783816 L -101.054 87.946 L -72.1745 254.207 L -b -0.047000 0.059000 0.184000 0.004000 k -423.247 259.914 m -308.187 51.1553 L -396.862 116.972 L -423.247 259.914 L -f -0.620000 0.580000 0.435000 0.996000 K -0 j -0.047000 0.059000 0.184000 0.004000 k -479.312 250.415 m -423.613 260.243 L -240.385 206.966 L -314.061 186.394 L -479.312 250.415 L -b -0.620000 0.580000 0.435000 0.996000 K -0.047000 0.059000 0.184000 0.004000 k -69.9121 254.273 m -237.965 207.131 L -163.618 164.537 L -0.687544 234.686 L -69.9121 254.273 L -b -0.620000 0.580000 0.435000 0.996000 K -0.047000 0.059000 0.184000 0.004000 k -242.971 319.299 m -275.613 286.233 L -72.5703 254.295 L -16.555 296.161 L -242.971 319.299 L -b -0.620000 0.580000 0.435000 0.996000 K -0.133000 0.141000 0.541000 0.035000 k -423.496 260.684 m -275.426 286.441 L -307.326 316.69 L -462.053 292.606 L -423.496 260.684 L -b -0.196000 0.227000 0.871000 0.106000 k -75.26 254.037 m -274.806 285.371 L -227.928 211.257 L -163.396 228.836 130.937 238.701 75.26 254.037 C -f -0.620000 0.580000 0.435000 0.996000 K -1 j -0.169000 0.314000 0.424000 0.094000 k -275.528 286.329 m -274.75 216.78 L -275.528 286.329 L -b -0.031000 0.949000 0.745000 0.729000 k -285.929 160.982 m -285.929 160.982 285.078 139.734 285.078 139.734 C -285.078 139.734 275.378 135.096 275.378 135.096 C -275.378 135.096 273.058 57.6061 273.058 57.6061 C -273.058 57.6061 257.133 47.3536 257.133 47.3536 C -257.133 47.3536 258.059 126.816 258.059 126.816 C -258.059 126.816 247.186 121.618 247.186 121.618 C -247.186 121.618 247.186 144.26 247.186 144.26 C -247.186 144.26 285.929 160.982 285.929 160.982 C -F -0.031000 0.949000 0.745000 0.729000 k -320.884 135.342 m -320.884 135.342 307.279 128.129 307.279 128.129 C -307.279 128.129 308.36 144.944 308.36 144.944 C -308.681 149.948 308.724 153.011 308.483 154.097 C -308.268 155.24 307.632 155.567 306.572 155.073 C -305.368 154.512 304.553 153.381 304.135 151.687 C -303.718 149.995 303.36 146.608 303.063 141.565 C -303.063 141.565 300.477 97.6864 300.477 97.6864 C -300.22 93.3298 300.208 90.6032 300.439 89.4791 C -300.668 88.3599 301.318 88.1316 302.385 88.7881 C -303.403 89.4149 304.103 90.4684 304.487 91.9528 C -304.894 93.4524 305.253 96.6211 305.567 101.497 C -305.567 101.497 306.297 112.86 306.297 112.86 C -306.297 112.86 319.718 120.438 319.718 120.438 C -319.718 120.438 319.446 116.964 319.446 116.964 C -318.734 107.862 317.873 101.293 316.856 97.1389 C -315.864 93.0164 314.026 88.8059 311.329 84.474 C -308.636 80.1307 305.421 76.743 301.646 74.2975 C -297.651 71.7096 294.365 70.7251 291.812 71.3887 C -289.213 72.064 287.545 74.2699 286.838 78.0362 C -286.121 81.8925 285.954 88.3297 286.349 97.4441 C -286.349 97.4441 287.575 125.751 287.575 125.751 C -287.89 133.007 288.277 138.586 288.737 142.421 C -289.202 146.323 290.251 150.369 291.883 154.544 C -293.54 158.732 295.716 162.4 298.394 165.529 C -301.078 168.689 304.052 170.959 307.296 172.342 C -311.621 174.188 315.02 174.154 317.521 172.296 C -319.974 170.473 321.427 167.541 321.911 163.514 C -322.39 159.578 322.275 153.119 321.579 144.225 C -321.579 144.225 320.884 135.342 320.884 135.342 C -F -0.031000 0.949000 0.745000 0.729000 k -*u -329.084 179.607 m -329.084 179.607 342.074 185.214 342.074 185.214 C -345.446 186.669 347.94 187.235 349.586 186.932 C -351.233 186.642 352.374 185.695 353.019 184.1 C -353.677 182.527 353.999 180.418 353.991 177.777 C -354.005 175.2 353.703 171.072 353.088 165.429 C -353.088 165.429 352.244 157.683 352.244 157.683 C -351.634 152.084 350.908 147.89 350.063 145.056 C -349.22 142.228 347.957 139.718 346.265 137.514 C -344.583 135.308 342.474 133.487 339.919 132.046 C -339.919 132.046 336.736 130.25 336.736 130.25 C -336.736 130.25 333.512 96.527 333.512 96.527 C -333.512 96.527 321.545 88.8222 321.545 88.8222 C -321.545 88.8222 329.084 179.607 329.084 179.607 C -F -340.42 168.795 m -340.42 168.795 338.184 145.407 338.184 145.407 C -338.526 145.552 338.82 145.69 339.068 145.822 C -340.172 146.404 340.98 147.319 341.498 148.568 C -342.038 149.863 342.473 152.174 342.805 155.518 C -342.805 155.518 343.55 163.014 343.55 163.014 C -343.863 166.167 343.82 168.111 343.416 168.832 C -343.011 169.557 342.015 169.547 340.42 168.795 C -F -*U -0.031000 0.949000 0.745000 0.729000 k -*u -359.204 192.607 m -359.204 192.607 367.556 196.212 367.556 196.212 C -372.753 198.454 376.114 199.414 377.734 199.14 C -379.351 198.877 380.446 197.777 381.03 195.854 C -381.608 193.948 381.815 191.642 381.655 188.934 C -381.502 186.28 380.88 180.934 379.804 172.981 C -379.804 172.981 375.968 144.653 375.968 144.653 C -375.021 137.654 374.236 132.926 373.604 130.399 C -372.993 127.921 372.216 125.786 371.268 123.986 C -370.323 122.215 369.243 120.698 368.023 119.43 C -366.801 118.187 365.012 116.807 362.638 115.279 C -362.638 115.279 349.593 106.88 349.593 106.88 C -349.593 106.88 359.204 192.607 359.204 192.607 C -F -368.395 181.985 m -368.395 181.985 361.644 126.918 361.644 126.918 C -363.113 127.815 364.084 128.947 364.566 130.32 C -365.053 131.727 365.629 135.077 366.301 140.416 C -366.301 140.416 370.368 172.752 370.368 172.752 C -370.86 176.666 371.12 179.163 371.145 180.223 C -371.168 181.285 371.006 181.972 370.654 182.282 C -370.306 182.629 369.555 182.531 368.395 181.985 C -F -*U -0.031000 0.949000 0.745000 0.729000 k -387.58 204.854 m -387.58 204.854 403.348 211.659 403.348 211.659 C -403.348 211.659 400.803 195.062 400.803 195.062 C -400.803 195.062 394.579 192.087 394.579 192.087 C -394.579 192.087 392.296 176.619 392.296 176.619 C -392.296 176.619 397.801 179.482 397.801 179.482 C -397.801 179.482 395.533 164.634 395.533 164.634 C -395.533 164.634 390.075 161.574 390.075 161.574 C -390.075 161.574 385.406 129.937 385.406 129.937 C -385.406 129.937 376.374 124.122 376.374 124.122 C -376.374 124.122 387.58 204.854 387.58 204.854 C -F -LB -%AI5_EndLayer-- -%AI5_BeginLayer -1 1 1 1 0 0 -1 49 80 161 Lb -(MasterLayer 1) Ln -LB -%AI5_EndLayer-- -%%Trailer -%%EOF diff --git a/vendor/tecnickcom/tcpdf/examples/images/tcpdf_box.svg b/vendor/tecnickcom/tcpdf/examples/images/tcpdf_box.svg deleted file mode 100644 index 8c29e64..0000000 --- a/vendor/tecnickcom/tcpdf/examples/images/tcpdf_box.svg +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/vendor/tecnickcom/tcpdf/examples/images/tcpdf_cell.png b/vendor/tecnickcom/tcpdf/examples/images/tcpdf_cell.png deleted file mode 100644 index 2e3e92c..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/tcpdf_cell.png and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/tcpdf_signature.png b/vendor/tecnickcom/tcpdf/examples/images/tcpdf_signature.png deleted file mode 100644 index 64caa51..0000000 Binary files a/vendor/tecnickcom/tcpdf/examples/images/tcpdf_signature.png and /dev/null differ diff --git a/vendor/tecnickcom/tcpdf/examples/images/testsvg.svg b/vendor/tecnickcom/tcpdf/examples/images/testsvg.svg deleted file mode 100644 index fd8314e..0000000 --- a/vendor/tecnickcom/tcpdf/examples/images/testsvg.svg +++ /dev/null @@ -1,328 +0,0 @@ - - - - - TCPDF SVG EXAMPLE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - www.tcpdf.org - - - - - - - - SVG - diff --git a/vendor/tecnickcom/tcpdf/examples/images/tux.svg b/vendor/tecnickcom/tcpdf/examples/images/tux.svg deleted file mode 100644 index de8c869..0000000 --- a/vendor/tecnickcom/tcpdf/examples/images/tux.svg +++ /dev/null @@ -1,1487 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/tecnickcom/tcpdf/examples/index.php b/vendor/tecnickcom/tcpdf/examples/index.php deleted file mode 100644 index d865689..0000000 --- a/vendor/tecnickcom/tcpdf/examples/index.php +++ /dev/null @@ -1,117 +0,0 @@ -'; -?> - - - - - -TCPDF Examples - - - - - - - - -

      TCPDF Examples

      - -

      PDF

      - -
        -
      1. Simple PDF with default Header and Footer: [PDF]
      2. -
      3. Simple PDF without Header and Footer: [PDF]
      4. -
      5. Custom Header and Footer: [PDF]
      6. -
      7. Cell stretching: [PDF]
      8. -
      9. Multicell: [PDF]
      10. -
      11. WriteHTML and RTL support: [PDF]
      12. -
      13. Independent columns with WriteHTMLCell: [PDF]
      14. -
      15. External UTF-8 text file: [PDF]
      16. -
      17. Image: [PDF]
      18. -
      19. Multiple columns: [PDF]
      20. -
      21. Colored Tables: [PDF]
      22. -
      23. Graphic Functions: [PDF]
      24. -
      25. Graphic Transformations: [PDF]
      26. -
      27. Javascript and Forms: [PDF]
      28. -
      29. Bookmarks (Table of Content): [PDF]
      30. -
      31. Document Encryption: [PDF]
      32. -
      33. Independent columns with MultiCell: [PDF]
      34. -
      35. Persian and Arabic language on RTL document: [PDF]
      36. -
      37. Non unicode / Alternative config file: [PDF]
      38. -
      39. Multicell complex alignment: [PDF]
      40. -
      41. writeHTML alignment: [PDF]
      42. -
      43. CMYK colors: [PDF]
      44. -
      45. Page Groups: [PDF]
      46. -
      47. Object Visibility and Layers: [PDF]
      48. -
      49. Object Transparency: [PDF]
      50. -
      51. Text Rendering Modes and Text Clipping: [PDF]
      52. -
      53. 1D Barcodes: [PDF]
      54. -
      55. Multiple page formats: [PDF]
      56. -
      57. Set PDF viewer display preferences: [PDF]
      58. -
      59. Colour gradients: [PDF]
      60. -
      61. Pie Chart Graphic: [PDF]
      62. -
      63. EPS/AI vectorial image: [PDF]
      64. -
      65. Mixed font types (TrueType Unicode, core, CID-0): [PDF]
      66. -
      67. Clipping masks: [PDF]
      68. -
      69. Line styles with cells and multicells: [PDF]
      70. -
      71. Text Annotations: [PDF]
      72. -
      73. Spot Colors: [PDF]
      74. -
      75. NON-embedded CID-0 CJK font: [PDF]
      76. -
      77. HTML Justification: [PDF]
      78. -
      79. Booklet (double-sided pages): [PDF]
      80. -
      81. File attachment: [PDF]
      82. -
      83. Image with Alpha Channel Transparency: [PDF]
      84. -
      85. Disk caching: [PDF]
      86. -
      87. Move, Copy and Delete page: [PDF]
      88. -
      89. Table Of Content with Bookmarks: [PDF]
      90. -
      91. Text hyphenation: [PDF]
      92. -
      93. Transactions and UNDO: [PDF]
      94. -
      95. Table header and rowspan: [PDF]
      96. -
      97. TCPDF methods in HTML: [PDF]
      98. -
      99. 2D Barcode (QR-Code, Datamatrix ECC200 and PDF417): [PDF]
      100. -
      101. Full page background: [PDF]
      102. -
      103. Digital Signature Certification: [PDF]
      104. -
      105. Javascript functions: [PDF]
      106. -
      107. XHTML Form: [PDF]
      108. -
      109. Font Dump: [PDF]
      110. -
      111. Crop Marks and Registration Marks: [PDF]
      112. -
      113. Cell vertical alignments and borders: [PDF]
      114. -
      115. SVG Image: [PDF]
      116. -
      117. Table Of Content with HTML templates: [PDF]
      118. -
      119. Advanced page settings: [PDF]
      120. -
      121. XHTML + CSS: [PDF]
      122. -
      123. XObject Templates: [PDF]
      124. -
      125. Text stretching and spacing (tracking/kerning): [PDF]
      126. -
      127. No-write page regions: [PDF]
      128. -
      129. PDF/A-1b (ISO 19005-1:2005) document: [PDF]
      130. -
      131. Using WriteHTMLCell: [PDF]
      132. -
      133. Shorthand border styles including !important: [PDF]
      134. -
      - -

      Barcodes

      - -
        -
      1. 1D barcode HTML format [HTML]
      2. -
      3. 1D barcode PNG format [PNG]
      4. -
      5. 1D barcode SVG format [SVG]
      6. -
      7. 1D barcode SVG INLINE format [SVG INLINE]
      8. - -
      9. 2D datamatrix barcode HTML format [HTML]
      10. -
      11. 2D datamatrix barcode PNG format [PNG]
      12. -
      13. 2D datamatrix barcode SVG format [SVG]
      14. -
      15. 2D datamatrix barcode SVG INLINE format [SVG INLINE]
      16. - -
      17. 2D pdf417 barcode HTML format [HTML]
      18. -
      19. 2D pdf417 barcode PNG format [PNG]
      20. -
      21. 2D pdf417 barcode SVG format [SVG]
      22. -
      23. 2D pdf417 barcode SVG INLINE format [SVG INLINE]
      24. - -
      25. 2D qrcode barcode HTML format [HTML]
      26. -
      27. 2D qrcode barcode PNG format [PNG]
      28. -
      29. 2D qrcode barcode SVG format [SVG]
      30. -
      31. 2D qrcode barcode SVG INLINE format [SVG INLINE]
      32. -
      - - - diff --git a/vendor/tecnickcom/tcpdf/examples/lang/afr.php b/vendor/tecnickcom/tcpdf/examples/lang/afr.php deleted file mode 100644 index 367b7e8..0000000 --- a/vendor/tecnickcom/tcpdf/examples/lang/afr.php +++ /dev/null @@ -1,44 +0,0 @@ - 0) { + if (preg_match('/[\[][\"\'](t|g|rgba|rgb|cmyk)[\"\'][\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\]]/', $color, $m) > 0) { $returncolor = array(); switch ($m[1]) { case 'cmyk': { @@ -286,7 +286,8 @@ public static function convertHTMLColorToDec($hcolor, &$spotc, $defcol=array('R' $returncolor['K'] = max(0, min(100, (floatval($m[5]) * 100))); break; } - case 'rgb': { + case 'rgb': + case 'rgba': { // RGB $returncolor['R'] = max(0, min(255, (floatval($m[2]) * 255))); $returncolor['G'] = max(0, min(255, (floatval($m[3]) * 255))); @@ -317,6 +318,25 @@ public static function convertHTMLColorToDec($hcolor, &$spotc, $defcol=array('R' if (strlen($color) == 0) { return $defcol; } + // RGBA ARRAY + if (substr($color, 0, 4) == 'rgba') { + $codes = substr($color, 5); + $codes = str_replace(')', '', $codes); + $returncolor = explode(',', $codes); + // remove alpha component + array_pop($returncolor); + foreach ($returncolor as $key => $val) { + if (strpos($val, '%') > 0) { + // percentage + $returncolor[$key] = (255 * intval($val) / 100); + } else { + $returncolor[$key] = intval($val); /* floatize */ + } + // normalize value + $returncolor[$key] = max(0, min(255, $returncolor[$key])); + } + return $returncolor; + } // RGB ARRAY if (substr($color, 0, 3) == 'rgb') { $codes = substr($color, 4); diff --git a/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php b/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php index a71c84b..fbe7009 100644 --- a/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php +++ b/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php @@ -1,13 +1,13 @@ 0) { + if (preg_match_all('#dup[\s]([0-9]+)[\s]*+/([^\s]*+)[\s]put#sU', $font, $fmap, PREG_SET_ORDER) > 0) { foreach ($fmap as $v) { $imap[$v[2]] = $v[1]; } @@ -229,22 +230,22 @@ public static function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $ $eplain .= chr($chr ^ ($r >> 8)); $r = ((($chr + $r) * $c1 + $c2) % 65536); } - if (preg_match('#/ForceBold[\s]*([^\s]*)#', $eplain, $matches) > 0) { + if (preg_match('#/ForceBold[\s]*+([^\s]*+)#', $eplain, $matches) > 0) { if ($matches[1] == 'true') { $fmetric['Flags'] |= 0x40000; } } - if (preg_match('#/StdVW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) { + if (preg_match('#/StdVW[\s]*+\[([^\]]*+)#', $eplain, $matches) > 0) { $fmetric['StemV'] = intval($matches[1]); } else { $fmetric['StemV'] = 70; } - if (preg_match('#/StdHW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) { + if (preg_match('#/StdHW[\s]*+\[([^\]]*+)#', $eplain, $matches) > 0) { $fmetric['StemH'] = intval($matches[1]); } else { $fmetric['StemH'] = 30; } - if (preg_match('#/BlueValues[\s]*\[([^\]]*)#', $eplain, $matches) > 0) { + if (preg_match('#/BlueValues[\s]*+\[([^\]]*+)#', $eplain, $matches) > 0) { $bv = explode(' ', $matches[1]); if (count($bv) >= 6) { $v1 = intval($bv[2]); @@ -265,7 +266,7 @@ public static function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $ $fmetric['CapHeight'] = 700; } // get the number of random bytes at the beginning of charstrings - if (preg_match('#/lenIV[\s]*([0-9]*)#', $eplain, $matches) > 0) { + if (preg_match('#/lenIV[\s]*+([\d]*+)#', $eplain, $matches) > 0) { $lenIV = intval($matches[1]); } else { $lenIV = 4; @@ -273,7 +274,7 @@ public static function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $ $fmetric['Leading'] = 0; // get charstring data $eplain = substr($eplain, (strpos($eplain, '/CharStrings') + 1)); - preg_match_all('#/([A-Za-z0-9\.]*)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER); + preg_match_all('#/([A-Za-z0-9\.]*+)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER); if (!empty($enc) AND isset(TCPDF_FONT_DATA::$encmap[$enc])) { $enc_map = TCPDF_FONT_DATA::$encmap[$enc]; } else { @@ -1780,9 +1781,9 @@ public static function arrUTF8ToUTF16BE($unicode, $setbom=false) { */ public static function UTF8ArrayToUniArray($ta, $isunicode=true) { if ($isunicode) { - return array_map(get_called_class().'::unichrUnicode', $ta); + return array_map(static::class.'::unichrUnicode', $ta); } - return array_map(get_called_class().'::unichrASCII', $ta); + return array_map(static::class.'::unichrASCII', $ta); } /** @@ -2002,7 +2003,7 @@ public static function UTF8StringToArray($str, $isunicode, &$currentfont) { if ($isunicode) { // requires PCRE unicode support turned on $chars = TCPDF_STATIC::pregSplit('//','u', $str, -1, PREG_SPLIT_NO_EMPTY); - $carr = array_map(get_called_class().'::uniord', $chars); + $carr = array_map(static::class.'::uniord', $chars); } else { $chars = str_split($str); $carr = array_map('ord', $chars); diff --git a/vendor/tecnickcom/tcpdf/include/tcpdf_static.php b/vendor/tecnickcom/tcpdf/include/tcpdf_static.php index 04f7446..efadc92 100644 --- a/vendor/tecnickcom/tcpdf/include/tcpdf_static.php +++ b/vendor/tecnickcom/tcpdf/include/tcpdf_static.php @@ -1,13 +1,13 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 1.1.2 + * @version 1.1.5 */ /** @@ -46,7 +46,7 @@ * Static methods used by the TCPDF class. * @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 1.1.1 + * @version 1.1.5 * @author Nicola Asuni - info@tecnick.com */ class TCPDF_STATIC { @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.7.5'; + private static $tcpdf_version = '6.10.0'; /** * String alias for total number of pages. @@ -106,6 +106,31 @@ class TCPDF_STATIC { */ public static $pageboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox'); + /** + * Array of default cURL options for curl_setopt_array. + * + * @var array cURL options. + */ + protected const CURLOPT_DEFAULT = [ + CURLOPT_CONNECTTIMEOUT => 5, + CURLOPT_MAXREDIRS => 5, + CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP | CURLPROTO_FTP | CURLPROTO_FTPS, + CURLOPT_SSL_VERIFYHOST => 2, + CURLOPT_SSL_VERIFYPEER => true, + CURLOPT_TIMEOUT => 30, + CURLOPT_USERAGENT => 'tcpdf', + ]; + + /** + * Array of fixed cURL options for curl_setopt_array. + * + * @var array cURL options. + */ + protected const CURLOPT_FIXED = [ + CURLOPT_FAILONERROR => true, + CURLOPT_RETURNTRANSFER => true, + ]; + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** @@ -379,7 +404,10 @@ public static function getRandomSeed($seed='') { if (function_exists('posix_getpid')) { $rnd .= posix_getpid(); } - if (function_exists('openssl_random_pseudo_bytes') AND (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) { + + if (function_exists('random_bytes')) { + $rnd .= random_bytes(512); + } elseif (function_exists('openssl_random_pseudo_bytes') AND (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) { // this is not used on windows systems because it is very slow for a know bug $rnd .= openssl_random_pseudo_bytes(512); } else { @@ -387,7 +415,7 @@ public static function getRandomSeed($seed='') { $rnd .= uniqid('', true); } } - return $rnd.$seed.__FILE__.serialize($_SERVER).microtime(true); + return $rnd.$seed.__FILE__.microtime(true); } /** @@ -1820,23 +1848,19 @@ public static function fopenLocal($filename, $mode) { */ public static function url_exists($url) { $crs = curl_init(); - // encode query params in URL to get right response form the server - $url = self::encodeUrlQuery($url); - curl_setopt($crs, CURLOPT_URL, $url); - curl_setopt($crs, CURLOPT_NOBODY, true); - curl_setopt($crs, CURLOPT_FAILONERROR, true); - if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) { - curl_setopt($crs, CURLOPT_FOLLOWLOCATION, true); - } - curl_setopt($crs, CURLOPT_CONNECTTIMEOUT, 5); - curl_setopt($crs, CURLOPT_TIMEOUT, 30); - curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false); - curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file'); - curl_setopt($crs, CURLOPT_MAXREDIRS, 5); - if (defined('CURLOPT_PROTOCOLS')) { - curl_setopt($crs, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP | CURLPROTO_FTP | CURLPROTO_FTPS); - } + $curlopts = []; + if ( + (ini_get('open_basedir') == '') + && (ini_get('safe_mode') === '' + || ini_get('safe_mode') === false) + ) { + $curlopts[CURLOPT_FOLLOWLOCATION] = true; + } + $curlopts = array_replace($curlopts, self::CURLOPT_DEFAULT); + $curlopts = array_replace($curlopts, K_CURLOPTS); + $curlopts = array_replace($curlopts, self::CURLOPT_FIXED); + $curlopts[CURLOPT_URL] = $url; + curl_setopt_array($crs, $curlopts); curl_exec($crs); $code = curl_getinfo($crs, CURLINFO_HTTP_CODE); curl_close($crs); @@ -1957,22 +1981,19 @@ public static function fileGetContents($file) { ) { // try to get remote file data using cURL $crs = curl_init(); - curl_setopt($crs, CURLOPT_URL, $path); - curl_setopt($crs, CURLOPT_BINARYTRANSFER, true); - curl_setopt($crs, CURLOPT_FAILONERROR, true); - curl_setopt($crs, CURLOPT_RETURNTRANSFER, true); - if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) { - curl_setopt($crs, CURLOPT_FOLLOWLOCATION, true); - } - curl_setopt($crs, CURLOPT_CONNECTTIMEOUT, 5); - curl_setopt($crs, CURLOPT_TIMEOUT, 30); - curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false); - curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file'); - curl_setopt($crs, CURLOPT_MAXREDIRS, 5); - if (defined('CURLOPT_PROTOCOLS')) { - curl_setopt($crs, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS | CURLPROTO_HTTP | CURLPROTO_FTP | CURLPROTO_FTPS); + $curlopts = []; + if ( + (ini_get('open_basedir') == '') + && (ini_get('safe_mode') === '' + || ini_get('safe_mode') === false) + ) { + $curlopts[CURLOPT_FOLLOWLOCATION] = true; } + $curlopts = array_replace($curlopts, self::CURLOPT_DEFAULT); + $curlopts = array_replace($curlopts, K_CURLOPTS); + $curlopts = array_replace($curlopts, self::CURLOPT_FIXED); + $curlopts[CURLOPT_URL] = $url; + curl_setopt_array($crs, $curlopts); $ret = curl_exec($crs); curl_close($crs); if ($ret !== false) { @@ -2631,7 +2652,6 @@ public static function getPageMode($mode='UseNone') { return $page_mode; } - } // END OF TCPDF_STATIC CLASS //============================================================+ diff --git a/vendor/tecnickcom/tcpdf/tcpdf.php b/vendor/tecnickcom/tcpdf/tcpdf.php index 60f93c4..42c425e 100644 --- a/vendor/tecnickcom/tcpdf/tcpdf.php +++ b/vendor/tecnickcom/tcpdf/tcpdf.php @@ -1,13 +1,13 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.6.5 + * @version 6.10.0 */ // TCPDF configuration @@ -128,7 +128,7 @@ * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.
      * @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 6.7.5 + * @version 6.10.0 * @author Nicola Asuni - info@tecnick.com * @IgnoreAnnotation("protected") * @IgnoreAnnotation("public") @@ -1810,6 +1810,13 @@ class TCPDF { */ protected $custom_xmp_rdf = ''; + /** + * Custom XMP RDF pdfaextension data. + * @protected + * @since 6.9.0 (2025-02-11) + */ + protected $custom_xmp_rdf_pdfaExtension = ''; + /** * Overprint mode array. * (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008). @@ -3007,6 +3014,7 @@ public function setAllowLocalFiles($allowLocalFiles) { public function Error($msg) { // unset all class variables $this->_destroy(true); + $msg = htmlspecialchars($msg, ENT_QUOTES, 'UTF-8'); if (defined('K_TCPDF_THROW_EXCEPTION_ERROR') AND !K_TCPDF_THROW_EXCEPTION_ERROR) { die('TCPDF ERROR: '.$msg); } else { @@ -4931,6 +4939,32 @@ public function Annotation($x, $y, $w, $h, $text, $opt=array('Subtype'=>'Text'), } } + /** + * Embed the attached files. + * @since 6.9.000 (2025-02-11) + * @public + */ + public function EmbedFile($opt) { + if (!$this->pdfa_mode || ($this->pdfa_mode && $this->pdfa_version == 3)) { + if ((($opt['Subtype'] == 'FileAttachment')) AND (!TCPDF_STATIC::empty_string($opt['FS'])) + AND (@TCPDF_STATIC::file_exists($opt['FS']) OR TCPDF_STATIC::isValidURL($opt['FS'])) + AND (!isset($this->embeddedfiles[basename($opt['FS'])]))) { + $this->embeddedfiles[basename($opt['FS'])] = array('f' => ++$this->n, 'n' => ++$this->n, 'file' => $opt['FS']); + } + } + } + + /** + * Embed the attached files. + * @since 6.9.000 (2025-02-11) + * @public + */ + public function EmbedFileFromString($filename, $content) { + if (!$this->pdfa_mode || ($this->pdfa_mode && $this->pdfa_version == 3)) { + $this->embeddedfiles[$filename] = array('f' => ++$this->n, 'n' => ++$this->n, 'content' => $content ); + } + } + /** * Embedd the attached files. * @since 4.4.000 (2008-12-07) @@ -4944,7 +4978,12 @@ protected function _putEmbeddedFiles() { } reset($this->embeddedfiles); foreach ($this->embeddedfiles as $filename => $filedata) { - $data = $this->getCachedFileContents($filedata['file']); + $data = false; + if (isset($filedata['file']) && !empty($filedata['file'])) { + $data = $this->getCachedFileContents($filedata['file']); + } elseif ($filedata['content'] && !empty($filedata['content'])) { + $data = $filedata['content']; + } if ($data !== FALSE) { $rawsize = strlen($data); if ($rawsize > 0) { @@ -6988,7 +7027,7 @@ public function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='', $ unset($imgdata); $imsize = @getimagesize($file); if ($imsize === FALSE) { - unlink($file); + $this->_unlink($file); $file = $original_file; } } @@ -7221,7 +7260,7 @@ public function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='', $ $tempname = TCPDF_STATIC::getObjFilename('img', $this->file_id); $img->writeImage($tempname); $info = TCPDF_IMAGES::_parsejpeg($tempname); - unlink($tempname); + $this->_unlink($tempname); $img->destroy(); } catch(Exception $e) { $info = false; @@ -7857,15 +7896,16 @@ public function _destroy($destroyall=false, $preserve_objcopy=false) { if ($handle = @opendir(K_PATH_CACHE)) { while ( false !== ( $file_name = readdir( $handle ) ) ) { if (strpos($file_name, '__tcpdf_'.$this->file_id.'_') === 0) { - unlink(K_PATH_CACHE.$file_name); + $this->_unlink(K_PATH_CACHE.$file_name); } } closedir($handle); } if (isset($this->imagekeys)) { foreach($this->imagekeys as $file) { - if (strpos($file, K_PATH_CACHE) === 0 && TCPDF_STATIC::file_exists($file)) { - @unlink($file); + if ((strpos($file, K_PATH_CACHE.'__tcpdf_'.$this->file_id.'_') === 0) + && TCPDF_STATIC::file_exists($file)) { + $this->_unlink($file); } } } @@ -8164,7 +8204,7 @@ protected function _putpages() { * @since 5.0.010 (2010-05-17) */ protected function _getannotsrefs($n) { - if (!(isset($this->PageAnnots[$n]) OR ($this->sign AND isset($this->signature_data['cert_type'])))) { + if (!(isset($this->PageAnnots[$n]) OR count($this->empty_signature_appearance)>0 OR ($this->sign AND isset($this->signature_data['cert_type'])))) { return ''; } $out = ' /Annots ['; @@ -8310,15 +8350,15 @@ protected function _putannotsobjs() { break; } case 'locked': { - $fval += 1 << 8; + $fval += 1 << 7; break; } case 'togglenoview': { - $fval += 1 << 9; + $fval += 1 << 8; break; } case 'lockedcontents': { - $fval += 1 << 10; + $fval += 1 << 9; break; } default: { @@ -8532,7 +8572,7 @@ protected function _putannotsobjs() { } case 'freetext': { if (isset($pl['opt']['da']) AND !empty($pl['opt']['da'])) { - $annots .= ' /DA ('.$pl['opt']['da'].')'; + $annots .= ' /DA '.$this->_datastring($pl['opt']['da']); } if (isset($pl['opt']['q']) AND ($pl['opt']['q'] >= 0) AND ($pl['opt']['q'] <= 2)) { $annots .= ' /Q '.intval($pl['opt']['q']); @@ -8789,7 +8829,7 @@ protected function _putannotsobjs() { $annots .= ' /AA << '.$pl['opt']['aa'].' >>'; } if (isset($pl['opt']['da']) AND !empty($pl['opt']['da'])) { - $annots .= ' /DA ('.$pl['opt']['da'].')'; + $annots .= ' /DA '.$this->_datastring($pl['opt']['da']); } if (isset($pl['opt']['q']) AND ($pl['opt']['q'] >= 0) AND ($pl['opt']['q'] <= 2)) { $annots .= ' /Q '.intval($pl['opt']['q']); @@ -9628,6 +9668,17 @@ public function setExtraXMPRDF($xmp) { $this->custom_xmp_rdf = $xmp; } + /** + * Set additional XMP data to be added to the default XMP data for PDF/A extensions. + * IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method! + * @param string $xmp Custom XMP RDF data. + * @since 6.9.0 (2025-02-14) + * @public + */ + public function setExtraXMPPdfaextension($xmp) { + $this->custom_xmp_rdf_pdfaExtension = $xmp; + } + /** * Put XMP data object and return ID. * @return int The object ID. @@ -9762,6 +9813,7 @@ protected function _putXMP() { $xmp .= "\t\t\t\t\t\t\t".''."\n"; $xmp .= "\t\t\t\t\t\t".''."\n"; $xmp .= "\t\t\t\t\t".''."\n"; + $xmp .= $this->custom_xmp_rdf_pdfaExtension; $xmp .= "\t\t\t\t".''."\n"; $xmp .= "\t\t\t".''."\n"; $xmp .= "\t\t".''."\n"; @@ -9800,7 +9852,11 @@ protected function _putcatalog() { } // start catalog $oid = $this->_newobj(); - $out = '<< /Type /Catalog'; + $out = '<< '; + if (!empty($this->efnames)) { + $out .= ' /AF [ '. implode(' ', $this->efnames) .' ]'; + } + $out .= ' /Type /Catalog'; $out .= ' /Version /'.$this->PDFVersion; //$out .= ' /Extensions <<>>'; $out .= ' /Pages 1 0 R'; @@ -9939,7 +9995,7 @@ protected function _putcatalog() { $out .= ' >> >>'; } $font = $this->getFontBuffer((($this->pdfa_mode) ? 'pdfa' : '') .'helvetica'); - $out .= ' /DA (/F'.$font['i'].' 0 Tf 0 g)'; + $out .= ' /DA ' . $this->_datastring('/F'.$font['i'].' 0 Tf 0 g'); $out .= ' /Q '.(($this->rtl)?'2':'0'); //$out .= ' /XFA '; $out .= ' >>'; @@ -11046,7 +11102,7 @@ public function setProtection($permissions=array('print', 'modify', 'copy', 'ann $this->encryptdata['V'] = 4; $this->encryptdata['Length'] = 128; $this->encryptdata['CF']['CFM'] = 'AESV2'; - $this->encryptdata['CF']['Length'] = 128; + $this->encryptdata['CF']['Length'] = 16; if ($this->encryptdata['pubkey']) { $this->encryptdata['SubFilter'] = 'adbe.pkcs7.s5'; $this->encryptdata['Recipients'] = array(); @@ -11057,7 +11113,7 @@ public function setProtection($permissions=array('print', 'modify', 'copy', 'ann $this->encryptdata['V'] = 5; $this->encryptdata['Length'] = 256; $this->encryptdata['CF']['CFM'] = 'AESV3'; - $this->encryptdata['CF']['Length'] = 256; + $this->encryptdata['CF']['Length'] = 32; if ($this->encryptdata['pubkey']) { $this->encryptdata['SubFilter'] = 'adbe.pkcs7.s5'; $this->encryptdata['Recipients'] = array(); @@ -13936,8 +13992,8 @@ public function setVisibility($v) { * @since 3.0.000 (2008-03-27) */ protected function addExtGState($parms) { - if ($this->pdfa_mode || $this->pdfa_version >= 2) { - // transparencies are not allowed in PDF/A mode + if (($this->pdfa_mode && $this->pdfa_version < 2) || ($this->state != 2)) { + // transparency is not allowed in PDF/A-1 mode return; } // check if this ExtGState already exist @@ -16440,7 +16496,7 @@ protected function getHtmlDomArray($html) { ) ); - if(empty($html)) { + if($html === '' || $html === null) { return $dom; } // array of CSS styles ( selector => properties). @@ -17259,7 +17315,7 @@ protected function unserializeTCPDFtag($data) { $hlen = intval(substr($data, 0, $hpos)); $hash = substr($data, $hpos + 1, $hlen); $encoded = substr($data, $hpos + 2 + $hlen); - if ($hash != $this->hashTCPDFtag($encoded)) { + if (!hash_equals( $this->hashTCPDFtag($encoded), $hash)) { $this->Error('Invalid parameters'); } return json_decode(urldecode($encoded), true); @@ -17425,6 +17481,9 @@ public function writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=fal } } if ($key == $maxel) break; + if ($dom[$key]['tag'] AND $dom[$key]['opening'] AND !empty($dom[$key]['attribute']['id'])) { + $this->setDestination($dom[$key]['attribute']['id']); + } if ($dom[$key]['tag'] AND isset($dom[$key]['attribute']['pagebreak'])) { // check for pagebreak if (($dom[$key]['attribute']['pagebreak'] == 'true') OR ($dom[$key]['attribute']['pagebreak'] == 'left') OR ($dom[$key]['attribute']['pagebreak'] == 'right')) { @@ -18867,6 +18926,29 @@ public function writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=fal unset($dom); } + /** + * Check if the path is relative. + * @param string $path path to check + * @return boolean true if the path is relative + * @protected + * @since 6.9.1 + */ + protected function isRelativePath($path) { + return (strpos(str_ireplace('%2E', '.', $this->unhtmlentities($path)), '..') !== false); + } + + /** + * Check if it contains a non-allowed external protocol. + * @param string $path path to check + * @return boolean true if the protocol is not allowed. + * @protected + * @since 6.9.3 + */ + protected function hasExtForbiddenProtocol($path) { + return ((strpos($path, '://') !== false) + && (preg_match('|^https?://|', $path) !== 1)); + } + /** * Process opening tags. * @param array $dom html dom array @@ -19010,29 +19092,29 @@ protected function openHTMLTagHandler($dom, $key, $cell) { $this->setLineWidth($hrHeight); $lineStyle = array(); - if (isset($tag['fgcolor'])) { - $lineStyle['color'] = $tag['fgcolor']; - } + if (isset($tag['fgcolor'])) { + $lineStyle['color'] = $tag['fgcolor']; + } - if (isset($tag['fgcolor'])) { - $lineStyle['color'] = $tag['fgcolor']; - } + if (isset($tag['fgcolor'])) { + $lineStyle['color'] = $tag['fgcolor']; + } - if (isset($tag['style']['cap'])) { - $lineStyle['cap'] = $tag['style']['cap']; - } + if (isset($tag['style']['cap'])) { + $lineStyle['cap'] = $tag['style']['cap']; + } - if (isset($tag['style']['join'])) { - $lineStyle['join'] = $tag['style']['join']; - } + if (isset($tag['style']['join'])) { + $lineStyle['join'] = $tag['style']['join']; + } - if (isset($tag['style']['dash'])) { - $lineStyle['dash'] = $tag['style']['dash']; - } + if (isset($tag['style']['dash'])) { + $lineStyle['dash'] = $tag['style']['dash']; + } - if (isset($tag['style']['phase'])) { - $lineStyle['phase'] = $tag['style']['phase']; - } + if (isset($tag['style']['phase'])) { + $lineStyle['phase'] = $tag['style']['phase']; + } $lineStyle = array_filter($lineStyle); @@ -19055,15 +19137,20 @@ protected function openHTMLTagHandler($dom, $key, $cell) { if ($imgsrc[0] === '@') { // data stream $imgsrc = '@'.base64_decode(substr($imgsrc, 1)); - $type = ''; + $type = preg_match('/]*[^>]*>.*<\/svg>/is', $imgsrc) ? 'svg' : ''; } else if (preg_match('@^data:image/([^;]*);base64,(.*)@', $imgsrc, $reg)) { $imgsrc = '@'.base64_decode($reg[2]); $type = $reg[1]; + } elseif ($this->isRelativePath($imgsrc)) { + // accessing parent folders is not allowed + break; } elseif ( $this->allowLocalFiles && substr($imgsrc, 0, 7) === 'file://') { - // get image type from a local file path - $imgsrc = substr($imgsrc, 7); - $type = TCPDF_IMAGES::getImageFileType($imgsrc); - } else { + // get image type from a local file path + $imgsrc = substr($imgsrc, 7); + $type = TCPDF_IMAGES::getImageFileType($imgsrc); + } elseif ($this->hasExtForbiddenProtocol($imgsrc)) { + break; + } else { if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { // fix image path $findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']); @@ -19121,7 +19208,7 @@ protected function openHTMLTagHandler($dom, $key, $cell) { $imglink = ''; if (isset($this->HREF['url']) AND !TCPDF_STATIC::empty_string($this->HREF['url'])) { $imglink = $this->HREF['url']; - if ($imglink[0] == '#') { + if ($imglink[0] == '#' AND isset($imglink[1]) AND is_numeric($imglink[1])) { // convert url to internal link $lnkdata = explode(',', $imglink); if (isset($lnkdata[0])) { @@ -19982,7 +20069,7 @@ protected function closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney=0) { } } if (!$in_table_head) { // we are not inside a thead section - $this->cell_padding = isset($table_el['old_cell_padding']) ? $table_el['old_cell_padding'] : null; + $this->cell_padding = isset($table_el['old_cell_padding']) ? $table_el['old_cell_padding'] : array('T' => 0, 'R' => 0, 'B' => 0, 'L' => 0); // reset row height $this->resetLastH(); if (($this->page == ($this->numpages - 1)) AND ($this->pageopen[$this->numpages])) { @@ -23170,14 +23257,12 @@ public function ImageSVG($file, $x=null, $y=null, $w=0, $h=0, $link='', $align=' $this->_out(sprintf('%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, ($e + $svgoffset_x), ($f + $svgoffset_y))); // creates a new XML parser to be used by the other XML functions $parser = xml_parser_create('UTF-8'); - // the following function allows to use parser inside object - xml_set_object($parser, $this); // disable case-folding for this XML parser xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); // sets the element handler functions for the XML parser - xml_set_element_handler($parser, 'startSVGElementHandler', 'endSVGElementHandler'); + xml_set_element_handler($parser, [$this, 'startSVGElementHandler'], [$this, 'endSVGElementHandler']); // sets the character data handler function for the XML parser - xml_set_character_data_handler($parser, 'segSVGContentHandler'); + xml_set_character_data_handler($parser, [$this, 'segSVGContentHandler']); // start parsing an XML document if (!xml_parse($parser, $svgdata)) { $error_message = sprintf('SVG Error: %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser)); @@ -23327,7 +23412,7 @@ protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1 $text_color = TCPDF_COLORS::convertHTMLColorToDec($svgstyle['text-color'], $this->spot_colors); $this->setTextColorArray($text_color); // clip - if (preg_match('/rect\(([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)\)/si', $svgstyle['clip'], $regs)) { + if (preg_match('/rect\(([a-z0-9\-\.]*+)[\s]*+([a-z0-9\-\.]*+)[\s]*+([a-z0-9\-\.]*+)[\s]*+([a-z0-9\-\.]*+)\)/si', $svgstyle['clip'], $regs)) { $top = (isset($regs[1])?$this->getHTMLUnitToUnits($regs[1], 0, $this->svgunit, false):0); $right = (isset($regs[2])?$this->getHTMLUnitToUnits($regs[2], 0, $this->svgunit, false):0); $bottom = (isset($regs[3])?$this->getHTMLUnitToUnits($regs[3], 0, $this->svgunit, false):0); @@ -23444,13 +23529,15 @@ protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1 $cy -= $h; } $this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), ($cy * $this->k))); - if (count($gradient['stops']) > 1) { - $this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false); + if ((is_array($gradient['stops']) || $gradient['stops'] instanceof Countable) && count($gradient['stops']) > 1) { + $this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops']); } } elseif ($svgstyle['fill'] != 'none') { $fill_color = TCPDF_COLORS::convertHTMLColorToDec($svgstyle['fill'], $this->spot_colors); if ($svgstyle['fill-opacity'] != 1) { $this->setAlpha($this->alpha['CA'], 'Normal', $svgstyle['fill-opacity'], false); + } elseif (preg_match('/rgba\(\d+%?,\s*\d+%?,\s*\d+%?,\s*(\d+(?:\.\d+)?)\)/i', $svgstyle['fill'], $rgba_matches)) { + $this->setAlpha($this->alpha['CA'], 'Normal', $rgba_matches[1], false); } $this->setFillColorArray($fill_color); if ($svgstyle['fill-rule'] == 'evenodd') { @@ -23484,7 +23571,7 @@ protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1 if (preg_match('/font-family[\s]*:[\s]*([^\;\"]*)/si', $svgstyle['font'], $regs)) { $font_family = $this->getFontFamilyName($regs[1]); } else { - $font_family = $svgstyle['font-family']; + $font_family = $this->getFontFamilyName($svgstyle['font-family']); } if (preg_match('/font-size[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle['font'], $regs)) { $font_size = trim($regs[1]); @@ -23639,7 +23726,8 @@ protected function SVGPath($d, $style='') { $params = array(); if (isset($val[2])) { // get curve parameters - $rawparams = preg_split('/([\,\s]+)/si', trim($val[2])); + preg_match_all('/-?\d*\.?\d+/', trim($val[2]), $matches); + $rawparams = $matches[0]; $params = array(); foreach ($rawparams as $ck => $cp) { $params[$ck] = $this->getHTMLUnitToUnits($cp, 0, $this->svgunit, false); @@ -24464,6 +24552,9 @@ protected function startSVGElementHandler($parser, $name, $attribs, $ctm=array() $img = '@'.base64_decode(substr($img, strlen($m[0]))); } else { // fix image path + if ($this->isRelativePath($img) || $this->hasExtForbiddenProtocol($img)) { + break; + } if (!TCPDF_STATIC::empty_string($this->svgdir) AND (($img[0] == '.') OR (basename($img) == $img))) { // replace relative path with full server path $img = $this->svgdir.'/'.$img; @@ -24784,6 +24875,20 @@ protected function fileExists($file) return TCPDF_STATIC::file_exists($file); } + /** + * Wrapper for unlink with disabled protocols. + * @param string $file + * @return bool + */ + protected function _unlink($file) + { + if ((strpos($file, '://') !== false) && ((substr($file, 0, 7) !== 'file://') || (!$this->allowLocalFiles))) { + // forbidden protocol + return false; + } + return @unlink($file); + } + } // END OF TCPDF CLASS //============================================================+ diff --git a/vendor/tecnickcom/tcpdf/tcpdf_autoconfig.php b/vendor/tecnickcom/tcpdf/tcpdf_autoconfig.php index 2bcfccb..d31ee87 100644 --- a/vendor/tecnickcom/tcpdf/tcpdf_autoconfig.php +++ b/vendor/tecnickcom/tcpdf/tcpdf_autoconfig.php @@ -3,11 +3,11 @@ // File name : tcpdf_autoconfig.php // Version : 1.1.1 // Begin : 2013-05-16 -// Last Update : 2014-12-18 +// Last Update : 2025-04-18 // Authors : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- -// Copyright (C) 2011-2014 Nicola Asuni - Tecnick.com LTD +// Copyright (C) 2011-2025 Nicola Asuni - Tecnick.com LTD // // This file is part of TCPDF software library. // @@ -37,9 +37,14 @@ * @file * Try to automatically configure some TCPDF constants if not defined. * @package com.tecnick.tcpdf - * @version 1.1.1 + * @version 1.2.1 */ +// Disable phar stream wrapper globally. +// if (in_array('phar', stream_get_wrappers(), true)) { +// stream_wrapper_unregister('phar'); +// } + // DOCUMENT_ROOT fix for IIS Webserver if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { if(isset($_SERVER['SCRIPT_FILENAME'])) { @@ -240,6 +245,11 @@ define('K_TIMEZONE', @date_default_timezone_get()); } +// Custom cURL options for curl_setopt_array. +if (!defined('K_CURLOPTS')) { + define('K_CURLOPTS', array()); +} + //============================================================+ // END OF FILE //============================================================+ diff --git a/vendor/tecnickcom/tcpdf/tcpdf_import.php b/vendor/tecnickcom/tcpdf/tcpdf_import.php deleted file mode 100644 index 57f9f4f..0000000 --- a/vendor/tecnickcom/tcpdf/tcpdf_import.php +++ /dev/null @@ -1,104 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : This is a PHP class extension of the TCPDF library to -// import existing PDF documents. -// -//============================================================+ - -/** - * @file - * !!! THIS CLASS IS UNDER DEVELOPMENT !!! - * This is a PHP class extension of the TCPDF (http://www.tcpdf.org) library to import existing PDF documents.
      - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.001 - */ - -// include the TCPDF class -require_once(dirname(__FILE__).'/tcpdf.php'); -// include PDF parser class -require_once(dirname(__FILE__).'/tcpdf_parser.php'); - -/** - * @class TCPDF_IMPORT - * !!! THIS CLASS IS UNDER DEVELOPMENT !!! - * PHP class extension of the TCPDF (http://www.tcpdf.org) library to import existing PDF documents.
      - * @package com.tecnick.tcpdf - * @brief PHP class extension of the TCPDF library to import existing PDF documents. - * @version 1.0.001 - * @author Nicola Asuni - info@tecnick.com - */ -class TCPDF_IMPORT extends TCPDF { - - /** - * Import an existing PDF document - * @param string $filename Filename of the PDF document to import. - * @return void - * @public - * @since 1.0.000 (2011-05-24) - */ - public function importPDF($filename) { - // load document - $rawdata = file_get_contents($filename); - if ($rawdata === false) { - $this->Error('Unable to get the content of the file: '.$filename); - } - // configuration parameters for parser - $cfg = array( - 'die_for_errors' => false, - 'ignore_filter_decoding_errors' => true, - 'ignore_missing_filter_decoders' => true, - ); - try { - // parse PDF data - $pdf = new TCPDF_PARSER($rawdata, $cfg); - } catch (Exception $e) { - die($e->getMessage()); - } - // get the parsed data - $data = $pdf->getParsedData(); - // release some memory - unset($rawdata); - - // ... - - - print_r($data); // DEBUG - - - unset($pdf); - } - -} // END OF CLASS - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/tecnickcom/tcpdf/tcpdf_parser.php b/vendor/tecnickcom/tcpdf/tcpdf_parser.php deleted file mode 100644 index 4156230..0000000 --- a/vendor/tecnickcom/tcpdf/tcpdf_parser.php +++ /dev/null @@ -1,815 +0,0 @@ -. -// -// See LICENSE.TXT file for more information. -// ------------------------------------------------------------------- -// -// Description : This is a PHP class for parsing PDF documents. -// -//============================================================+ - -/** - * @file - * This is a PHP class for parsing PDF documents.
      - * @package com.tecnick.tcpdf - * @author Nicola Asuni - * @version 1.0.15 - */ - -// include class for decoding filters -require_once(dirname(__FILE__).'/include/tcpdf_filters.php'); - -/** - * @class TCPDF_PARSER - * This is a PHP class for parsing PDF documents.
      - * @package com.tecnick.tcpdf - * @brief This is a PHP class for parsing PDF documents.. - * @version 1.0.15 - * @author Nicola Asuni - info@tecnick.com - */ -class TCPDF_PARSER { - - /** - * Raw content of the PDF document. - * @private - */ - private $pdfdata = ''; - - /** - * XREF data. - * @protected - */ - protected $xref = array(); - - /** - * Array of PDF objects. - * @protected - */ - protected $objects = array(); - - /** - * Class object for decoding filters. - * @private - */ - private $FilterDecoders; - - /** - * Array of configuration parameters. - * @private - */ - private $cfg = array( - 'die_for_errors' => false, - 'ignore_filter_decoding_errors' => true, - 'ignore_missing_filter_decoders' => true, - ); - -// ----------------------------------------------------------------------------- - - /** - * Parse a PDF document an return an array of objects. - * @param string $data PDF data to parse. - * @param array $cfg Array of configuration parameters: - * 'die_for_errors' : if true termitate the program execution in case of error, otherwise thows an exception; - * 'ignore_filter_decoding_errors' : if true ignore filter decoding errors; - * 'ignore_missing_filter_decoders' : if true ignore missing filter decoding errors. - * @public - * @since 1.0.000 (2011-05-24) - */ - public function __construct($data, $cfg=array()) { - if (empty($data)) { - $this->Error('Empty PDF data.'); - } - // find the pdf header starting position - if (($trimpos = strpos($data, '%PDF-')) === FALSE) { - $this->Error('Invalid PDF data: missing %PDF header.'); - } - // get PDF content string - $this->pdfdata = substr($data, $trimpos); - // get length - $pdflen = strlen($this->pdfdata); - // set configuration parameters - $this->setConfig($cfg); - // get xref and trailer data - $this->xref = $this->getXrefData(); - // parse all document objects - $this->objects = array(); - foreach ($this->xref['xref'] as $obj => $offset) { - if (!isset($this->objects[$obj]) AND ($offset > 0)) { - // decode objects with positive offset - $this->objects[$obj] = $this->getIndirectObject($obj, $offset, true); - } - } - // release some memory - unset($this->pdfdata); - $this->pdfdata = ''; - } - - /** - * Set the configuration parameters. - * @param array $cfg Array of configuration parameters: - * 'die_for_errors' : if true termitate the program execution in case of error, otherwise thows an exception; - * 'ignore_filter_decoding_errors' : if true ignore filter decoding errors; - * 'ignore_missing_filter_decoders' : if true ignore missing filter decoding errors. - * @public - */ - protected function setConfig($cfg) { - if (isset($cfg['die_for_errors'])) { - $this->cfg['die_for_errors'] = !!$cfg['die_for_errors']; - } - if (isset($cfg['ignore_filter_decoding_errors'])) { - $this->cfg['ignore_filter_decoding_errors'] = !!$cfg['ignore_filter_decoding_errors']; - } - if (isset($cfg['ignore_missing_filter_decoders'])) { - $this->cfg['ignore_missing_filter_decoders'] = !!$cfg['ignore_missing_filter_decoders']; - } - } - - /** - * Return an array of parsed PDF document objects. - * @return array Array of parsed PDF document objects. - * @public - * @since 1.0.000 (2011-06-26) - */ - public function getParsedData() { - return array($this->xref, $this->objects); - } - - /** - * Get Cross-Reference (xref) table and trailer data from PDF document data. - * @param int $offset xref offset (if know). - * @param array $xref previous xref array (if any). - * @return array containing xref and trailer data. - * @protected - * @since 1.0.000 (2011-05-24) - */ - protected function getXrefData($offset=0, $xref=array()) { - if ($offset == 0) { - // find last startxref - if (preg_match_all('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_SET_ORDER, $offset) == 0) { - $this->Error('Unable to find startxref'); - } - $matches = array_pop($matches); - $startxref = $matches[1]; - } elseif (strpos($this->pdfdata, 'xref', $offset) == $offset) { - // Already pointing at the xref table - $startxref = $offset; - } elseif (preg_match('/([0-9]+[\s][0-9]+[\s]obj)/i', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset)) { - // Cross-Reference Stream object - $startxref = $offset; - } elseif (preg_match('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset)) { - // startxref found - $startxref = $matches[1][0]; - } else { - $this->Error('Unable to find startxref'); - } - // check xref position - if (strpos($this->pdfdata, 'xref', $startxref) == $startxref) { - // Cross-Reference - $xref = $this->decodeXref($startxref, $xref); - } else { - // Cross-Reference Stream - $xref = $this->decodeXrefStream($startxref, $xref); - } - if (empty($xref)) { - $this->Error('Unable to find xref'); - } - return $xref; - } - - /** - * Decode the Cross-Reference section - * @param int $startxref Offset at which the xref section starts (position of the 'xref' keyword). - * @param array $xref Previous xref array (if any). - * @return array containing xref and trailer data. - * @protected - * @since 1.0.000 (2011-06-20) - */ - protected function decodeXref($startxref, $xref=array()) { - $startxref += 4; // 4 is the length of the word 'xref' - // skip initial white space chars: \x00 null (NUL), \x09 horizontal tab (HT), \x0A line feed (LF), \x0C form feed (FF), \x0D carriage return (CR), \x20 space (SP) - $offset = $startxref + strspn($this->pdfdata, "\x00\x09\x0a\x0c\x0d\x20", $startxref); - // initialize object number - $obj_num = 0; - // search for cross-reference entries or subsection - while (preg_match('/([0-9]+)[\x20]([0-9]+)[\x20]?([nf]?)(\r\n|[\x20]?[\r\n])/', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) { - if ($matches[0][1] != $offset) { - // we are on another section - break; - } - $offset += strlen($matches[0][0]); - if ($matches[3][0] == 'n') { - // create unique object index: [object number]_[generation number] - $index = $obj_num.'_'.intval($matches[2][0]); - // check if object already exist - if (!isset($xref['xref'][$index])) { - // store object offset position - $xref['xref'][$index] = intval($matches[1][0]); - } - ++$obj_num; - } elseif ($matches[3][0] == 'f') { - ++$obj_num; - } else { - // object number (index) - $obj_num = intval($matches[1][0]); - } - } - // get trailer data - if (preg_match('/trailer[\s]*<<(.*)>>/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) { - $trailer_data = $matches[1][0]; - if (!isset($xref['trailer']) OR empty($xref['trailer'])) { - // get only the last updated version - $xref['trailer'] = array(); - // parse trailer_data - if (preg_match('/Size[\s]+([0-9]+)/i', $trailer_data, $matches) > 0) { - $xref['trailer']['size'] = intval($matches[1]); - } - if (preg_match('/Root[\s]+([0-9]+)[\s]+([0-9]+)[\s]+R/i', $trailer_data, $matches) > 0) { - $xref['trailer']['root'] = intval($matches[1]).'_'.intval($matches[2]); - } - if (preg_match('/Encrypt[\s]+([0-9]+)[\s]+([0-9]+)[\s]+R/i', $trailer_data, $matches) > 0) { - $xref['trailer']['encrypt'] = intval($matches[1]).'_'.intval($matches[2]); - } - if (preg_match('/Info[\s]+([0-9]+)[\s]+([0-9]+)[\s]+R/i', $trailer_data, $matches) > 0) { - $xref['trailer']['info'] = intval($matches[1]).'_'.intval($matches[2]); - } - if (preg_match('/ID[\s]*[\[][\s]*[<]([^>]*)[>][\s]*[<]([^>]*)[>]/i', $trailer_data, $matches) > 0) { - $xref['trailer']['id'] = array(); - $xref['trailer']['id'][0] = $matches[1]; - $xref['trailer']['id'][1] = $matches[2]; - } - } - if (preg_match('/Prev[\s]+([0-9]+)/i', $trailer_data, $matches) > 0) { - // get previous xref - $xref = $this->getXrefData(intval($matches[1]), $xref); - } - } else { - $this->Error('Unable to find trailer'); - } - return $xref; - } - - /** - * Decode the Cross-Reference Stream section - * @param int $startxref Offset at which the xref section starts. - * @param array $xref Previous xref array (if any). - * @return array containing xref and trailer data. - * @protected - * @since 1.0.003 (2013-03-16) - */ - protected function decodeXrefStream($startxref, $xref=array()) { - // try to read Cross-Reference Stream - $xrefobj = $this->getRawObject($startxref); - $xrefcrs = $this->getIndirectObject($xrefobj[1], $startxref, true); - if (!isset($xref['trailer']) OR empty($xref['trailer'])) { - // get only the last updated version - $xref['trailer'] = array(); - $filltrailer = true; - } else { - $filltrailer = false; - } - if (!isset($xref['xref'])) { - $xref['xref'] = array(); - } - $valid_crs = false; - $columns = 0; - $sarr = $xrefcrs[0][1]; - if (!is_array($sarr)) { - $sarr = array(); - } - foreach ($sarr as $k => $v) { - if (($v[0] == '/') AND ($v[1] == 'Type') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == '/') AND ($sarr[($k +1)][1] == 'XRef'))) { - $valid_crs = true; - } elseif (($v[0] == '/') AND ($v[1] == 'Index') AND (isset($sarr[($k +1)]))) { - // first object number in the subsection - $index_first = intval($sarr[($k +1)][1][0][1]); - // number of entries in the subsection - $index_entries = intval($sarr[($k +1)][1][1][1]); - } elseif (($v[0] == '/') AND ($v[1] == 'Prev') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'numeric'))) { - // get previous xref offset - $prevxref = intval($sarr[($k +1)][1]); - } elseif (($v[0] == '/') AND ($v[1] == 'W') AND (isset($sarr[($k +1)]))) { - // number of bytes (in the decoded stream) of the corresponding field - $wb = array(); - $wb[0] = intval($sarr[($k +1)][1][0][1]); - $wb[1] = intval($sarr[($k +1)][1][1][1]); - $wb[2] = intval($sarr[($k +1)][1][2][1]); - } elseif (($v[0] == '/') AND ($v[1] == 'DecodeParms') AND (isset($sarr[($k +1)][1]))) { - $decpar = $sarr[($k +1)][1]; - foreach ($decpar as $kdc => $vdc) { - if (($vdc[0] == '/') AND ($vdc[1] == 'Columns') AND (isset($decpar[($kdc +1)]) AND ($decpar[($kdc +1)][0] == 'numeric'))) { - $columns = intval($decpar[($kdc +1)][1]); - } elseif (($vdc[0] == '/') AND ($vdc[1] == 'Predictor') AND (isset($decpar[($kdc +1)]) AND ($decpar[($kdc +1)][0] == 'numeric'))) { - $predictor = intval($decpar[($kdc +1)][1]); - } - } - } elseif ($filltrailer) { - if (($v[0] == '/') AND ($v[1] == 'Size') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'numeric'))) { - $xref['trailer']['size'] = $sarr[($k +1)][1]; - } elseif (($v[0] == '/') AND ($v[1] == 'Root') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'objref'))) { - $xref['trailer']['root'] = $sarr[($k +1)][1]; - } elseif (($v[0] == '/') AND ($v[1] == 'Info') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'objref'))) { - $xref['trailer']['info'] = $sarr[($k +1)][1]; - } elseif (($v[0] == '/') AND ($v[1] == 'Encrypt') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'objref'))) { - $xref['trailer']['encrypt'] = $sarr[($k +1)][1]; - } elseif (($v[0] == '/') AND ($v[1] == 'ID') AND (isset($sarr[($k +1)]))) { - $xref['trailer']['id'] = array(); - $xref['trailer']['id'][0] = $sarr[($k +1)][1][0][1]; - $xref['trailer']['id'][1] = $sarr[($k +1)][1][1][1]; - } - } - } - // decode data - if ($valid_crs AND isset($xrefcrs[1][3][0])) { - // number of bytes in a row - $rowlen = ($columns + 1); - // convert the stream into an array of integers - $sdata = unpack('C*', $xrefcrs[1][3][0]); - // split the rows - $sdata = array_chunk($sdata, $rowlen); - // initialize decoded array - $ddata = array(); - // initialize first row with zeros - $prev_row = array_fill (0, $rowlen, 0); - // for each row apply PNG unpredictor - foreach ($sdata as $k => $row) { - // initialize new row - $ddata[$k] = array(); - // get PNG predictor value - $predictor = (10 + $row[0]); - // for each byte on the row - for ($i=1; $i<=$columns; ++$i) { - // new index - $j = ($i - 1); - $row_up = $prev_row[$j]; - if ($i == 1) { - $row_left = 0; - $row_upleft = 0; - } else { - $row_left = $row[($i - 1)]; - $row_upleft = $prev_row[($j - 1)]; - } - switch ($predictor) { - case 10: { // PNG prediction (on encoding, PNG None on all rows) - $ddata[$k][$j] = $row[$i]; - break; - } - case 11: { // PNG prediction (on encoding, PNG Sub on all rows) - $ddata[$k][$j] = (($row[$i] + $row_left) & 0xff); - break; - } - case 12: { // PNG prediction (on encoding, PNG Up on all rows) - $ddata[$k][$j] = (($row[$i] + $row_up) & 0xff); - break; - } - case 13: { // PNG prediction (on encoding, PNG Average on all rows) - $ddata[$k][$j] = (($row[$i] + (($row_left + $row_up) / 2)) & 0xff); - break; - } - case 14: { // PNG prediction (on encoding, PNG Paeth on all rows) - // initial estimate - $p = ($row_left + $row_up - $row_upleft); - // distances - $pa = abs($p - $row_left); - $pb = abs($p - $row_up); - $pc = abs($p - $row_upleft); - $pmin = min($pa, $pb, $pc); - // return minimum distance - switch ($pmin) { - case $pa: { - $ddata[$k][$j] = (($row[$i] + $row_left) & 0xff); - break; - } - case $pb: { - $ddata[$k][$j] = (($row[$i] + $row_up) & 0xff); - break; - } - case $pc: { - $ddata[$k][$j] = (($row[$i] + $row_upleft) & 0xff); - break; - } - } - break; - } - default: { // PNG prediction (on encoding, PNG optimum) - $this->Error('Unknown PNG predictor'); - break; - } - } - } - $prev_row = $ddata[$k]; - } // end for each row - // complete decoding - $sdata = array(); - // for every row - foreach ($ddata as $k => $row) { - // initialize new row - $sdata[$k] = array(0, 0, 0); - if ($wb[0] == 0) { - // default type field - $sdata[$k][0] = 1; - } - $i = 0; // count bytes in the row - // for every column - for ($c = 0; $c < 3; ++$c) { - // for every byte on the column - for ($b = 0; $b < $wb[$c]; ++$b) { - if (isset($row[$i])) { - $sdata[$k][$c] += ($row[$i] << (($wb[$c] - 1 - $b) * 8)); - } - ++$i; - } - } - } - $ddata = array(); - // fill xref - if (isset($index_first)) { - $obj_num = $index_first; - } else { - $obj_num = 0; - } - foreach ($sdata as $k => $row) { - switch ($row[0]) { - case 0: { // (f) linked list of free objects - break; - } - case 1: { // (n) objects that are in use but are not compressed - // create unique object index: [object number]_[generation number] - $index = $obj_num.'_'.$row[2]; - // check if object already exist - if (!isset($xref['xref'][$index])) { - // store object offset position - $xref['xref'][$index] = $row[1]; - } - break; - } - case 2: { // compressed objects - // $row[1] = object number of the object stream in which this object is stored - // $row[2] = index of this object within the object stream - $index = $row[1].'_0_'.$row[2]; - $xref['xref'][$index] = -1; - break; - } - default: { // null objects - break; - } - } - ++$obj_num; - } - } // end decoding data - if (isset($prevxref)) { - // get previous xref - $xref = $this->getXrefData($prevxref, $xref); - } - return $xref; - } - - /** - * Get object type, raw value and offset to next object - * @param int $offset Object offset. - * @return array containing object type, raw value and offset to next object - * @protected - * @since 1.0.000 (2011-06-20) - */ - protected function getRawObject($offset=0) { - $objtype = ''; // object type to be returned - $objval = ''; // object value to be returned - // skip initial white space chars: \x00 null (NUL), \x09 horizontal tab (HT), \x0A line feed (LF), \x0C form feed (FF), \x0D carriage return (CR), \x20 space (SP) - $offset += strspn($this->pdfdata, "\x00\x09\x0a\x0c\x0d\x20", $offset); - // get first char - $char = $this->pdfdata[$offset]; - // get object type - switch ($char) { - case '%': { // \x25 PERCENT SIGN - // skip comment and search for next token - $next = strcspn($this->pdfdata, "\r\n", $offset); - if ($next > 0) { - $offset += $next; - return $this->getRawObject($offset); - } - break; - } - case '/': { // \x2F SOLIDUS - // name object - $objtype = $char; - ++$offset; - if (preg_match('/^([^\x00\x09\x0a\x0c\x0d\x20\s\x28\x29\x3c\x3e\x5b\x5d\x7b\x7d\x2f\x25]+)/', substr($this->pdfdata, $offset, 256), $matches) == 1) { - $objval = $matches[1]; // unescaped value - $offset += strlen($objval); - } - break; - } - case '(': // \x28 LEFT PARENTHESIS - case ')': { // \x29 RIGHT PARENTHESIS - // literal string object - $objtype = $char; - ++$offset; - $strpos = $offset; - if ($char == '(') { - $open_bracket = 1; - while ($open_bracket > 0) { - if (!isset($this->pdfdata[$strpos])) { - break; - } - $ch = $this->pdfdata[$strpos]; - switch ($ch) { - case '\\': { // REVERSE SOLIDUS (5Ch) (Backslash) - // skip next character - ++$strpos; - break; - } - case '(': { // LEFT PARENHESIS (28h) - ++$open_bracket; - break; - } - case ')': { // RIGHT PARENTHESIS (29h) - --$open_bracket; - break; - } - } - ++$strpos; - } - $objval = substr($this->pdfdata, $offset, ($strpos - $offset - 1)); - $offset = $strpos; - } - break; - } - case '[': // \x5B LEFT SQUARE BRACKET - case ']': { // \x5D RIGHT SQUARE BRACKET - // array object - $objtype = $char; - ++$offset; - if ($char == '[') { - // get array content - $objval = array(); - do { - // get element - $element = $this->getRawObject($offset); - $offset = $element[2]; - $objval[] = $element; - } while ($element[0] != ']'); - // remove closing delimiter - array_pop($objval); - } - break; - } - case '<': // \x3C LESS-THAN SIGN - case '>': { // \x3E GREATER-THAN SIGN - if (isset($this->pdfdata[($offset + 1)]) AND ($this->pdfdata[($offset + 1)] == $char)) { - // dictionary object - $objtype = $char.$char; - $offset += 2; - if ($char == '<') { - // get array content - $objval = array(); - do { - // get element - $element = $this->getRawObject($offset); - $offset = $element[2]; - $objval[] = $element; - } while ($element[0] != '>>'); - // remove closing delimiter - array_pop($objval); - } - } else { - // hexadecimal string object - $objtype = $char; - ++$offset; - if (($char == '<') AND (preg_match('/^([0-9A-Fa-f\x09\x0a\x0c\x0d\x20]+)>/iU', substr($this->pdfdata, $offset), $matches) == 1)) { - // remove white space characters - $objval = strtr($matches[1], "\x09\x0a\x0c\x0d\x20", ''); - $offset += strlen($matches[0]); - } elseif (($endpos = strpos($this->pdfdata, '>', $offset)) !== FALSE) { - $offset = $endpos + 1; - } - } - break; - } - default: { - if (substr($this->pdfdata, $offset, 6) == 'endobj') { - // indirect object - $objtype = 'endobj'; - $offset += 6; - } elseif (substr($this->pdfdata, $offset, 4) == 'null') { - // null object - $objtype = 'null'; - $offset += 4; - $objval = 'null'; - } elseif (substr($this->pdfdata, $offset, 4) == 'true') { - // boolean true object - $objtype = 'boolean'; - $offset += 4; - $objval = 'true'; - } elseif (substr($this->pdfdata, $offset, 5) == 'false') { - // boolean false object - $objtype = 'boolean'; - $offset += 5; - $objval = 'false'; - } elseif (substr($this->pdfdata, $offset, 6) == 'stream') { - // start stream object - $objtype = 'stream'; - $offset += 6; - if (preg_match('/^([\r]?[\n])/isU', substr($this->pdfdata, $offset), $matches) == 1) { - $offset += strlen($matches[0]); - if (preg_match('/(endstream)[\x09\x0a\x0c\x0d\x20]/isU', substr($this->pdfdata, $offset), $matches, PREG_OFFSET_CAPTURE) == 1) { - $objval = substr($this->pdfdata, $offset, $matches[0][1]); - $offset += $matches[1][1]; - } - } - } elseif (substr($this->pdfdata, $offset, 9) == 'endstream') { - // end stream object - $objtype = 'endstream'; - $offset += 9; - } elseif (preg_match('/^([0-9]+)[\s]+([0-9]+)[\s]+R/iU', substr($this->pdfdata, $offset, 33), $matches) == 1) { - // indirect object reference - $objtype = 'objref'; - $offset += strlen($matches[0]); - $objval = intval($matches[1]).'_'.intval($matches[2]); - } elseif (preg_match('/^([0-9]+)[\s]+([0-9]+)[\s]+obj/iU', substr($this->pdfdata, $offset, 33), $matches) == 1) { - // object start - $objtype = 'obj'; - $objval = intval($matches[1]).'_'.intval($matches[2]); - $offset += strlen ($matches[0]); - } elseif (($numlen = strspn($this->pdfdata, '+-.0123456789', $offset)) > 0) { - // numeric object - $objtype = 'numeric'; - $objval = substr($this->pdfdata, $offset, $numlen); - $offset += $numlen; - } - break; - } - } - return array($objtype, $objval, $offset); - } - - /** - * Get content of indirect object. - * @param string $obj_ref Object number and generation number separated by underscore character. - * @param int $offset Object offset. - * @param boolean $decoding If true decode streams. - * @return array containing object data. - * @protected - * @since 1.0.000 (2011-05-24) - */ - protected function getIndirectObject($obj_ref, $offset=0, $decoding=true) { - $obj = explode('_', $obj_ref); - if (($obj === false) OR (count($obj) != 2)) { - $this->Error('Invalid object reference: '.$obj); - return; - } - $objref = $obj[0].' '.$obj[1].' obj'; - // ignore leading zeros - $offset += strspn($this->pdfdata, '0', $offset); - if (strpos($this->pdfdata, $objref, $offset) != $offset) { - // an indirect reference to an undefined object shall be considered a reference to the null object - return array('null', 'null', $offset); - } - // starting position of object content - $offset += strlen($objref); - // get array of object content - $objdata = array(); - $i = 0; // object main index - do { - $oldoffset = $offset; - // get element - $element = $this->getRawObject($offset); - $offset = $element[2]; - // decode stream using stream's dictionary information - if ($decoding AND ($element[0] == 'stream') AND (isset($objdata[($i - 1)][0])) AND ($objdata[($i - 1)][0] == '<<')) { - $element[3] = $this->decodeStream($objdata[($i - 1)][1], $element[1]); - } - $objdata[$i] = $element; - ++$i; - } while (($element[0] != 'endobj') AND ($offset != $oldoffset)); - // remove closing delimiter - array_pop($objdata); - // return raw object content - return $objdata; - } - - /** - * Get the content of object, resolving indect object reference if necessary. - * @param string $obj Object value. - * @return array containing object data. - * @protected - * @since 1.0.000 (2011-06-26) - */ - protected function getObjectVal($obj) { - if ($obj[0] == 'objref') { - // reference to indirect object - if (isset($this->objects[$obj[1]])) { - // this object has been already parsed - return $this->objects[$obj[1]]; - } elseif (isset($this->xref[$obj[1]])) { - // parse new object - $this->objects[$obj[1]] = $this->getIndirectObject($obj[1], $this->xref[$obj[1]], false); - return $this->objects[$obj[1]]; - } - } - return $obj; - } - - /** - * Decode the specified stream. - * @param array $sdic Stream's dictionary array. - * @param string $stream Stream to decode. - * @return array containing decoded stream data and remaining filters. - * @protected - * @since 1.0.000 (2011-06-22) - */ - protected function decodeStream($sdic, $stream) { - // get stream length and filters - $slength = strlen($stream); - if ($slength <= 0) { - return array('', array()); - } - $filters = array(); - foreach ($sdic as $k => $v) { - if ($v[0] == '/') { - if (($v[1] == 'Length') AND (isset($sdic[($k + 1)])) AND ($sdic[($k + 1)][0] == 'numeric')) { - // get declared stream length - $declength = intval($sdic[($k + 1)][1]); - if ($declength < $slength) { - $stream = substr($stream, 0, $declength); - $slength = $declength; - } - } elseif (($v[1] == 'Filter') AND (isset($sdic[($k + 1)]))) { - // resolve indirect object - $objval = $this->getObjectVal($sdic[($k + 1)]); - if ($objval[0] == '/') { - // single filter - $filters[] = $objval[1]; - } elseif ($objval[0] == '[') { - // array of filters - foreach ($objval[1] as $flt) { - if ($flt[0] == '/') { - $filters[] = $flt[1]; - } - } - } - } - } - } - // decode the stream - $remaining_filters = array(); - foreach ($filters as $filter) { - if (in_array($filter, TCPDF_FILTERS::getAvailableFilters())) { - try { - $stream = TCPDF_FILTERS::decodeFilter($filter, $stream); - } catch (Exception $e) { - $emsg = $e->getMessage(); - if ((($emsg[0] == '~') AND !$this->cfg['ignore_missing_filter_decoders']) - OR (($emsg[0] != '~') AND !$this->cfg['ignore_filter_decoding_errors'])) { - $this->Error($e->getMessage()); - } - } - } else { - // add missing filter to array - $remaining_filters[] = $filter; - } - } - return array($stream, $remaining_filters); - } - - /** - * Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true. - * @param string $msg The error message - * @public - * @since 1.0.000 (2011-05-23) - */ - public function Error($msg) { - if ($this->cfg['die_for_errors']) { - die('TCPDF_PARSER ERROR: '.$msg); - } else { - throw new Exception('TCPDF_PARSER ERROR: '.$msg); - } - } - -} // END OF TCPDF_PARSER CLASS - -//============================================================+ -// END OF FILE -//============================================================+ diff --git a/vendor/textalk/websocket/.github/ISSUE_TEMPLATE/bug_report.md b/vendor/textalk/websocket/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index d402046..0000000 --- a/vendor/textalk/websocket/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Bug report -about: Use this if you believe there is a bug in this repo -title: '' -labels: bug -assignees: '' - ---- - -**Describe the bug** -Please provide a clear and concise description of the suspected issue. - -**How to reproduce** -If possible, provide information - possibly including code snippets - on how to reproduce the issue. - -**Logs** -If possible, provide logs that indicate the issue. See https://github.com/Textalk/websocket-php/blob/master/docs/Examples.md#echo-logger on how to use the EchoLog. - -**Versions** -* Version of this library -* PHP version diff --git a/vendor/textalk/websocket/.github/ISSUE_TEMPLATE/feature_request.md b/vendor/textalk/websocket/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index ce777f6..0000000 --- a/vendor/textalk/websocket/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this library -title: '' -labels: feature request -assignees: '' - ---- - -**Is it within the scope of this library?** -Consider and describe why the feature would be beneficial in this library, and not implemented as a separate project using this as a dependency. - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. diff --git a/vendor/textalk/websocket/.github/ISSUE_TEMPLATE/other-issue.md b/vendor/textalk/websocket/.github/ISSUE_TEMPLATE/other-issue.md deleted file mode 100644 index fe5cc8d..0000000 --- a/vendor/textalk/websocket/.github/ISSUE_TEMPLATE/other-issue.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Other issue -about: Use this for other issues -title: '' -labels: '' -assignees: '' - ---- - -**Describe your issue** diff --git a/vendor/textalk/websocket/.github/workflows/acceptance.yml b/vendor/textalk/websocket/.github/workflows/acceptance.yml deleted file mode 100644 index 06c1766..0000000 --- a/vendor/textalk/websocket/.github/workflows/acceptance.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: Acceptance - -on: [push, pull_request] - -jobs: - test-7-2: - runs-on: ubuntu-latest - name: Test PHP 7.2 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up PHP 7.2 - uses: shivammathur/setup-php@v2 - with: - php-version: '7.2' - - name: Composer - run: make install - - name: Test - run: make test - - test-7-3: - runs-on: ubuntu-latest - name: Test PHP 7.3 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up PHP 7.3 - uses: shivammathur/setup-php@v2 - with: - php-version: '7.3' - - name: Composer - run: make install - - name: Test - run: make test - - test-7-4: - runs-on: ubuntu-latest - name: Test PHP 7.4 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up PHP 7.4 - uses: shivammathur/setup-php@v2 - with: - php-version: '7.4' - - name: Composer - run: make install - - name: Test - run: make test - - test-8-0: - runs-on: ubuntu-latest - name: Test PHP 8.0 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up PHP 8.0 - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' - - name: Composer - run: make install - - name: Test - run: make test - - test-8-1: - runs-on: ubuntu-latest - name: Test PHP 8.1 - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up PHP 8.1 - uses: shivammathur/setup-php@v2 - with: - php-version: '8.1' - - name: Composer - run: make install - - name: Test - run: make test - - - cs-check: - runs-on: ubuntu-latest - name: Code standard - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up PHP 8.0 - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' - - name: Composer - run: make install - - name: Code standard - run: make cs-check - - coverage: - runs-on: ubuntu-latest - name: Code coverage - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up PHP 8.0 - uses: shivammathur/setup-php@v2 - with: - php-version: '8.0' - extensions: xdebug - - name: Composer - run: make install - - name: Code coverage - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: make coverage diff --git a/vendor/textalk/websocket/.gitignore b/vendor/textalk/websocket/.gitignore deleted file mode 100644 index 379ab4b..0000000 --- a/vendor/textalk/websocket/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.DS_Store -.phpunit.result.cache -build/ -composer.lock -composer.phar -vendor/ \ No newline at end of file diff --git a/vendor/textalk/websocket/Makefile b/vendor/textalk/websocket/Makefile deleted file mode 100644 index 930a9ed..0000000 --- a/vendor/textalk/websocket/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -install: composer.phar - ./composer.phar install - -update: composer.phar - ./composer.phar self-update - ./composer.phar update - -test: composer.lock - ./vendor/bin/phpunit - -cs-check: composer.lock - ./vendor/bin/phpcs --standard=codestandard.xml lib tests examples - -coverage: composer.lock build - XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml - ./vendor/bin/php-coveralls -v - -composer.phar: - curl -s http://getcomposer.org/installer | php - -composer.lock: composer.phar - ./composer.phar --no-interaction install - -vendor/bin/phpunit: install - -build: - mkdir build - -clean: - rm composer.phar - rm -r vendor - rm -r build diff --git a/vendor/textalk/websocket/README.md b/vendor/textalk/websocket/README.md deleted file mode 100644 index 70c16cc..0000000 --- a/vendor/textalk/websocket/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# Websocket Client and Server for PHP - -[![Build Status](https://github.com/Textalk/websocket-php/actions/workflows/acceptance.yml/badge.svg)](https://github.com/Textalk/websocket-php/actions) -[![Coverage Status](https://coveralls.io/repos/github/Textalk/websocket-php/badge.svg?branch=master)](https://coveralls.io/github/Textalk/websocket-php) - -This library contains WebSocket client and server for PHP. - -The client and server provides methods for reading and writing to WebSocket streams. -It does not include convenience operations such as listeners and implicit error handling. - -## Documentation - -- [Client](docs/Client.md) -- [Server](docs/Server.md) -- [Message](docs/Message.md) -- [Examples](docs/Examples.md) -- [Changelog](docs/Changelog.md) -- [Contributing](docs/Contributing.md) - -## Installing - -Preferred way to install is with [Composer](https://getcomposer.org/). -``` -composer require textalk/websocket -``` - -* Current version support PHP versions `^7.2|^8.0`. -* For PHP `7.1` support use version [`1.4`](https://github.com/Textalk/websocket-php/tree/1.4.0). -* For PHP `^5.4` and `7.0` support use version [`1.3`](https://github.com/Textalk/websocket-php/tree/1.3.0). - -## Client - -The [client](docs/Client.md) can read and write on a WebSocket stream. -It internally supports Upgrade handshake and implicit close and ping/pong operations. - -```php -$client = new WebSocket\Client("ws://echo.websocket.org/"); -$client->text("Hello WebSocket.org!"); -echo $client->receive(); -$client->close(); -``` - -## Server - -The library contains a rudimentary single stream/single thread [server](docs/Server.md). -It internally supports Upgrade handshake and implicit close and ping/pong operations. - -Note that it does **not** support threading or automatic association ot continuous client requests. -If you require this kind of server behavior, you need to build it on top of provided server implementation. - -```php -$server = new WebSocket\Server(); -$server->accept(); -$message = $server->receive(); -$server->text($message); -$server->close(); -``` - -### License and Contributors - -[ISC License](COPYING.md) - -Fredrik Liljegren, Armen Baghumian Sankbarani, Ruslan Bekenev, -Joshua Thijssen, Simon Lipp, Quentin Bellus, Patrick McCarren, swmcdonnell, -Ignas Bernotas, Mark Herhold, Andreas Palm, Sören Jensen, pmaasz, Alexey Stavrov, -Michael Slezak, Pierre Seznec, rmeisler, Nickolay V. Shmyrev, Christoph Kempen, -Marc Roberts, Antonio Mora, Simon Podlipsky. diff --git a/vendor/textalk/websocket/codestandard.xml b/vendor/textalk/websocket/codestandard.xml deleted file mode 100644 index bb1cd26..0000000 --- a/vendor/textalk/websocket/codestandard.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/vendor/textalk/websocket/composer.json b/vendor/textalk/websocket/composer.json deleted file mode 100644 index 9bc0dcc..0000000 --- a/vendor/textalk/websocket/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "textalk/websocket", - "description": "WebSocket client and server", - "license": "ISC", - "type": "library", - "authors": [ - { - "name": "Fredrik Liljegren" - }, - { - "name": "Sören Jensen", - "email": "soren@abicart.se" - } - ], - "autoload": { - "psr-4": { - "WebSocket\\": "lib" - } - }, - "autoload-dev": { - "psr-4": { - "WebSocket\\": "tests/mock" - } - }, - "require": { - "php": "^7.2 | ^8.0", - "psr/log": "^1 | ^2 | ^3" - }, - "require-dev": { - "phpunit/phpunit": "^8.0|^9.0", - "php-coveralls/php-coveralls": "^2.0", - "squizlabs/php_codesniffer": "^3.5" - } -} diff --git a/vendor/textalk/websocket/docs/Changelog.md b/vendor/textalk/websocket/docs/Changelog.md deleted file mode 100644 index 4d98063..0000000 --- a/vendor/textalk/websocket/docs/Changelog.md +++ /dev/null @@ -1,143 +0,0 @@ -[Client](Client.md) • [Server](Server.md) • [Message](Message.md) • [Examples](Examples.md) • Changelog • [Contributing](Contributing.md) - -# Websocket: Changelog - -## `v1.5` - - > PHP version `^7.2|^8.0` - -### `1.5.8` - - * Handle read error during handshake (@sirn-se) - -### `1.5.7` - - * Large header block fix (@sirn-se) - -### `1.5.6` - - * Add test for PHP 8.1 (@sirn-se) - * Code standard (@sirn-se) - -### `1.5.5` - - * Support for psr/log v2 and v3 (@simPod) - * GitHub Actions replaces Travis (@sirn-se) - -### `1.5.4` - - * Keep open connection on read timeout (@marcroberts) - -### `1.5.3` - - * Fix for persistent connection (@sirn-se) - -### `1.5.2` - - * Fix for getName() method (@sirn-se) - -### `1.5.1` - - * Fix for persistent connections (@rmeisler) - -### `1.5.0` - - * Convenience send methods; text(), binary(), ping(), pong() (@sirn-se) - * Optional Message instance as receive() method return (@sirn-se) - * Opcode filter for receive() method (@sirn-se) - * Added PHP `8.0` support (@webpatser) - * Dropped PHP `7.1` support (@sirn-se) - * Fix for unordered fragmented messages (@sirn-se) - * Improved error handling on stream calls (@sirn-se) - * Various code re-write (@sirn-se) - -## `v1.4` - - > PHP version `^7.1` - -#### `1.4.3` - - * Solve stream closure/get meta conflict (@sirn-se) - * Examples and documentation overhaul (@sirn-se) - -#### `1.4.2` - - * Force stream close on read error (@sirn-se) - * Authorization headers line feed (@sirn-se) - * Documentation (@matias-pool, @sirn-se) - -#### `1.4.1` - - * Ping/Pong, handled internally to avoid breaking fragmented messages (@nshmyrev, @sirn-se) - * Fix for persistent connections (@rmeisler) - * Fix opcode bitmask (@peterjah) - -#### `1.4.0` - - * Dropped support of old PHP versions (@sirn-se) - * Added PSR-3 Logging support (@sirn-se) - * Persistent connection option (@slezakattack) - * TimeoutException on connection time out (@slezakattack) - -## `v1.3` - - > PHP version `^5.4` and `^7.0` - -#### `1.3.1` - - * Allow control messages without payload (@Logioniz) - * Error code in ConnectionException (@sirn-se) - -#### `1.3.0` - - * Implements ping/pong frames (@pmccarren @Logioniz) - * Close behaviour (@sirn-se) - * Various fixes concerning connection handling (@sirn-se) - * Overhaul of Composer, Travis and Coveralls setup, PSR code standard and unit tests (@sirn-se) - -## `v1.2` - - > PHP version `^5.4` and `^7.0` - -#### `1.2.0` - - * Adding stream context options (to set e.g. SSL `allow_self_signed`). - -## `v1.1` - - > PHP version `^5.4` and `^7.0` - -#### `1.1.2` - - * Fixed error message on broken frame. - -#### `1.1.1` - - * Adding license information. - -#### `1.1.0` - - * Supporting huge payloads. - -## `v1.0` - - > PHP version `^5.4` and `^7.0` - -#### `1.0.3` - - * Bugfix: Correcting address in error-message - -#### `1.0.2` - - * Bugfix: Add port in request-header. - -#### `1.0.1` - - * Fixing a bug from empty payloads. - -#### `1.0.0` - - * Release as production ready. - * Adding option to set/override headers. - * Supporting basic authentication from user:pass in URL. - diff --git a/vendor/textalk/websocket/docs/Client.md b/vendor/textalk/websocket/docs/Client.md deleted file mode 100644 index e6154b6..0000000 --- a/vendor/textalk/websocket/docs/Client.md +++ /dev/null @@ -1,137 +0,0 @@ -Client • [Server](Server.md) • [Message](Message.md) • [Examples](Examples.md) • [Changelog](Changelog.md) • [Contributing](Contributing.md) - -# Websocket: Client - -The client can read and write on a WebSocket stream. -It internally supports Upgrade handshake and implicit close and ping/pong operations. - -## Class synopsis - -```php -WebSocket\Client { - - public __construct(string $uri, array $options = []) - public __destruct() - public __toString() : string - - public text(string $payload) : void - public binary(string $payload) : void - public ping(string $payload = '') : void - public pong(string $payload = '') : void - public send(mixed $payload, string $opcode = 'text', bool $masked = true) : void - public receive() : mixed - public close(int $status = 1000, mixed $message = 'ttfn') : mixed - - public getName() : string|null - public getPier() : string|null - public getLastOpcode() : string - public getCloseStatus() : int - public isConnected() : bool - public setTimeout(int $seconds) : void - public setFragmentSize(int $fragment_size) : self - public getFragmentSize() : int - public setLogger(Psr\Log\LoggerInterface $logger = null) : void -} -``` - -## Examples - -### Simple send-receive operation - -This example send a single message to a server, and output the response. - -```php -$client = new WebSocket\Client("ws://echo.websocket.org/"); -$client->text("Hello WebSocket.org!"); -echo $client->receive(); -$client->close(); -``` - -### Listening to a server - -To continuously listen to incoming messages, you need to put the receive operation within a loop. -Note that these functions **always** throw exception on any failure, including recoverable failures such as connection time out. -By consuming exceptions, the code will re-connect the socket in next loop iteration. - -```php -$client = new WebSocket\Client("ws://echo.websocket.org/"); -while (true) { - try { - $message = $client->receive(); - // Act on received message - // Break while loop to stop listening - } catch (\WebSocket\ConnectionException $e) { - // Possibly log errors - } -} -$client->close(); -``` - -### Filtering received messages - -By default the `receive()` method return messages of 'text' and 'binary' opcode. -The filter option allows you to specify which message types to return. - -```php -$client = new WebSocket\Client("ws://echo.websocket.org/", ['filter' => ['text']]); -$client->receive(); // Only return 'text' messages - -$client = new WebSocket\Client("ws://echo.websocket.org/", ['filter' => ['text', 'binary', 'ping', 'pong', 'close']]); -$client->receive(); // Return all messages -``` - -### Sending messages - -There are convenience methods to send messages with different opcodes. -```php -$client = new WebSocket\Client("ws://echo.websocket.org/"); - -// Convenience methods -$client->text('A plain text message'); // Send an opcode=text message -$client->binary($binary_string); // Send an opcode=binary message -$client->ping(); // Send an opcode=ping frame -$client->pong(); // Send an unsolicited opcode=pong frame - -// Generic send method -$client->send($payload); // Sent as masked opcode=text -$client->send($payload, 'binary'); // Sent as masked opcode=binary -$client->send($payload, 'binary', false); // Sent as unmasked opcode=binary -``` - -## Constructor options - -The `$options` parameter in constructor accepts an associative array of options. - -* `context` - A stream context created using [stream_context_create](https://www.php.net/manual/en/function.stream-context-create). -* `filter` - Array of opcodes to return on receive, default `['text', 'binary']` -* `fragment_size` - Maximum payload size. Default 4096 chars. -* `headers` - Additional headers as associative array name => content. -* `logger` - A [PSR-3](https://www.php-fig.org/psr/psr-3/) compatible logger. -* `persistent` - Connection is re-used between requests until time out is reached. Default false. -* `return_obj` - Return a [Message](Message.md) instance on receive, default false -* `timeout` - Time out in seconds. Default 5 seconds. - -```php -$context = stream_context_create(); -stream_context_set_option($context, 'ssl', 'verify_peer', false); -stream_context_set_option($context, 'ssl', 'verify_peer_name', false); - -$client = new WebSocket\Client("ws://echo.websocket.org/", [ - 'context' => $context, // Attach stream context created above - 'filter' => ['text', 'binary', 'ping'], // Specify message types for receive() to return - 'headers' => [ // Additional headers, used to specify subprotocol - 'Sec-WebSocket-Protocol' => 'soap', - 'origin' => 'localhost', - ], - 'logger' => $my_psr3_logger, // Attach a PSR3 compatible logger - 'return_obj' => true, // Return Message instance rather than just text - 'timeout' => 60, // 1 minute time out -]); -``` - -## Exceptions - -* `WebSocket\BadOpcodeException` - Thrown if provided opcode is invalid. -* `WebSocket\BadUriException` - Thrown if provided URI is invalid. -* `WebSocket\ConnectionException` - Thrown on any socket I/O failure. -* `WebSocket\TimeoutException` - Thrown when the socket experiences a time out. diff --git a/vendor/textalk/websocket/docs/Contributing.md b/vendor/textalk/websocket/docs/Contributing.md deleted file mode 100644 index 263d868..0000000 --- a/vendor/textalk/websocket/docs/Contributing.md +++ /dev/null @@ -1,44 +0,0 @@ -[Client](Client.md) • [Server](Server.md) • [Message](Message.md) • [Examples](Examples.md) • [Changelog](Changelog.md) • Contributing - -# Websocket: Contributing - -Everyone is welcome to help out! -But to keep this project sustainable, please ensure your contribution respects the requirements below. - -## PR Requirements - -Requirements on pull requests; -* All tests **MUST** pass. -* Code coverage **MUST** remain at 100%. -* Code **MUST** adhere to PSR-1 and PSR-12 code standards. - -## Dependency management - -Install or update dependencies using [Composer](https://getcomposer.org/). - -``` -# Install dependencies -make install - -# Update dependencies -make update -``` - -## Code standard - -This project uses [PSR-1](https://www.php-fig.org/psr/psr-1/) and [PSR-12](https://www.php-fig.org/psr/psr-12/) code standards. -``` -# Check code standard adherence -make cs-check -``` - -## Unit testing - -Unit tests with [PHPUnit](https://phpunit.readthedocs.io/), coverage with [Coveralls](https://github.com/php-coveralls/php-coveralls) -``` -# Run unit tests -make test - -# Create coverage -make coverage -``` diff --git a/vendor/textalk/websocket/docs/Examples.md b/vendor/textalk/websocket/docs/Examples.md deleted file mode 100644 index 7dd4e0c..0000000 --- a/vendor/textalk/websocket/docs/Examples.md +++ /dev/null @@ -1,98 +0,0 @@ -[Client](Client.md) • [Server](Server.md) • [Message](Message.md) • Examples • [Changelog](Changelog.md) • [Contributing](Contributing.md) - -# Websocket: Examples - -Here are some examples on how to use the WebSocket library. - -## Echo logger - -In dev environment (as in having run composer to include dev dependencies) you have -access to a simple echo logger that print out information synchronously. - -This is usable for debugging. For production, use a proper logger. - -```php -namespace WebSocket; - -$logger = new EchoLogger(); - -$client = new Client('ws://echo.websocket.org/'); -$client->setLogger($logger); - -$server = new Server(); -$server->setLogger($logger); -``` - -An example of server output; -``` -info | Server listening to port 8000 [] -debug | Wrote 129 of 129 bytes. [] -info | Server connected to port 8000 [] -info | Received 'text' message [] -debug | Wrote 9 of 9 bytes. [] -info | Sent 'text' message [] -debug | Received 'close', status: 1000. [] -debug | Wrote 32 of 32 bytes. [] -info | Sent 'close' message [] -info | Received 'close' message [] -``` - -## The `send` client - -Source: [examples/send.php](../examples/send.php) - -A simple, single send/receive client. - -Example use: -``` -php examples/send.php --opcode text "A text message" // Send a text message to localhost -php examples/send.php --opcode ping "ping it" // Send a ping message to localhost -php examples/send.php --uri ws://echo.websocket.org "A text message" // Send a text message to echo.websocket.org -php examples/send.php --opcode text --debug "A text message" // Use runtime debugging -``` - -## The `echoserver` server - -Source: [examples/echoserver.php](../examples/echoserver.php) - -A simple server that responds to recevied commands. - -Example use: -``` -php examples/echoserver.php // Run with default settings -php examples/echoserver.php --port 8080 // Listen on port 8080 -php examples/echoserver.php --debug // Use runtime debugging -``` - -These strings can be sent as message to trigger server to perform actions; -* `exit` - Server will initiate close procedure -* `ping` - Server will send a ping message -* `headers` - Server will respond with all headers provided by client -* `auth` - Server will respond with auth header if provided by client -* For other sent strings, server will respond with the same strings - -## The `random` client - -Source: [examples/random_client.php](../examples/random_client.php) - -The random client will use random options and continuously send/receive random messages. - -Example use: -``` -php examples/random_client.php --uri ws://echo.websocket.org // Connect to echo.websocket.org -php examples/random_client.php --timeout 5 --fragment_size 16 // Specify settings -php examples/random_client.php --debug // Use runtime debugging -``` - -## The `random` server - -Source: [examples/random_server.php](../examples/random_server.php) - -The random server will use random options and continuously send/receive random messages. - -Example use: -``` -php examples/random_server.php --port 8080 // // Listen on port 8080 -php examples/random_server.php --timeout 5 --fragment_size 16 // Specify settings -php examples/random_server.php --debug // Use runtime debugging -``` diff --git a/vendor/textalk/websocket/docs/Message.md b/vendor/textalk/websocket/docs/Message.md deleted file mode 100644 index 9bd0f2b..0000000 --- a/vendor/textalk/websocket/docs/Message.md +++ /dev/null @@ -1,60 +0,0 @@ -[Client](Client.md) • [Server](Server.md) • Message • [Examples](Examples.md) • [Changelog](Changelog.md) • [Contributing](Contributing.md) - -# Websocket: Messages - -If option `return_obj` is set to `true` on [client](Client.md) or [server](Server.md), -the `receive()` method will return a Message instance instead of a string. - -Available classes correspond to opcode; -* WebSocket\Message\Text -* WebSocket\Message\Binary -* WebSocket\Message\Ping -* WebSocket\Message\Pong -* WebSocket\Message\Close - -Additionally; -* WebSocket\Message\Message - abstract base class for all messages above -* WebSocket\Message\Factory - Factory class to create Msssage instances - -## Message abstract class synopsis - -```php -WebSocket\Message\Message { - - public __construct(string $payload = '') - public __toString() : string - - public getOpcode() : string - public getLength() : int - public getTimestamp() : DateTime - public getContent() : string - public setContent(string $payload = '') : void - public hasContent() : bool -} -``` - -## Factory class synopsis - -```php -WebSocket\Message\Factory { - - public create(string $opcode, string $payload = '') : Message -} -``` - -## Example - -Receving a Message and echo some methods. - -```php -$client = new WebSocket\Client('ws://echo.websocket.org/', ['return_obj' => true]); -$client->text('Hello WebSocket.org!'); -// Echo return same message as sent -$message = $client->receive(); -echo $message->getOpcode(); // -> "text" -echo $message->getLength(); // -> 20 -echo $message->getContent(); // -> "Hello WebSocket.org!" -echo $message->hasContent(); // -> true -echo $message->getTimestamp()->format('H:i:s'); // -> 19:37:18 -$client->close(); -``` diff --git a/vendor/textalk/websocket/docs/Server.md b/vendor/textalk/websocket/docs/Server.md deleted file mode 100644 index 7d01a41..0000000 --- a/vendor/textalk/websocket/docs/Server.md +++ /dev/null @@ -1,136 +0,0 @@ -[Client](Client.md) • Server • [Message](Message.md) • [Examples](Examples.md) • [Changelog](Changelog.md) • [Contributing](Contributing.md) - -# Websocket: Server - -The library contains a rudimentary single stream/single thread server. -It internally supports Upgrade handshake and implicit close and ping/pong operations. - -Note that it does **not** support threading or automatic association ot continuous client requests. -If you require this kind of server behavior, you need to build it on top of provided server implementation. - -## Class synopsis - -```php -WebSocket\Server { - - public __construct(array $options = []) - public __destruct() - public __toString() : string - - public accept() : bool - public text(string $payload) : void - public binary(string $payload) : void - public ping(string $payload = '') : void - public pong(string $payload = '') : void - public send(mixed $payload, string $opcode = 'text', bool $masked = true) : void - public receive() : mixed - public close(int $status = 1000, mixed $message = 'ttfn') : mixed - - public getPort() : int - public getPath() : string - public getRequest() : array - public getHeader(string $header_name) : string|null - - public getName() : string|null - public getPier() : string|null - public getLastOpcode() : string - public getCloseStatus() : int - public isConnected() : bool - public setTimeout(int $seconds) : void - public setFragmentSize(int $fragment_size) : self - public getFragmentSize() : int - public setLogger(Psr\Log\LoggerInterface $logger = null) : void -} -``` - -## Examples - -### Simple receive-send operation - -This example reads a single message from a client, and respond with the same message. - -```php -$server = new WebSocket\Server(); -$server->accept(); -$message = $server->receive(); -$server->text($message); -$server->close(); -``` - -### Listening to clients - -To continuously listen to incoming messages, you need to put the receive operation within a loop. -Note that these functions **always** throw exception on any failure, including recoverable failures such as connection time out. -By consuming exceptions, the code will re-connect the socket in next loop iteration. - -```php -$server = new WebSocket\Server(); -while ($server->accept()) { - try { - $message = $server->receive(); - // Act on received message - // Break while loop to stop listening - } catch (\WebSocket\ConnectionException $e) { - // Possibly log errors - } -} -$server->close(); -``` - -### Filtering received messages - -By default the `receive()` method return messages of 'text' and 'binary' opcode. -The filter option allows you to specify which message types to return. - -```php -$server = new WebSocket\Server(['filter' => ['text']]); -$server->receive(); // only return 'text' messages - -$server = new WebSocket\Server(['filter' => ['text', 'binary', 'ping', 'pong', 'close']]); -$server->receive(); // return all messages -``` - -### Sending messages - -There are convenience methods to send messages with different opcodes. -```php -$server = new WebSocket\Server(); - -// Convenience methods -$server->text('A plain text message'); // Send an opcode=text message -$server->binary($binary_string); // Send an opcode=binary message -$server->ping(); // Send an opcode=ping frame -$server->pong(); // Send an unsolicited opcode=pong frame - -// Generic send method -$server->send($payload); // Sent as masked opcode=text -$server->send($payload, 'binary'); // Sent as masked opcode=binary -$server->send($payload, 'binary', false); // Sent as unmasked opcode=binary -``` - -## Constructor options - -The `$options` parameter in constructor accepts an associative array of options. - -* `filter` - Array of opcodes to return on receive, default `['text', 'binary']` -* `fragment_size` - Maximum payload size. Default 4096 chars. -* `logger` - A [PSR-3](https://www.php-fig.org/psr/psr-3/) compatible logger. -* `port` - The server port to listen to. Default 8000. -* `return_obj` - Return a [Message](Message.md) instance on receive, default false -* `timeout` - Time out in seconds. Default 5 seconds. - -```php -$server = new WebSocket\Server([ - 'filter' => ['text', 'binary', 'ping'], // Specify message types for receive() to return - 'logger' => $my_psr3_logger, // Attach a PSR3 compatible logger - 'port' => 9000, // Listening port - 'return_obj' => true, // Return Message insatnce rather than just text - 'timeout' => 60, // 1 minute time out -]); -``` - -## Exceptions - -* `WebSocket\BadOpcodeException` - Thrown if provided opcode is invalid. -* `WebSocket\ConnectionException` - Thrown on any socket I/O failure. -* `WebSocket\TimeoutException` - Thrown when the socket experiences a time out. diff --git a/vendor/textalk/websocket/examples/echoserver.php b/vendor/textalk/websocket/examples/echoserver.php deleted file mode 100644 index 231c4c9..0000000 --- a/vendor/textalk/websocket/examples/echoserver.php +++ /dev/null @@ -1,87 +0,0 @@ - : The port to listen to, default 8000 - * --timeout : Timeout in seconds, default 200 seconds - * --debug : Output log data (if logger is available) - */ - -namespace WebSocket; - -require __DIR__ . '/../vendor/autoload.php'; - -error_reporting(-1); - -echo "> Random server\n"; - -// Server options specified or random -$options = array_merge([ - 'port' => 8000, - 'timeout' => 200, - 'filter' => ['text', 'binary', 'ping', 'pong'], -], getopt('', ['port:', 'timeout:', 'debug'])); - -// If debug mode and logger is available -if (isset($options['debug']) && class_exists('WebSocket\EchoLog')) { - $logger = new EchoLog(); - $options['logger'] = $logger; - echo "> Using logger\n"; -} - -// Setting timeout to 200 seconds to make time for all tests and manual runs. -try { - $server = new Server($options); -} catch (ConnectionException $e) { - echo "> ERROR: {$e->getMessage()}\n"; - die(); -} - -echo "> Listening to port {$server->getPort()}\n"; - -// Force quit to close server -while (true) { - try { - while ($server->accept()) { - echo "> Accepted on port {$server->getPort()}\n"; - while (true) { - $message = $server->receive(); - $opcode = $server->getLastOpcode(); - if (is_null($message)) { - echo "> Closing connection\n"; - continue 2; - } - echo "> Got '{$message}' [opcode: {$opcode}]\n"; - if (in_array($opcode, ['ping', 'pong'])) { - $server->send($message); - continue; - } - // Allow certain string to trigger server action - switch ($message) { - case 'exit': - echo "> Client told me to quit. Bye bye.\n"; - $server->close(); - echo "> Close status: {$server->getCloseStatus()}\n"; - exit; - case 'headers': - $server->text(implode("\r\n", $server->getRequest())); - break; - case 'ping': - $server->ping($message); - break; - case 'auth': - $auth = $server->getHeader('Authorization'); - $server->text("{$auth} - {$message}"); - break; - default: - $server->text($message); - } - } - } - } catch (ConnectionException $e) { - echo "> ERROR: {$e->getMessage()}\n"; - } -} diff --git a/vendor/textalk/websocket/examples/random_client.php b/vendor/textalk/websocket/examples/random_client.php deleted file mode 100644 index b23bd6b..0000000 --- a/vendor/textalk/websocket/examples/random_client.php +++ /dev/null @@ -1,94 +0,0 @@ - : The URI to connect to, default ws://localhost:8000 - * --timeout : Timeout in seconds, random default - * --fragment_size : Fragment size as bytes, random default - * --debug : Output log data (if logger is available) - */ - -namespace WebSocket; - -require __DIR__ . '/../vendor/autoload.php'; - -error_reporting(-1); - -$randStr = function (int $maxlength = 4096) { - $string = ''; - $length = rand(1, $maxlength); - for ($i = 0; $i < $length; $i++) { - $string .= chr(rand(33, 126)); - } - return $string; -}; - -echo "> Random client\n"; - -// Server options specified or random -$options = array_merge([ - 'uri' => 'ws://localhost:8000', - 'timeout' => rand(1, 60), - 'fragment_size' => rand(1, 4096) * 8, -], getopt('', ['uri:', 'timeout:', 'fragment_size:', 'debug'])); - -// If debug mode and logger is available -if (isset($options['debug']) && class_exists('WebSocket\EchoLog')) { - $logger = new EchoLog(); - $options['logger'] = $logger; - echo "> Using logger\n"; -} - -// Main loop -while (true) { - try { - $client = new Client($options['uri'], $options); - $info = json_encode([ - 'uri' => $options['uri'], - 'timeout' => $options['timeout'], - 'framgemt_size' => $client->getFragmentSize(), - ]); - echo "> Creating client {$info}\n"; - - try { - while (true) { - // Random actions - switch (rand(1, 10)) { - case 1: - echo "> Sending text\n"; - $client->text("Text message {$randStr()}"); - break; - case 2: - echo "> Sending binary\n"; - $client->binary("Binary message {$randStr()}"); - break; - case 3: - echo "> Sending close\n"; - $client->close(rand(1000, 2000), "Close message {$randStr(8)}"); - break; - case 4: - echo "> Sending ping\n"; - $client->ping("Ping message {$randStr(8)}"); - break; - case 5: - echo "> Sending pong\n"; - $client->pong("Pong message {$randStr(8)}"); - break; - default: - echo "> Receiving\n"; - $received = $client->receive(); - echo "> Received {$client->getLastOpcode()}: {$received}\n"; - } - sleep(rand(1, 5)); - } - } catch (\Throwable $e) { - echo "ERROR I/O: {$e->getMessage()} [{$e->getCode()}]\n"; - } - } catch (\Throwable $e) { - echo "ERROR: {$e->getMessage()} [{$e->getCode()}]\n"; - } - sleep(rand(1, 5)); -} diff --git a/vendor/textalk/websocket/examples/random_server.php b/vendor/textalk/websocket/examples/random_server.php deleted file mode 100644 index 0b0849c..0000000 --- a/vendor/textalk/websocket/examples/random_server.php +++ /dev/null @@ -1,93 +0,0 @@ - : The port to listen to, default 8000 - * --timeout : Timeout in seconds, random default - * --fragment_size : Fragment size as bytes, random default - * --debug : Output log data (if logger is available) - */ - -namespace WebSocket; - -require __DIR__ . '/../vendor/autoload.php'; - -error_reporting(-1); - -$randStr = function (int $maxlength = 4096) { - $string = ''; - $length = rand(1, $maxlength); - for ($i = 0; $i < $length; $i++) { - $string .= chr(rand(33, 126)); - } - return $string; -}; - -echo "> Random server\n"; - -// Server options specified or random -$options = array_merge([ - 'port' => 8000, - 'timeout' => rand(1, 60), - 'fragment_size' => rand(1, 4096) * 8, -], getopt('', ['port:', 'timeout:', 'fragment_size:', 'debug'])); - -// If debug mode and logger is available -if (isset($options['debug']) && class_exists('WebSocket\EchoLog')) { - $logger = new EchoLog(); - $options['logger'] = $logger; - echo "> Using logger\n"; -} - -// Force quit to close server -while (true) { - try { - // Setup server - $server = new Server($options); - $info = json_encode([ - 'port' => $server->getPort(), - 'timeout' => $options['timeout'], - 'framgemt_size' => $server->getFragmentSize(), - ]); - echo "> Creating server {$info}\n"; - - while ($server->accept()) { - while (true) { - // Random actions - switch (rand(1, 10)) { - case 1: - echo "> Sending text\n"; - $server->text("Text message {$randStr()}"); - break; - case 2: - echo "> Sending binary\n"; - $server->binary("Binary message {$randStr()}"); - break; - case 3: - echo "> Sending close\n"; - $server->close(rand(1000, 2000), "Close message {$randStr(8)}"); - break; - case 4: - echo "> Sending ping\n"; - $server->ping("Ping message {$randStr(8)}"); - break; - case 5: - echo "> Sending pong\n"; - $server->pong("Pong message {$randStr(8)}"); - break; - default: - echo "> Receiving\n"; - $received = $server->receive(); - echo "> Received {$server->getLastOpcode()}: {$received}\n"; - } - sleep(rand(1, 5)); - } - } - } catch (\Throwable $e) { - echo "ERROR: {$e->getMessage()} [{$e->getCode()}]\n"; - } - sleep(rand(1, 5)); -} diff --git a/vendor/textalk/websocket/examples/send.php b/vendor/textalk/websocket/examples/send.php deleted file mode 100644 index 30e48e0..0000000 --- a/vendor/textalk/websocket/examples/send.php +++ /dev/null @@ -1,51 +0,0 @@ - - * - * Console options: - * --uri : The URI to connect to, default ws://localhost:8000 - * --opcode : Opcode to send, default 'text' - * --debug : Output log data (if logger is available) - */ - -namespace WebSocket; - -require __DIR__ . '/../vendor/autoload.php'; - -error_reporting(-1); - -echo "> Send client\n"; - -// Server options specified or random -$options = array_merge([ - 'uri' => 'ws://localhost:8000', - 'opcode' => 'text', -], getopt('', ['uri:', 'opcode:', 'debug'])); -$message = array_pop($argv); - -// If debug mode and logger is available -if (isset($options['debug']) && class_exists('WebSocket\EchoLog')) { - $logger = new EchoLog(); - $options['logger'] = $logger; - echo "> Using logger\n"; -} - -try { - // Create client, send and recevie - $client = new Client($options['uri'], $options); - $client->send($message, $options['opcode']); - echo "> Sent '{$message}' [opcode: {$options['opcode']}]\n"; - if (in_array($options['opcode'], ['text', 'binary'])) { - $message = $client->receive(); - $opcode = $client->getLastOpcode(); - if (!is_null($message)) { - echo "> Got '{$message}' [opcode: {$opcode}]\n"; - } - } - $client->close(); - echo "> Closing client\n"; -} catch (\Throwable $e) { - echo "ERROR: {$e->getMessage()} [{$e->getCode()}]\n"; -} diff --git a/vendor/textalk/websocket/lib/BadOpcodeException.php b/vendor/textalk/websocket/lib/BadOpcodeException.php deleted file mode 100644 index a518715..0000000 --- a/vendor/textalk/websocket/lib/BadOpcodeException.php +++ /dev/null @@ -1,7 +0,0 @@ - 0, - 'text' => 1, - 'binary' => 2, - 'close' => 8, - 'ping' => 9, - 'pong' => 10, - ]; - - public function getLastOpcode(): ?string - { - return $this->last_opcode; - } - - public function getCloseStatus(): ?int - { - return $this->close_status; - } - - public function isConnected(): bool - { - return $this->socket && - (get_resource_type($this->socket) == 'stream' || - get_resource_type($this->socket) == 'persistent stream'); - } - - public function setTimeout(int $timeout): void - { - $this->options['timeout'] = $timeout; - - if ($this->isConnected()) { - stream_set_timeout($this->socket, $timeout); - } - } - - public function setFragmentSize(int $fragment_size): self - { - $this->options['fragment_size'] = $fragment_size; - return $this; - } - - public function getFragmentSize(): int - { - return $this->options['fragment_size']; - } - - public function setLogger(LoggerInterface $logger = null): void - { - $this->logger = $logger ?: new NullLogger(); - } - - public function send(string $payload, string $opcode = 'text', bool $masked = true): void - { - if (!$this->isConnected()) { - $this->connect(); - } - - if (!in_array($opcode, array_keys(self::$opcodes))) { - $warning = "Bad opcode '{$opcode}'. Try 'text' or 'binary'."; - $this->logger->warning($warning); - throw new BadOpcodeException($warning); - } - - $payload_chunks = str_split($payload, $this->options['fragment_size']); - $frame_opcode = $opcode; - - for ($index = 0; $index < count($payload_chunks); ++$index) { - $chunk = $payload_chunks[$index]; - $final = $index == count($payload_chunks) - 1; - - $this->sendFragment($final, $chunk, $frame_opcode, $masked); - - // all fragments after the first will be marked a continuation - $frame_opcode = 'continuation'; - } - - $this->logger->info("Sent '{$opcode}' message", [ - 'opcode' => $opcode, - 'content-length' => strlen($payload), - 'frames' => count($payload_chunks), - ]); - } - - /** - * Convenience method to send text message - * @param string $payload Content as string - */ - public function text(string $payload): void - { - $this->send($payload); - } - - /** - * Convenience method to send binary message - * @param string $payload Content as binary string - */ - public function binary(string $payload): void - { - $this->send($payload, 'binary'); - } - - /** - * Convenience method to send ping - * @param string $payload Optional text as string - */ - public function ping(string $payload = ''): void - { - $this->send($payload, 'ping'); - } - - /** - * Convenience method to send unsolicited pong - * @param string $payload Optional text as string - */ - public function pong(string $payload = ''): void - { - $this->send($payload, 'pong'); - } - - /** - * Get name of local socket, or null if not connected - * @return string|null - */ - public function getName(): ?string - { - return $this->isConnected() ? stream_socket_get_name($this->socket, false) : null; - } - - /** - * Get name of remote socket, or null if not connected - * @return string|null - */ - public function getPier(): ?string - { - return $this->isConnected() ? stream_socket_get_name($this->socket, true) : null; - } - - /** - * Get string representation of instance - * @return string String representation - */ - public function __toString(): string - { - return sprintf( - "%s(%s)", - get_class($this), - $this->getName() ?: 'closed' - ); - } - - /** - * Receive one message. - * Will continue reading until read message match filter settings. - * Return Message instance or string according to settings. - */ - protected function sendFragment(bool $final, string $payload, string $opcode, bool $masked): void - { - $data = ''; - - $byte_1 = $final ? 0b10000000 : 0b00000000; // Final fragment marker. - $byte_1 |= self::$opcodes[$opcode]; // Set opcode. - $data .= pack('C', $byte_1); - - $byte_2 = $masked ? 0b10000000 : 0b00000000; // Masking bit marker. - - // 7 bits of payload length... - $payload_length = strlen($payload); - if ($payload_length > 65535) { - $data .= pack('C', $byte_2 | 0b01111111); - $data .= pack('J', $payload_length); - } elseif ($payload_length > 125) { - $data .= pack('C', $byte_2 | 0b01111110); - $data .= pack('n', $payload_length); - } else { - $data .= pack('C', $byte_2 | $payload_length); - } - - // Handle masking - if ($masked) { - // generate a random mask: - $mask = ''; - for ($i = 0; $i < 4; $i++) { - $mask .= chr(rand(0, 255)); - } - $data .= $mask; - - // Append payload to frame: - for ($i = 0; $i < $payload_length; $i++) { - $data .= $payload[$i] ^ $mask[$i % 4]; - } - } else { - $data .= $payload; - } - - $this->write($data); - $this->logger->debug("Sent '{$opcode}' frame", [ - 'opcode' => $opcode, - 'final' => $final, - 'content-length' => strlen($payload), - ]); - } - - public function receive() - { - $filter = $this->options['filter']; - if (!$this->isConnected()) { - $this->connect(); - } - - do { - $response = $this->receiveFragment(); - list ($payload, $final, $opcode) = $response; - - // Continuation and factual opcode - $continuation = ($opcode == 'continuation'); - $payload_opcode = $continuation ? $this->read_buffer['opcode'] : $opcode; - - // Filter frames - if (!in_array($payload_opcode, $filter)) { - if ($payload_opcode == 'close') { - return null; // Always abort receive on close - } - $final = false; - continue; // Continue reading - } - - // First continuation frame, create buffer - if (!$final && !$continuation) { - $this->read_buffer = ['opcode' => $opcode, 'payload' => $payload, 'frames' => 1]; - continue; // Continue reading - } - - // Subsequent continuation frames, add to buffer - if ($continuation) { - $this->read_buffer['payload'] .= $payload; - $this->read_buffer['frames']++; - } - } while (!$final); - - // Final, return payload - $frames = 1; - if ($continuation) { - $payload = $this->read_buffer['payload']; - $frames = $this->read_buffer['frames']; - $this->read_buffer = null; - } - $this->logger->info("Received '{opcode}' message", [ - 'opcode' => $payload_opcode, - 'content-length' => strlen($payload), - 'frames' => $frames, - ]); - - $this->last_opcode = $payload_opcode; - $factory = new Factory(); - return $this->options['return_obj'] - ? $factory->create($payload_opcode, $payload) - : $payload; - } - - protected function receiveFragment(): array - { - // Read the fragment "header" first, two bytes. - $data = $this->read(2); - list ($byte_1, $byte_2) = array_values(unpack('C*', $data)); - - $final = (bool)($byte_1 & 0b10000000); // Final fragment marker. - $rsv = $byte_1 & 0b01110000; // Unused bits, ignore - - // Parse opcode - $opcode_int = $byte_1 & 0b00001111; - $opcode_ints = array_flip(self::$opcodes); - if (!array_key_exists($opcode_int, $opcode_ints)) { - $warning = "Bad opcode in websocket frame: {$opcode_int}"; - $this->logger->warning($warning); - throw new ConnectionException($warning, ConnectionException::BAD_OPCODE); - } - $opcode = $opcode_ints[$opcode_int]; - - // Masking bit - $mask = (bool)($byte_2 & 0b10000000); - - $payload = ''; - - // Payload length - $payload_length = $byte_2 & 0b01111111; - - if ($payload_length > 125) { - if ($payload_length === 126) { - $data = $this->read(2); // 126: Payload is a 16-bit unsigned int - $payload_length = current(unpack('n', $data)); - } else { - $data = $this->read(8); // 127: Payload is a 64-bit unsigned int - $payload_length = current(unpack('J', $data)); - } - } - - // Get masking key. - if ($mask) { - $masking_key = $this->read(4); - } - - // Get the actual payload, if any (might not be for e.g. close frames. - if ($payload_length > 0) { - $data = $this->read($payload_length); - - if ($mask) { - // Unmask payload. - for ($i = 0; $i < $payload_length; $i++) { - $payload .= ($data[$i] ^ $masking_key[$i % 4]); - } - } else { - $payload = $data; - } - } - - $this->logger->debug("Read '{opcode}' frame", [ - 'opcode' => $opcode, - 'final' => $final, - 'content-length' => strlen($payload), - ]); - - // if we received a ping, send a pong and wait for the next message - if ($opcode === 'ping') { - $this->logger->debug("Received 'ping', sending 'pong'."); - $this->send($payload, 'pong', true); - return [$payload, true, $opcode]; - } - - // if we received a pong, wait for the next message - if ($opcode === 'pong') { - $this->logger->debug("Received 'pong'."); - return [$payload, true, $opcode]; - } - - if ($opcode === 'close') { - $status_bin = ''; - $status = ''; - // Get the close status. - $status_bin = ''; - $status = ''; - if ($payload_length > 0) { - $status_bin = $payload[0] . $payload[1]; - $status = current(unpack('n', $payload)); - $this->close_status = $status; - } - // Get additional close message - if ($payload_length >= 2) { - $payload = substr($payload, 2); - } - - $this->logger->debug("Received 'close', status: {$this->close_status}."); - - if ($this->is_closing) { - $this->is_closing = false; // A close response, all done. - } else { - $this->send($status_bin . 'Close acknowledged: ' . $status, 'close', true); // Respond. - } - - // Close the socket. - fclose($this->socket); - - // Closing should not return message. - return [$payload, true, $opcode]; - } - - return [$payload, $final, $opcode]; - } - - /** - * Tell the socket to close. - * - * @param integer $status http://tools.ietf.org/html/rfc6455#section-7.4 - * @param string $message A closing message, max 125 bytes. - */ - public function close(int $status = 1000, string $message = 'ttfn'): void - { - if (!$this->isConnected()) { - return; - } - $status_binstr = sprintf('%016b', $status); - $status_str = ''; - foreach (str_split($status_binstr, 8) as $binstr) { - $status_str .= chr(bindec($binstr)); - } - $this->send($status_str . $message, 'close', true); - $this->logger->debug("Closing with status: {$status_str}."); - - $this->is_closing = true; - $this->receive(); // Receiving a close frame will close the socket now. - } - - /** - * Disconnect from client/server. - */ - public function disconnect(): void - { - if ($this->isConnected()) { - fclose($this->socket); - $this->socket = null; - } - } - - protected function write(string $data): void - { - $length = strlen($data); - $written = @fwrite($this->socket, $data); - if ($written === false) { - $this->throwException("Failed to write {$length} bytes."); - } - if ($written < strlen($data)) { - $this->throwException("Could only write {$written} out of {$length} bytes."); - } - $this->logger->debug("Wrote {$written} of {$length} bytes."); - } - - protected function read(string $length): string - { - $data = ''; - while (strlen($data) < $length) { - $buffer = @fread($this->socket, $length - strlen($data)); - - if (!$buffer) { - $meta = stream_get_meta_data($this->socket); - if (!empty($meta['timed_out'])) { - $message = 'Client read timeout'; - $this->logger->error($message, $meta); - throw new TimeoutException($message, ConnectionException::TIMED_OUT, $meta); - } - } - if ($buffer === false) { - $read = strlen($data); - $this->throwException("Broken frame, read {$read} of stated {$length} bytes."); - } - if ($buffer === '') { - $this->throwException("Empty read; connection dead?"); - } - $data .= $buffer; - $read = strlen($data); - $this->logger->debug("Read {$read} of {$length} bytes."); - } - return $data; - } - - protected function throwException(string $message, int $code = 0): void - { - $meta = ['closed' => true]; - if ($this->isConnected()) { - $meta = stream_get_meta_data($this->socket); - fclose($this->socket); - $this->socket = null; - } - if (!empty($meta['timed_out'])) { - $this->logger->error($message, $meta); - throw new TimeoutException($message, ConnectionException::TIMED_OUT, $meta); - } - if (!empty($meta['eof'])) { - $code = ConnectionException::EOF; - } - $this->logger->error($message, $meta); - throw new ConnectionException($message, $code, $meta); - } -} diff --git a/vendor/textalk/websocket/lib/Client.php b/vendor/textalk/websocket/lib/Client.php deleted file mode 100644 index 71d320a..0000000 --- a/vendor/textalk/websocket/lib/Client.php +++ /dev/null @@ -1,226 +0,0 @@ - null, - 'filter' => ['text', 'binary'], - 'fragment_size' => 4096, - 'headers' => null, - 'logger' => null, - 'origin' => null, // @deprecated - 'persistent' => false, - 'return_obj' => false, - 'timeout' => 5, - ]; - - protected $socket_uri; - - /** - * @param string $uri A ws/wss-URI - * @param array $options - * Associative array containing: - * - context: Set the stream context. Default: empty context - * - timeout: Set the socket timeout in seconds. Default: 5 - * - fragment_size: Set framgemnt size. Default: 4096 - * - headers: Associative array of headers to set/override. - */ - public function __construct(string $uri, array $options = []) - { - $this->options = array_merge(self::$default_options, $options); - $this->socket_uri = $uri; - $this->setLogger($this->options['logger']); - } - - public function __destruct() - { - if ($this->isConnected() && get_resource_type($this->socket) !== 'persistent stream') { - fclose($this->socket); - } - $this->socket = null; - } - - /** - * Perform WebSocket handshake - */ - protected function connect(): void - { - $url_parts = parse_url($this->socket_uri); - if (empty($url_parts) || empty($url_parts['scheme']) || empty($url_parts['host'])) { - $error = "Invalid url '{$this->socket_uri}' provided."; - $this->logger->error($error); - throw new BadUriException($error); - } - $scheme = $url_parts['scheme']; - $host = $url_parts['host']; - $user = isset($url_parts['user']) ? $url_parts['user'] : ''; - $pass = isset($url_parts['pass']) ? $url_parts['pass'] : ''; - $port = isset($url_parts['port']) ? $url_parts['port'] : ($scheme === 'wss' ? 443 : 80); - $path = isset($url_parts['path']) ? $url_parts['path'] : '/'; - $query = isset($url_parts['query']) ? $url_parts['query'] : ''; - $fragment = isset($url_parts['fragment']) ? $url_parts['fragment'] : ''; - - $path_with_query = $path; - if (!empty($query)) { - $path_with_query .= '?' . $query; - } - if (!empty($fragment)) { - $path_with_query .= '#' . $fragment; - } - - if (!in_array($scheme, ['ws', 'wss'])) { - $error = "Url should have scheme ws or wss, not '{$scheme}' from URI '{$this->socket_uri}'."; - $this->logger->error($error); - throw new BadUriException($error); - } - - $host_uri = ($scheme === 'wss' ? 'ssl' : 'tcp') . '://' . $host; - - // Set the stream context options if they're already set in the config - if (isset($this->options['context'])) { - // Suppress the error since we'll catch it below - if (@get_resource_type($this->options['context']) === 'stream-context') { - $context = $this->options['context']; - } else { - $error = "Stream context in \$options['context'] isn't a valid context."; - $this->logger->error($error); - throw new \InvalidArgumentException($error); - } - } else { - $context = stream_context_create(); - } - - $persistent = $this->options['persistent'] === true; - $flags = STREAM_CLIENT_CONNECT; - $flags = $persistent ? $flags | STREAM_CLIENT_PERSISTENT : $flags; - - $error = $errno = $errstr = null; - set_error_handler(function (int $severity, string $message, string $file, int $line) use (&$error) { - $this->logger->warning($message, ['severity' => $severity]); - $error = $message; - }, E_ALL); - - // Open the socket. - $this->socket = stream_socket_client( - "{$host_uri}:{$port}", - $errno, - $errstr, - $this->options['timeout'], - $flags, - $context - ); - - restore_error_handler(); - - if (!$this->isConnected()) { - $error = "Could not open socket to \"{$host}:{$port}\": {$errstr} ({$errno}) {$error}."; - $this->logger->error($error); - throw new ConnectionException($error); - } - - $address = "{$scheme}://{$host}{$path_with_query}"; - - if (!$persistent || ftell($this->socket) == 0) { - // Set timeout on the stream as well. - stream_set_timeout($this->socket, $this->options['timeout']); - - // Generate the WebSocket key. - $key = self::generateKey(); - - // Default headers - $headers = [ - 'Host' => $host . ":" . $port, - 'User-Agent' => 'websocket-client-php', - 'Connection' => 'Upgrade', - 'Upgrade' => 'websocket', - 'Sec-WebSocket-Key' => $key, - 'Sec-WebSocket-Version' => '13', - ]; - - // Handle basic authentication. - if ($user || $pass) { - $headers['authorization'] = 'Basic ' . base64_encode($user . ':' . $pass); - } - - // Deprecated way of adding origin (use headers instead). - if (isset($this->options['origin'])) { - $headers['origin'] = $this->options['origin']; - } - - // Add and override with headers from options. - if (isset($this->options['headers'])) { - $headers = array_merge($headers, $this->options['headers']); - } - - $header = "GET " . $path_with_query . " HTTP/1.1\r\n" . implode( - "\r\n", - array_map( - function ($key, $value) { - return "$key: $value"; - }, - array_keys($headers), - $headers - ) - ) . "\r\n\r\n"; - - // Send headers. - $this->write($header); - - // Get server response header (terminated with double CR+LF). - $response = ''; - do { - $buffer = fgets($this->socket, 1024); - if ($buffer === false) { - $meta = stream_get_meta_data($this->socket); - $message = 'Client handshake error'; - $this->logger->error($message, $meta); - throw new ConnectionException($message); - } - $response .= $buffer; - } while (substr_count($response, "\r\n\r\n") == 0); - - // Validate response. - if (!preg_match('#Sec-WebSocket-Accept:\s(.*)$#mUi', $response, $matches)) { - $error = "Connection to '{$address}' failed: Server sent invalid upgrade response: {$response}"; - $this->logger->error($error); - throw new ConnectionException($error); - } - - $keyAccept = trim($matches[1]); - $expectedResonse - = base64_encode(pack('H*', sha1($key . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'))); - - if ($keyAccept !== $expectedResonse) { - $error = 'Server sent bad upgrade response.'; - $this->logger->error($error); - throw new ConnectionException($error); - } - } - - $this->logger->info("Client connected to {$address}"); - } - - /** - * Generate a random string for WebSocket key. - * - * @return string Random string - */ - protected static function generateKey(): string - { - $key = ''; - for ($i = 0; $i < 16; $i++) { - $key .= chr(rand(33, 126)); - } - return base64_encode($key); - } -} diff --git a/vendor/textalk/websocket/lib/ConnectionException.php b/vendor/textalk/websocket/lib/ConnectionException.php deleted file mode 100644 index 7e1ecbf..0000000 --- a/vendor/textalk/websocket/lib/ConnectionException.php +++ /dev/null @@ -1,26 +0,0 @@ -data = $data; - } - - public function getData(): array - { - return $this->data; - } -} diff --git a/vendor/textalk/websocket/lib/Exception.php b/vendor/textalk/websocket/lib/Exception.php deleted file mode 100644 index 6482b7e..0000000 --- a/vendor/textalk/websocket/lib/Exception.php +++ /dev/null @@ -1,7 +0,0 @@ -payload = $payload; - $this->timestamp = new DateTime(); - } - - public function getOpcode(): string - { - return $this->opcode; - } - - public function getLength(): int - { - return strlen($this->payload); - } - - public function getTimestamp(): DateTime - { - return $this->timestamp; - } - - public function getContent(): string - { - return $this->payload; - } - - public function setContent(string $payload = ''): void - { - $this->payload = $payload; - } - - public function hasContent(): bool - { - return $this->payload != ''; - } - - public function __toString(): string - { - return get_class($this); - } -} diff --git a/vendor/textalk/websocket/lib/Message/Ping.php b/vendor/textalk/websocket/lib/Message/Ping.php deleted file mode 100644 index 908d233..0000000 --- a/vendor/textalk/websocket/lib/Message/Ping.php +++ /dev/null @@ -1,8 +0,0 @@ - ['text', 'binary'], - 'fragment_size' => 4096, - 'logger' => null, - 'port' => 8000, - 'return_obj' => false, - 'timeout' => null, - ]; - - protected $addr; - protected $port; - protected $listening; - protected $request; - protected $request_path; - - /** - * @param array $options - * Associative array containing: - * - timeout: Set the socket timeout in seconds. - * - fragment_size: Set framgemnt size. Default: 4096 - * - port: Chose port for listening. Default 8000. - */ - public function __construct(array $options = []) - { - $this->options = array_merge(self::$default_options, $options); - $this->port = $this->options['port']; - $this->setLogger($this->options['logger']); - - $error = $errno = $errstr = null; - set_error_handler(function (int $severity, string $message, string $file, int $line) use (&$error) { - $this->logger->warning($message, ['severity' => $severity]); - $error = $message; - }, E_ALL); - - do { - $this->listening = stream_socket_server("tcp://0.0.0.0:$this->port", $errno, $errstr); - } while ($this->listening === false && $this->port++ < 10000); - - restore_error_handler(); - - if (!$this->listening) { - $error = "Could not open listening socket: {$errstr} ({$errno}) {$error}"; - $this->logger->error($error); - throw new ConnectionException($error, (int)$errno); - } - - $this->logger->info("Server listening to port {$this->port}"); - } - - public function __destruct() - { - if ($this->isConnected()) { - fclose($this->socket); - } - $this->socket = null; - } - - public function getPort(): int - { - return $this->port; - } - - public function getPath(): string - { - return $this->request_path; - } - - public function getRequest(): array - { - return $this->request; - } - - public function getHeader($header): ?string - { - foreach ($this->request as $row) { - if (stripos($row, $header) !== false) { - list($headername, $headervalue) = explode(":", $row); - return trim($headervalue); - } - } - return null; - } - - public function accept(): bool - { - $this->socket = null; - return (bool)$this->listening; - } - - protected function connect(): void - { - - $error = null; - set_error_handler(function (int $severity, string $message, string $file, int $line) use (&$error) { - $this->logger->warning($message, ['severity' => $severity]); - $error = $message; - }, E_ALL); - - if (isset($this->options['timeout'])) { - $this->socket = stream_socket_accept($this->listening, $this->options['timeout']); - } else { - $this->socket = stream_socket_accept($this->listening); - } - - restore_error_handler(); - - if (!$this->socket) { - $this->throwException("Server failed to connect. {$error}"); - } - if (isset($this->options['timeout'])) { - stream_set_timeout($this->socket, $this->options['timeout']); - } - - $this->logger->info("Client has connected to port {port}", [ - 'port' => $this->port, - 'pier' => stream_socket_get_name($this->socket, true), - ]); - $this->performHandshake(); - } - - protected function performHandshake(): void - { - $request = ''; - do { - $buffer = stream_get_line($this->socket, 1024, "\r\n"); - $request .= $buffer . "\n"; - $metadata = stream_get_meta_data($this->socket); - } while (!feof($this->socket) && $metadata['unread_bytes'] > 0); - - if (!preg_match('/GET (.*) HTTP\//mUi', $request, $matches)) { - $error = "No GET in request: {$request}"; - $this->logger->error($error); - throw new ConnectionException($error); - } - $get_uri = trim($matches[1]); - $uri_parts = parse_url($get_uri); - - $this->request = explode("\n", $request); - $this->request_path = $uri_parts['path']; - /// @todo Get query and fragment as well. - - if (!preg_match('#Sec-WebSocket-Key:\s(.*)$#mUi', $request, $matches)) { - $error = "Client had no Key in upgrade request: {$request}"; - $this->logger->error($error); - throw new ConnectionException($error); - } - - $key = trim($matches[1]); - - /// @todo Validate key length and base 64... - $response_key = base64_encode(pack('H*', sha1($key . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'))); - - $header = "HTTP/1.1 101 Switching Protocols\r\n" - . "Upgrade: websocket\r\n" - . "Connection: Upgrade\r\n" - . "Sec-WebSocket-Accept: $response_key\r\n" - . "\r\n"; - - $this->write($header); - $this->logger->debug("Handshake on {$get_uri}"); - } -} diff --git a/vendor/textalk/websocket/lib/TimeoutException.php b/vendor/textalk/websocket/lib/TimeoutException.php deleted file mode 100644 index d20e622..0000000 --- a/vendor/textalk/websocket/lib/TimeoutException.php +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - tests - - - - - lib/ - - - diff --git a/vendor/textalk/websocket/tests/ClientTest.php b/vendor/textalk/websocket/tests/ClientTest.php deleted file mode 100644 index e0cf94c..0000000 --- a/vendor/textalk/websocket/tests/ClientTest.php +++ /dev/null @@ -1,458 +0,0 @@ -send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - $this->assertEquals(4096, $client->getFragmentSize()); - - MockSocket::initialize('send-receive', $this); - $client->send('Sending a message'); - $message = $client->receive(); - $this->assertTrue(MockSocket::isEmpty()); - $this->assertEquals('text', $client->getLastOpcode()); - - MockSocket::initialize('client.close', $this); - $this->assertTrue($client->isConnected()); - $this->assertNull($client->getCloseStatus()); - - $client->close(); - $this->assertFalse($client->isConnected()); - $this->assertEquals(1000, $client->getCloseStatus()); - - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testDestruct(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('client.destruct', $this); - } - - public function testClienExtendedUrl(): void - { - MockSocket::initialize('client.connect-extended', $this); - $client = new Client('ws://localhost:8000/my/mock/path?my_query=yes#my_fragment'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testClientWithTimeout(): void - { - MockSocket::initialize('client.connect-timeout', $this); - $client = new Client('ws://localhost:8000/my/mock/path', ['timeout' => 300]); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testClientWithContext(): void - { - MockSocket::initialize('client.connect-context', $this); - $client = new Client('ws://localhost:8000/my/mock/path', ['context' => '@mock-stream-context']); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testClientAuthed(): void - { - MockSocket::initialize('client.connect-authed', $this); - $client = new Client('wss://usename:password@localhost:8000/my/mock/path'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testWithHeaders(): void - { - MockSocket::initialize('client.connect-headers', $this); - $client = new Client('ws://localhost:8000/my/mock/path', [ - 'origin' => 'Origin header', - 'headers' => ['Generic header' => 'Generic content'], - ]); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testPayload128(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - - $payload = file_get_contents(__DIR__ . '/mock/payload.128.txt'); - - MockSocket::initialize('send-receive-128', $this); - $client->send($payload, 'text', false); - $message = $client->receive(); - $this->assertEquals($payload, $message); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testPayload65536(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - - $payload = file_get_contents(__DIR__ . '/mock/payload.65536.txt'); - $client->setFragmentSize(65540); - - MockSocket::initialize('send-receive-65536', $this); - $client->send($payload, 'text', false); - $message = $client->receive(); - $this->assertEquals($payload, $message); - $this->assertTrue(MockSocket::isEmpty()); - $this->assertEquals(65540, $client->getFragmentSize()); - } - - public function testMultiFragment(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('send-receive-multi-fragment', $this); - $client->setFragmentSize(8); - $client->send('Multi fragment test'); - $message = $client->receive(); - $this->assertEquals('Multi fragment test', $message); - $this->assertTrue(MockSocket::isEmpty()); - $this->assertEquals(8, $client->getFragmentSize()); - } - - public function testPingPong(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('ping-pong', $this); - $client->send('Server ping', 'ping'); - $client->send('', 'ping'); - $message = $client->receive(); - $this->assertEquals('Receiving a message', $message); - $this->assertEquals('text', $client->getLastOpcode()); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testRemoteClose(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('close-remote', $this); - - $message = $client->receive(); - $this->assertNull($message); - - $this->assertFalse($client->isConnected()); - $this->assertEquals(17260, $client->getCloseStatus()); - $this->assertNull($client->getLastOpcode()); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testSetTimeout(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('config-timeout', $this); - $client->setTimeout(300); - $this->assertTrue($client->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testReconnect(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('client.close', $this); - $this->assertTrue($client->isConnected()); - $this->assertNull($client->getCloseStatus()); - $client->close(); - $this->assertFalse($client->isConnected()); - $this->assertEquals(1000, $client->getCloseStatus()); - $this->assertNull($client->getLastOpcode()); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('client.reconnect', $this); - $message = $client->receive(); - $this->assertTrue($client->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testPersistentConnection(): void - { - MockSocket::initialize('client.connect-persistent', $this); - $client = new Client('ws://localhost:8000/my/mock/path', ['persistent' => true]); - $client->send('Connect'); - $client->disconnect(); - $this->assertFalse($client->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testBadScheme(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('bad://localhost:8000/my/mock/path'); - $this->expectException('WebSocket\BadUriException'); - $this->expectExceptionMessage('Url should have scheme ws or wss'); - $client->send('Connect'); - } - - public function testBadUrl(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('this is not an url'); - $this->expectException('WebSocket\BadUriException'); - $this->expectExceptionMessage('Invalid url \'this is not an url\' provided.'); - $client->send('Connect'); - } - - public function testBadStreamContext(): void - { - MockSocket::initialize('client.connect-bad-context', $this); - $client = new Client('ws://localhost:8000/my/mock/path', ['context' => 'BAD']); - $this->expectException('InvalidArgumentException'); - $this->expectExceptionMessage('Stream context in $options[\'context\'] isn\'t a valid context'); - $client->send('Connect'); - } - - public function testFailedConnection(): void - { - MockSocket::initialize('client.connect-failed', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Could not open socket to "localhost:8000"'); - $client->send('Connect'); - } - - public function testFailedConnectionWithError(): void - { - MockSocket::initialize('client.connect-error', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Could not open socket to "localhost:8000"'); - $client->send('Connect'); - } - - public function testInvalidUpgrade(): void - { - MockSocket::initialize('client.connect-invalid-upgrade', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Connection to \'ws://localhost/my/mock/path\' failed'); - $client->send('Connect'); - } - - public function testInvalidKey(): void - { - MockSocket::initialize('client.connect-invalid-key', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Server sent bad upgrade response'); - $client->send('Connect'); - } - - public function testSendBadOpcode(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - - MockSocket::initialize('send-bad-opcode', $this); - $this->expectException('WebSocket\BadOpcodeException'); - $this->expectExceptionMessage('Bad opcode \'bad\'. Try \'text\' or \'binary\'.'); - $client->send('Bad Opcode', 'bad'); - } - - public function testRecieveBadOpcode(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - MockSocket::initialize('receive-bad-opcode', $this); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(1026); - $this->expectExceptionMessage('Bad opcode in websocket frame: 12'); - $message = $client->receive(); - } - - public function testBrokenWrite(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - MockSocket::initialize('send-broken-write', $this); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(1025); - $this->expectExceptionMessage('Could only write 18 out of 22 bytes.'); - $client->send('Failing to write'); - } - - public function testFailedWrite(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - MockSocket::initialize('send-failed-write', $this); - $this->expectException('WebSocket\TimeoutException'); - $this->expectExceptionCode(1024); - $this->expectExceptionMessage('Failed to write 22 bytes.'); - $client->send('Failing to write'); - } - - public function testBrokenRead(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - MockSocket::initialize('receive-broken-read', $this); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(1025); - $this->expectExceptionMessage('Broken frame, read 0 of stated 2 bytes.'); - $client->receive(); - } - - public function testHandshakeError(): void - { - MockSocket::initialize('client.connect-handshake-error', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Client handshake error'); - $client->send('Connect'); - } - - public function testReadTimeout(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - MockSocket::initialize('receive-client-timeout', $this); - $this->expectException('WebSocket\TimeoutException'); - $this->expectExceptionCode(1024); - $this->expectExceptionMessage('Client read timeout'); - $client->receive(); - } - - public function testEmptyRead(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $client->send('Connect'); - MockSocket::initialize('receive-empty-read', $this); - $this->expectException('WebSocket\TimeoutException'); - $this->expectExceptionCode(1024); - $this->expectExceptionMessage('Empty read; connection dead?'); - $client->receive(); - } - - public function testFrameFragmentation(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client( - 'ws://localhost:8000/my/mock/path', - ['filter' => ['text', 'binary', 'pong', 'close']] - ); - $client->send('Connect'); - MockSocket::initialize('receive-fragmentation', $this); - $message = $client->receive(); - $this->assertEquals('Server ping', $message); - $this->assertEquals('pong', $client->getLastOpcode()); - $message = $client->receive(); - $this->assertEquals('Multi fragment test', $message); - $this->assertEquals('text', $client->getLastOpcode()); - $this->assertTrue(MockSocket::isEmpty()); - MockSocket::initialize('close-remote', $this); - $message = $client->receive(); - $this->assertEquals('Closing', $message); - $this->assertTrue(MockSocket::isEmpty()); - $this->assertFalse($client->isConnected()); - $this->assertEquals(17260, $client->getCloseStatus()); - $this->assertEquals('close', $client->getLastOpcode()); - } - - public function testMessageFragmentation(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client( - 'ws://localhost:8000/my/mock/path', - ['filter' => ['text', 'binary', 'pong', 'close'], 'return_obj' => true] - ); - $client->send('Connect'); - MockSocket::initialize('receive-fragmentation', $this); - $message = $client->receive(); - $this->assertInstanceOf('WebSocket\Message\Message', $message); - $this->assertInstanceOf('WebSocket\Message\Pong', $message); - $this->assertEquals('Server ping', $message->getContent()); - $this->assertEquals('pong', $message->getOpcode()); - $message = $client->receive(); - $this->assertInstanceOf('WebSocket\Message\Message', $message); - $this->assertInstanceOf('WebSocket\Message\Text', $message); - $this->assertEquals('Multi fragment test', $message->getContent()); - $this->assertEquals('text', $message->getOpcode()); - $this->assertTrue(MockSocket::isEmpty()); - MockSocket::initialize('close-remote', $this); - $message = $client->receive(); - $this->assertInstanceOf('WebSocket\Message\Message', $message); - $this->assertInstanceOf('WebSocket\Message\Close', $message); - $this->assertEquals('Closing', $message->getContent()); - $this->assertEquals('close', $message->getOpcode()); - } - - public function testConvenicanceMethods(): void - { - MockSocket::initialize('client.connect', $this); - $client = new Client('ws://localhost:8000/my/mock/path'); - $this->assertNull($client->getName()); - $this->assertNull($client->getPier()); - $this->assertEquals('WebSocket\Client(closed)', "{$client}"); - $client->text('Connect'); - MockSocket::initialize('send-convenicance', $this); - $client->binary(base64_encode('Binary content')); - $client->ping(); - $client->pong(); - $this->assertEquals('127.0.0.1:12345', $client->getName()); - $this->assertEquals('127.0.0.1:8000', $client->getPier()); - $this->assertEquals('WebSocket\Client(127.0.0.1:12345)', "{$client}"); - } -} diff --git a/vendor/textalk/websocket/tests/ExceptionTest.php b/vendor/textalk/websocket/tests/ExceptionTest.php deleted file mode 100644 index 2083e70..0000000 --- a/vendor/textalk/websocket/tests/ExceptionTest.php +++ /dev/null @@ -1,51 +0,0 @@ - 'with data'], - new TimeoutException( - 'Nested exception', - ConnectionException::TIMED_OUT - ) - ); - } catch (Throwable $e) { - } - - $this->assertInstanceOf('WebSocket\ConnectionException', $e); - $this->assertInstanceOf('WebSocket\Exception', $e); - $this->assertInstanceOf('Exception', $e); - $this->assertInstanceOf('Throwable', $e); - $this->assertEquals('An error message', $e->getMessage()); - $this->assertEquals(1025, $e->getCode()); - $this->assertEquals(['test' => 'with data'], $e->getData()); - - $p = $e->getPrevious(); - $this->assertInstanceOf('WebSocket\TimeoutException', $p); - $this->assertInstanceOf('WebSocket\ConnectionException', $p); - $this->assertEquals('Nested exception', $p->getMessage()); - $this->assertEquals(1024, $p->getCode()); - $this->assertEquals([], $p->getData()); - } -} diff --git a/vendor/textalk/websocket/tests/MessageTest.php b/vendor/textalk/websocket/tests/MessageTest.php deleted file mode 100644 index bade435..0000000 --- a/vendor/textalk/websocket/tests/MessageTest.php +++ /dev/null @@ -1,60 +0,0 @@ -create('text', 'Some content'); - $this->assertInstanceOf('WebSocket\Message\Text', $message); - $message = $factory->create('binary', 'Some content'); - $this->assertInstanceOf('WebSocket\Message\Binary', $message); - $message = $factory->create('ping', 'Some content'); - $this->assertInstanceOf('WebSocket\Message\Ping', $message); - $message = $factory->create('pong', 'Some content'); - $this->assertInstanceOf('WebSocket\Message\Pong', $message); - $message = $factory->create('close', 'Some content'); - $this->assertInstanceOf('WebSocket\Message\Close', $message); - } - - public function testMessage() - { - $message = new Text('Some content'); - $this->assertInstanceOf('WebSocket\Message\Message', $message); - $this->assertInstanceOf('WebSocket\Message\Text', $message); - $this->assertEquals('Some content', $message->getContent()); - $this->assertEquals('text', $message->getOpcode()); - $this->assertEquals(12, $message->getLength()); - $this->assertTrue($message->hasContent()); - $this->assertInstanceOf('DateTime', $message->getTimestamp()); - $message->setContent(''); - $this->assertEquals(0, $message->getLength()); - $this->assertFalse($message->hasContent()); - $this->assertEquals('WebSocket\Message\Text', "{$message}"); - } - - public function testBadOpcode() - { - $factory = new Factory(); - $this->expectException('WebSocket\BadOpcodeException'); - $this->expectExceptionMessage("Invalid opcode 'invalid' provided"); - $message = $factory->create('invalid', 'Some content'); - } -} diff --git a/vendor/textalk/websocket/tests/README.md b/vendor/textalk/websocket/tests/README.md deleted file mode 100644 index b710a7e..0000000 --- a/vendor/textalk/websocket/tests/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Testing - -Unit tests with [PHPUnit](https://phpunit.readthedocs.io/). - - -## How to run - -To run all test, run in console. - -``` -make test -``` - - -## Continuous integration - -GitHub Actions are run on PHP versions -`7.2`, `7.3`, `7.4` and `8.0`. - -Code coverage by [Coveralls](https://coveralls.io/github/Textalk/websocket-php). - - -## Test strategy - -Test set up overloads various stream and socket functions, -and use "scripts" to define and mock input/output of these functions. - -This set up negates the dependency on running servers, -and allow testing various errors that might occur. diff --git a/vendor/textalk/websocket/tests/ServerTest.php b/vendor/textalk/websocket/tests/ServerTest.php deleted file mode 100644 index c2370f4..0000000 --- a/vendor/textalk/websocket/tests/ServerTest.php +++ /dev/null @@ -1,447 +0,0 @@ -assertTrue(MockSocket::isEmpty()); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - $this->assertEquals(8000, $server->getPort()); - $this->assertEquals('/my/mock/path', $server->getPath()); - $this->assertTrue($server->isConnected()); - $this->assertEquals(4096, $server->getFragmentSize()); - $this->assertNull($server->getCloseStatus()); - $this->assertEquals([ - 'GET /my/mock/path HTTP/1.1', - 'host: localhost:8000', - 'user-agent: websocket-client-php', - 'connection: Upgrade', - 'upgrade: websocket', - 'sec-websocket-key: cktLWXhUdDQ2OXF0ZCFqOQ==', - 'sec-websocket-version: 13', - '', - '', - ], $server->getRequest()); - $this->assertEquals('websocket-client-php', $server->getHeader('USER-AGENT')); - $this->assertNull($server->getHeader('no such header')); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('send-receive', $this); - $server->send('Sending a message'); - $message = $server->receive(); - $this->assertEquals('Receiving a message', $message); - $this->assertTrue(MockSocket::isEmpty()); - $this->assertNull($server->getCloseStatus()); - $this->assertEquals('text', $server->getLastOpcode()); - - MockSocket::initialize('server.close', $this); - $server->close(); - $this->assertFalse($server->isConnected()); - $this->assertEquals(1000, $server->getCloseStatus()); - $this->assertTrue(MockSocket::isEmpty()); - - $server->close(); // Already closed - } - - public function testDestruct(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - - MockSocket::initialize('server.accept-destruct', $this); - $server->accept(); - $message = $server->receive(); - } - - public function testServerWithTimeout(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(['timeout' => 300]); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('server.accept-timeout', $this); - $server->accept(); - $server->send('Connect'); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testPayload128(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - $this->assertTrue($server->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - - $payload = file_get_contents(__DIR__ . '/mock/payload.128.txt'); - - MockSocket::initialize('send-receive-128', $this); - $server->send($payload, 'text', false); - $message = $server->receive(); - $this->assertEquals($payload, $message); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testPayload65536(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - $this->assertTrue($server->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - - $payload = file_get_contents(__DIR__ . '/mock/payload.65536.txt'); - $server->setFragmentSize(65540); - - MockSocket::initialize('send-receive-65536', $this); - $server->send($payload, 'text', false); - $message = $server->receive(); - $this->assertEquals($payload, $message); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testMultiFragment(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - $this->assertTrue($server->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('send-receive-multi-fragment', $this); - $server->setFragmentSize(8); - $server->send('Multi fragment test'); - $message = $server->receive(); - $this->assertEquals('Multi fragment test', $message); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testPingPong(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - $this->assertTrue($server->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('ping-pong', $this); - $server->send('Server ping', 'ping'); - $server->send('', 'ping'); - $message = $server->receive(); - $this->assertEquals('Receiving a message', $message); - $this->assertEquals('text', $server->getLastOpcode()); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testRemoteClose(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - $this->assertTrue($server->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('close-remote', $this); - - $message = $server->receive(); - $this->assertEquals('', $message); - - $this->assertTrue(MockSocket::isEmpty()); - $this->assertFalse($server->isConnected()); - $this->assertEquals(17260, $server->getCloseStatus()); - $this->assertNull($server->getLastOpcode()); - } - - public function testSetTimeout(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - $this->assertTrue($server->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - - MockSocket::initialize('config-timeout', $this); - $server->setTimeout(300); - $this->assertTrue($server->isConnected()); - $this->assertTrue(MockSocket::isEmpty()); - } - - public function testFailedSocketServer(): void - { - MockSocket::initialize('server.construct-failed-socket-server', $this); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Could not open listening socket:'); - $server = new Server(['port' => 9999]); - } - - public function testFailedSocketServerWithError(): void - { - MockSocket::initialize('server.construct-error-socket-server', $this); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Could not open listening socket:'); - $server = new Server(['port' => 9999]); - } - - public function testFailedConnect(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - - MockSocket::initialize('server.accept-failed-connect', $this); - $server->accept(); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Server failed to connect'); - $server->send('Connect'); - } - - public function testFailedConnectWithError(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - - MockSocket::initialize('server.accept-error-connect', $this); - $server->accept(); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Server failed to connect'); - $server->send('Connect'); - } - - public function testFailedConnectTimeout(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(['timeout' => 300]); - - MockSocket::initialize('server.accept-failed-connect', $this); - $server->accept(); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Server failed to connect'); - $server->send('Connect'); - } - - public function testFailedHttp(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - MockSocket::initialize('server.accept-failed-http', $this); - $server->accept(); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('No GET in request'); - $server->send('Connect'); - } - - public function testFailedWsKey(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - MockSocket::initialize('server.accept-failed-ws-key', $this); - $server->accept(); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Client had no Key in upgrade request'); - $server->send('Connect'); - } - - public function testSendBadOpcode(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - $this->expectException('WebSocket\BadOpcodeException'); - $this->expectExceptionCode(0); - $this->expectExceptionMessage('Bad opcode \'bad\'. Try \'text\' or \'binary\'.'); - $server->send('Bad Opcode', 'bad'); - } - - public function testRecieveBadOpcode(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - MockSocket::initialize('receive-bad-opcode', $this); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(1026); - $this->expectExceptionMessage('Bad opcode in websocket frame: 12'); - $message = $server->receive(); - } - - public function testBrokenWrite(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - MockSocket::initialize('send-broken-write', $this); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(1025); - $this->expectExceptionMessage('Could only write 18 out of 22 bytes.'); - $server->send('Failing to write'); - } - - public function testFailedWrite(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - MockSocket::initialize('send-failed-write', $this); - $this->expectException('WebSocket\TimeoutException'); - $this->expectExceptionCode(1024); - $this->expectExceptionMessage('Failed to write 22 bytes.'); - $server->send('Failing to write'); - } - - public function testBrokenRead(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - MockSocket::initialize('receive-broken-read', $this); - $this->expectException('WebSocket\ConnectionException'); - $this->expectExceptionCode(1025); - $this->expectExceptionMessage('Broken frame, read 0 of stated 2 bytes.'); - $server->receive(); - } - - public function testEmptyRead(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - MockSocket::initialize('receive-empty-read', $this); - $this->expectException('WebSocket\TimeoutException'); - $this->expectExceptionCode(1024); - $this->expectExceptionMessage('Empty read; connection dead?'); - $server->receive(); - } - - public function testFrameFragmentation(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(['filter' => ['text', 'binary', 'pong', 'close']]); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - MockSocket::initialize('receive-fragmentation', $this); - $message = $server->receive(); - $this->assertEquals('Server ping', $message); - $this->assertEquals('pong', $server->getLastOpcode()); - $message = $server->receive(); - $this->assertEquals('Multi fragment test', $message); - $this->assertEquals('text', $server->getLastOpcode()); - $this->assertTrue(MockSocket::isEmpty()); - MockSocket::initialize('close-remote', $this); - $message = $server->receive(); - $this->assertEquals('Closing', $message); - $this->assertTrue(MockSocket::isEmpty()); - $this->assertFalse($server->isConnected()); - $this->assertEquals(17260, $server->getCloseStatus()); - $this->assertEquals('close', $server->getLastOpcode()); - } - - public function testMessageFragmentation(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(['filter' => ['text', 'binary', 'pong', 'close'], 'return_obj' => true]); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->send('Connect'); - MockSocket::initialize('receive-fragmentation', $this); - $message = $server->receive(); - $this->assertInstanceOf('WebSocket\Message\Message', $message); - $this->assertInstanceOf('WebSocket\Message\Pong', $message); - $this->assertEquals('Server ping', $message->getContent()); - $this->assertEquals('pong', $message->getOpcode()); - $message = $server->receive(); - $this->assertInstanceOf('WebSocket\Message\Message', $message); - $this->assertInstanceOf('WebSocket\Message\Text', $message); - $this->assertEquals('Multi fragment test', $message->getContent()); - $this->assertEquals('text', $message->getOpcode()); - $this->assertTrue(MockSocket::isEmpty()); - MockSocket::initialize('close-remote', $this); - $message = $server->receive(); - $this->assertInstanceOf('WebSocket\Message\Message', $message); - $this->assertInstanceOf('WebSocket\Message\Close', $message); - $this->assertEquals('Closing', $message->getContent()); - $this->assertEquals('close', $message->getOpcode()); - } - - public function testConvenicanceMethods(): void - { - MockSocket::initialize('server.construct', $this); - $server = new Server(); - $this->assertNull($server->getName()); - $this->assertNull($server->getPier()); - $this->assertEquals('WebSocket\Server(closed)', "{$server}"); - MockSocket::initialize('server.accept', $this); - $server->accept(); - $server->text('Connect'); - MockSocket::initialize('send-convenicance', $this); - $server->binary(base64_encode('Binary content')); - $server->ping(); - $server->pong(); - $this->assertEquals('127.0.0.1:12345', $server->getName()); - $this->assertEquals('127.0.0.1:8000', $server->getPier()); - $this->assertEquals('WebSocket\Server(127.0.0.1:12345)', "{$server}"); - $this->assertTrue(MockSocket::isEmpty()); - } -} diff --git a/vendor/textalk/websocket/tests/bootstrap.php b/vendor/textalk/websocket/tests/bootstrap.php deleted file mode 100644 index 5d6bdd0..0000000 --- a/vendor/textalk/websocket/tests/bootstrap.php +++ /dev/null @@ -1,6 +0,0 @@ -interpolate($message, $context); - $context_string = empty($context) ? '' : json_encode($context); - echo str_pad($level, 8) . " | {$message} {$context_string}\n"; - } - - public function interpolate($message, array $context = []) - { - // Build a replacement array with braces around the context keys - $replace = []; - foreach ($context as $key => $val) { - // Check that the value can be cast to string - if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) { - $replace['{' . $key . '}'] = $val; - } - } - - // Interpolate replacement values into the message and return - return strtr($message, $replace); - } -} diff --git a/vendor/textalk/websocket/tests/mock/MockSocket.php b/vendor/textalk/websocket/tests/mock/MockSocket.php deleted file mode 100644 index e51823d..0000000 --- a/vendor/textalk/websocket/tests/mock/MockSocket.php +++ /dev/null @@ -1,78 +0,0 @@ -assertEquals($current['function'], $function); - foreach ($current['params'] as $index => $param) { - self::$asserter->assertEquals($param, $params[$index], json_encode([$current, $params])); - } - if (isset($current['error'])) { - $map = array_merge(['msg' => 'Error', 'type' => E_USER_NOTICE], (array)$current['error']); - trigger_error($map['msg'], $map['type']); - } - if (isset($current['return-op'])) { - return self::op($current['return-op'], $params, $current['return']); - } - if (isset($current['return'])) { - return $current['return']; - } - return call_user_func_array($function, $params); - } - - // Check if all expected calls are performed - public static function isEmpty(): bool - { - return empty(self::$queue); - } - - // Initialize call queue - public static function initialize($op_file, $asserter): void - { - $file = dirname(__DIR__) . "/scripts/{$op_file}.json"; - self::$queue = json_decode(file_get_contents($file), true); - self::$asserter = $asserter; - } - - // Special output handling - private static function op($op, $params, $data) - { - switch ($op) { - case 'chr-array': - // Convert int array to string - $out = ''; - foreach ($data as $val) { - $out .= chr($val); - } - return $out; - case 'file': - $content = file_get_contents(__DIR__ . "/{$data[0]}"); - return substr($content, $data[1], $data[2]); - case 'key-save': - preg_match('#Sec-WebSocket-Key:\s(.*)$#mUi', $params[1], $matches); - self::$stored['sec-websocket-key'] = trim($matches[1]); - return $data; - case 'key-respond': - $key = self::$stored['sec-websocket-key'] . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; - $encoded = base64_encode(pack('H*', sha1($key))); - return str_replace('{key}', $encoded, $data); - } - return $data; - } -} diff --git a/vendor/textalk/websocket/tests/mock/mock-socket.php b/vendor/textalk/websocket/tests/mock/mock-socket.php deleted file mode 100644 index a038933..0000000 --- a/vendor/textalk/websocket/tests/mock/mock-socket.php +++ /dev/null @@ -1,83 +0,0 @@ -