diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index dc02dfb114fb6af2eacf89407a529c37ab8e7eb8..4626994fd4d8ac4c5489670d85b09af1b6d8aab0 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -374,14 +374,10 @@ class ClassLoader $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { + foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { + if (0 === strpos($class, $prefix)) { + foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } } diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index f0157a6ed025c0168a2f595d09a98b800c5ba431..1a28124886db89f1ca3e4fa674cb69a9a17585b3 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,56 +1,21 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: Composer -Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be> -Source: https://github.com/composer/composer -Files: * -Copyright: 2016, Nils Adermann <naderman@naderman.de> - 2016, Jordi Boggiano <j.boggiano@seld.be> -License: Expat +Copyright (c) 2016 Nils Adermann, Jordi Boggiano -Files: src/Composer/Util/TlsHelper.php -Copyright: 2016, Nils Adermann <naderman@naderman.de> - 2016, Jordi Boggiano <j.boggiano@seld.be> - 2013, Evan Coury <me@evancoury.com> -License: Expat and BSD-2-Clause +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: -License: BSD-2-Clause - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - . - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - . - * 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. - . - 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 OWNER 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. +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. -License: Expat - 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/composer/autoload_files.php b/vendor/composer/autoload_files.php index 9b45ff26b0f1e4c0e1764c985c2be5a7a5ff09b6..973958a20c6c072e73412d54362baf7bd71be88c 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -9,8 +9,8 @@ return array( 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', '253c157292f75eb38082b5acb06f3f01' => $vendorDir . '/nikic/fast-route/src/functions.php', 'ddc0a4d7e61c0286f0f8593b1903e894' => $vendorDir . '/clue/stream-filter/src/functions.php', - '8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', + '8cff32064859f4559445b89279f3199c' => $vendorDir . '/php-http/message/src/filters.php', ); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php index 3225edbdd0e26babe785f95ec1b6533bab865d37..daae60bfc1eba4c1f1f809ce06e3dddd9815964d 100644 --- a/vendor/composer/autoload_namespaces.php +++ b/vendor/composer/autoload_namespaces.php @@ -11,4 +11,5 @@ return array( 'Zend_Search' => array($vendorDir . '/zf1/zend-search/library'), 'Zend_Exception' => array($vendorDir . '/zf1/zend-exception/library'), 'Pimple' => array($vendorDir . '/pimple/pimple/src'), + 'Gitlab\\' => array($vendorDir . '/m4tthumphrey/php-gitlab-api/lib'), ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 18a36b376d92a97c16c3edb2f35cd48dbc1ff2ca..27ee70f7c444b2df7c07b6291e23bee84273ffcd 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -21,20 +21,20 @@ return array( 'Respect\\Validation\\' => array($vendorDir . '/respect/validation/library'), 'Resource\\' => array($baseDir . '/src/app/resource'), 'Report\\' => array($baseDir . '/src/app/report'), - 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'), + 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Priority\\' => array($baseDir . '/src/app/priority'), 'Parameter\\' => array($baseDir . '/src/app/parameter'), + 'Nyholm\\Psr7\\' => array($vendorDir . '/nyholm/psr7/src'), 'Notification\\' => array($baseDir . '/src/app/notification'), 'Note\\' => array($baseDir . '/src/app/note'), 'Link\\' => array($baseDir . '/src/app/link'), 'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'), 'Http\\Promise\\' => array($vendorDir . '/php-http/promise/src'), - 'Http\\Message\\MultipartStream\\' => array($vendorDir . '/php-http/multipart-stream-builder/src'), 'Http\\Message\\' => array($vendorDir . '/php-http/message-factory/src', $vendorDir . '/php-http/message/src'), 'Http\\Discovery\\' => array($vendorDir . '/php-http/discovery/src'), 'Http\\Client\\Curl\\' => array($vendorDir . '/php-http/curl-client/src'), - 'Http\\Client\\Common\\' => array($vendorDir . '/php-http/client-common/src'), 'Http\\Client\\' => array($vendorDir . '/php-http/httplug/src'), 'Http\\Adapter\\Guzzle6\\' => array($vendorDir . '/php-http/guzzle6-adapter/src'), 'Home\\' => array($baseDir . '/src/app/home'), @@ -43,7 +43,6 @@ return array( 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), 'Group\\' => array($baseDir . '/src/app/group'), - 'Gitlab\\' => array($vendorDir . '/m4tthumphrey/php-gitlab-api/lib/Gitlab'), 'Folder\\' => array($baseDir . '/src/app/folder'), 'FastRoute\\' => array($vendorDir . '/nikic/fast-route/src'), 'Entity\\' => array($baseDir . '/src/app/entity'), @@ -53,6 +52,7 @@ return array( 'ContentManagement\\' => array($baseDir . '/src/app/contentManagement'), 'Contact\\' => array($baseDir . '/src/app/contact'), 'Clue\\StreamFilter\\' => array($vendorDir . '/clue/stream-filter/src'), + 'Buzz\\' => array($vendorDir . '/kriswallsmith/buzz/lib'), 'Basket\\' => array($baseDir . '/src/app/basket'), 'Attachment\\' => array($baseDir . '/src/app/attachment'), 'Action\\' => array($baseDir . '/src/app/action'), diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index a938c17b69c4b2101921c4ae5fcc1e415c3a3518..f05ec7d06efd69d702bbe45fc4e0a75c46052cb2 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -10,10 +10,10 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', '253c157292f75eb38082b5acb06f3f01' => __DIR__ . '/..' . '/nikic/fast-route/src/functions.php', 'ddc0a4d7e61c0286f0f8593b1903e894' => __DIR__ . '/..' . '/clue/stream-filter/src/functions.php', - '8cff32064859f4559445b89279f3199c' => __DIR__ . '/..' . '/php-http/message/src/filters.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', + '8cff32064859f4559445b89279f3199c' => __DIR__ . '/..' . '/php-http/message/src/filters.php', ); public static $prefixLengthsPsr4 = array ( @@ -56,12 +56,14 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd 'P' => array ( 'Psr\\Http\\Message\\' => 17, + 'Psr\\Http\\Client\\' => 16, 'Psr\\Container\\' => 14, 'Priority\\' => 9, 'Parameter\\' => 10, ), 'N' => array ( + 'Nyholm\\Psr7\\' => 12, 'Notification\\' => 13, 'Note\\' => 5, ), @@ -76,11 +78,9 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd 'H' => array ( 'Http\\Promise\\' => 13, - 'Http\\Message\\MultipartStream\\' => 29, 'Http\\Message\\' => 13, 'Http\\Discovery\\' => 15, 'Http\\Client\\Curl\\' => 17, - 'Http\\Client\\Common\\' => 19, 'Http\\Client\\' => 12, 'Http\\Adapter\\Guzzle6\\' => 21, 'Home\\' => 5, @@ -92,7 +92,6 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd 'GuzzleHttp\\Promise\\' => 19, 'GuzzleHttp\\' => 11, 'Group\\' => 6, - 'Gitlab\\' => 7, ), 'F' => array ( @@ -117,6 +116,7 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd ), 'B' => array ( + 'Buzz\\' => 5, 'Basket\\' => 7, ), 'A' => @@ -190,6 +190,11 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd 'Psr\\Http\\Message\\' => array ( 0 => __DIR__ . '/..' . '/psr/http-message/src', + 1 => __DIR__ . '/..' . '/psr/http-factory/src', + ), + 'Psr\\Http\\Client\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-client/src', ), 'Psr\\Container\\' => array ( @@ -203,6 +208,10 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd array ( 0 => __DIR__ . '/../..' . '/src/app/parameter', ), + 'Nyholm\\Psr7\\' => + array ( + 0 => __DIR__ . '/..' . '/nyholm/psr7/src', + ), 'Notification\\' => array ( 0 => __DIR__ . '/../..' . '/src/app/notification', @@ -223,10 +232,6 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd array ( 0 => __DIR__ . '/..' . '/php-http/promise/src', ), - 'Http\\Message\\MultipartStream\\' => - array ( - 0 => __DIR__ . '/..' . '/php-http/multipart-stream-builder/src', - ), 'Http\\Message\\' => array ( 0 => __DIR__ . '/..' . '/php-http/message-factory/src', @@ -240,10 +245,6 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd array ( 0 => __DIR__ . '/..' . '/php-http/curl-client/src', ), - 'Http\\Client\\Common\\' => - array ( - 0 => __DIR__ . '/..' . '/php-http/client-common/src', - ), 'Http\\Client\\' => array ( 0 => __DIR__ . '/..' . '/php-http/httplug/src', @@ -276,10 +277,6 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd array ( 0 => __DIR__ . '/../..' . '/src/app/group', ), - 'Gitlab\\' => - array ( - 0 => __DIR__ . '/..' . '/m4tthumphrey/php-gitlab-api/lib/Gitlab', - ), 'Folder\\' => array ( 0 => __DIR__ . '/../..' . '/src/app/folder', @@ -316,6 +313,10 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd array ( 0 => __DIR__ . '/..' . '/clue/stream-filter/src', ), + 'Buzz\\' => + array ( + 0 => __DIR__ . '/..' . '/kriswallsmith/buzz/lib', + ), 'Basket\\' => array ( 0 => __DIR__ . '/../..' . '/src/app/basket', @@ -357,6 +358,13 @@ class ComposerStaticInitf21aebccfa6df888200dcb099aa69fbd 0 => __DIR__ . '/..' . '/pimple/pimple/src', ), ), + 'G' => + array ( + 'Gitlab\\' => + array ( + 0 => __DIR__ . '/..' . '/m4tthumphrey/php-gitlab-api/lib', + ), + ), ); public static $classMap = array ( diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 67429495ef7208bfb5c661f7fd3d3c9cedf1d1ee..64a72f8267e57a212bcd964c01fc402f6fa4a765 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -122,131 +122,6 @@ "notification-url": "https://packagist.org/downloads/", "description": "Bare-bones OpenID Connect client" }, - { - "name": "setasign/fpdi", - "version": "v2.0.3", - "version_normalized": "2.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/Setasign/FPDI.git", - "reference": "5998a2f81ae5b4a59eb75ed65e6ec0518163de8d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/5998a2f81ae5b4a59eb75ed65e6ec0518163de8d", - "reference": "5998a2f81ae5b4a59eb75ed65e6ec0518163de8d", - "shasum": "" - }, - "require": { - "ext-zlib": "*", - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "~5.7", - "setasign/fpdf": "~1.8", - "tecnickcom/tcpdf": "~6.2" - }, - "suggest": { - "setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.", - "setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.", - "setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF." - }, - "time": "2018-04-18T13:00:41+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "setasign\\Fpdi\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "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" - } - ], - "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", - "keywords": [ - "fpdf", - "fpdi", - "pdf" - ] - }, - { - "name": "tecnickcom/tcpdf", - "version": "6.2.17", - "version_normalized": "6.2.17.0", - "source": { - "type": "git", - "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "64fc19439863e1b1314487a72a74d9bfd0b55a53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/64fc19439863e1b1314487a72a74d9bfd0b55a53", - "reference": "64fc19439863e1b1314487a72a74d9bfd0b55a53", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2018-02-24T11:48:20+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "config", - "include", - "tcpdf.php", - "tcpdf_parser.php", - "tcpdf_import.php", - "tcpdf_barcodes_1d.php", - "tcpdf_barcodes_2d.php", - "include/tcpdf_colors.php", - "include/tcpdf_filters.php", - "include/tcpdf_font_data.php", - "include/tcpdf_fonts.php", - "include/tcpdf_images.php", - "include/tcpdf_static.php", - "include/barcodes/datamatrix.php", - "include/barcodes/pdf417.php", - "include/barcodes/qrcode.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Nicola Asuni", - "email": "info@tecnick.com", - "role": "lead" - } - ], - "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", - "homepage": "http://www.tcpdf.org/", - "keywords": [ - "PDFD32000-2008", - "TCPDF", - "barcodes", - "datamatrix", - "pdf", - "pdf417", - "qrcode" - ] - }, { "name": "setasign/fpdi-tcpdf", "version": "v2.0.0", @@ -525,41 +400,45 @@ ] }, { - "name": "slim/slim", - "version": "3.10.0", - "version_normalized": "3.10.0.0", + "name": "php-http/discovery", + "version": "1.4.0", + "version_normalized": "1.4.0.0", "source": { "type": "git", - "url": "https://github.com/slimphp/Slim.git", - "reference": "d8aabeacc3688b25e2f2dd2db91df91ec6fdd748" + "url": "https://github.com/php-http/discovery.git", + "reference": "9a6cb24de552bfe1aa9d7d1569e2d49c5b169a33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/d8aabeacc3688b25e2f2dd2db91df91ec6fdd748", - "reference": "d8aabeacc3688b25e2f2dd2db91df91ec6fdd748", + "url": "https://api.github.com/repos/php-http/discovery/zipball/9a6cb24de552bfe1aa9d7d1569e2d49c5b169a33", + "reference": "9a6cb24de552bfe1aa9d7d1569e2d49c5b169a33", "shasum": "" }, "require": { - "container-interop/container-interop": "^1.2", - "nikic/fast-route": "^1.0", - "php": ">=5.5.0", - "pimple/pimple": "^3.0", - "psr/container": "^1.0", - "psr/http-message": "^1.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" + "php": "^5.5 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.0", - "squizlabs/php_codesniffer": "^2.5" + "henrikbjorn/phpspec-code-coverage": "^2.0.2", + "php-http/httplug": "^1.0", + "php-http/message-factory": "^1.0", + "phpspec/phpspec": "^2.4", + "puli/composer-plugin": "1.0.0-beta10" + }, + "suggest": { + "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories", + "puli/composer-plugin": "Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details." }, - "time": "2018-04-19T19:29:08+00:00", + "time": "2018-02-06T10:55:24+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, "installation-source": "dist", "autoload": { "psr-4": { - "Slim\\": "Slim" + "Http\\Discovery\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -568,70 +447,52 @@ ], "authors": [ { - "name": "Rob Allen", - "email": "rob@akrabat.com", - "homepage": "http://akrabat.com" - }, - { - "name": "Josh Lockhart", - "email": "hello@joshlockhart.com", - "homepage": "https://joshlockhart.com" - }, - { - "name": "Gabriel Manricks", - "email": "gmanricks@me.com", - "homepage": "http://gabrielmanricks.com" - }, - { - "name": "Andrew Smith", - "email": "a.smith@silentworks.co.uk", - "homepage": "http://silentworks.co.uk" + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" } ], - "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", - "homepage": "https://slimframework.com", + "description": "Finds installed HTTPlug implementations and PSR-7 message factories", + "homepage": "http://php-http.org", "keywords": [ - "api", - "framework", - "micro", - "router" + "adapter", + "client", + "discovery", + "factory", + "http", + "message", + "psr7" ] }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", - "version_normalized": "1.8.0.0", + "name": "clue/stream-filter", + "version": "v1.4.0", + "version_normalized": "1.4.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "url": "https://github.com/clue/php-stream-filter.git", + "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0", + "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3" }, - "suggest": { - "ext-mbstring": "For best performance" + "require-dev": { + "phpunit/phpunit": "^5.0 || ^4.8" }, - "time": "2018-04-26T10:06:28+00:00", + "time": "2017-08-18T09:54:01+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Clue\\StreamFilter\\": "src/" }, "files": [ - "bootstrap.php" + "src/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -640,232 +501,47 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Christian Lück", + "email": "christian@lueck.tv" } ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", + "description": "A simple and modern approach to stream filtering in PHP", + "homepage": "https://github.com/clue/php-stream-filter", "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" + "bucket brigade", + "callback", + "filter", + "php_user_filter", + "stream", + "stream_filter_append", + "stream_filter_register" ] }, { - "name": "respect/validation", - "version": "1.1.19", - "version_normalized": "1.1.19.0", + "name": "php-http/message-factory", + "version": "v1.0.2", + "version_normalized": "1.0.2.0", "source": { "type": "git", - "url": "https://github.com/Respect/Validation.git", - "reference": "667ed36b4868e785d52d815181ff00c798a61be7" + "url": "https://github.com/php-http/message-factory.git", + "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Respect/Validation/zipball/667ed36b4868e785d52d815181ff00c798a61be7", - "reference": "667ed36b4868e785d52d815181ff00c798a61be7", + "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1", + "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1", "shasum": "" }, "require": { "php": ">=5.4", - "symfony/polyfill-mbstring": "^1.2" + "psr/http-message": "^1.0" }, - "require-dev": { - "egulias/email-validator": "~1.2", - "mikey179/vfsstream": "^1.5", - "phpunit/phpunit": "~4.0", - "symfony/validator": "~2.6.9", - "zendframework/zend-validator": "~2.3" - }, - "suggest": { - "egulias/email-validator": "Strict (RFC compliant) email validation", - "ext-bcmath": "Arbitrary Precision Mathematics", - "ext-mbstring": "Multibyte String Functions", - "friendsofphp/php-cs-fixer": "Fix PSR2 and other coding style issues", - "symfony/validator": "Use Symfony validator through Respect\\Validation", - "zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation" - }, - "time": "2018-07-02T06:22:41+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Respect\\Validation\\": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD Style" - ], - "authors": [ - { - "name": "Respect/Validation Contributors", - "homepage": "https://github.com/Respect/Validation/graphs/contributors" - } - ], - "description": "The most awesome validation engine ever created for PHP", - "homepage": "http://respect.github.io/Validation/", - "keywords": [ - "respect", - "validation", - "validator" - ] - }, - { - "name": "php-http/discovery", - "version": "1.4.0", - "version_normalized": "1.4.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-http/discovery.git", - "reference": "9a6cb24de552bfe1aa9d7d1569e2d49c5b169a33" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/9a6cb24de552bfe1aa9d7d1569e2d49c5b169a33", - "reference": "9a6cb24de552bfe1aa9d7d1569e2d49c5b169a33", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0" - }, - "require-dev": { - "henrikbjorn/phpspec-code-coverage": "^2.0.2", - "php-http/httplug": "^1.0", - "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^2.4", - "puli/composer-plugin": "1.0.0-beta10" - }, - "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories", - "puli/composer-plugin": "Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details." - }, - "time": "2018-02-06T10:55:24+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Http\\Discovery\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "description": "Finds installed HTTPlug implementations and PSR-7 message factories", - "homepage": "http://php-http.org", - "keywords": [ - "adapter", - "client", - "discovery", - "factory", - "http", - "message", - "psr7" - ] - }, - { - "name": "clue/stream-filter", - "version": "v1.4.0", - "version_normalized": "1.4.0.0", - "source": { - "type": "git", - "url": "https://github.com/clue/php-stream-filter.git", - "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0", - "reference": "d80fdee9b3a7e0d16fc330a22f41f3ad0eeb09d0", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "require-dev": { - "phpunit/phpunit": "^5.0 || ^4.8" - }, - "time": "2017-08-18T09:54:01+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Clue\\StreamFilter\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christian Lück", - "email": "christian@lueck.tv" - } - ], - "description": "A simple and modern approach to stream filtering in PHP", - "homepage": "https://github.com/clue/php-stream-filter", - "keywords": [ - "bucket brigade", - "callback", - "filter", - "php_user_filter", - "stream", - "stream_filter_append", - "stream_filter_register" - ] - }, - { - "name": "php-http/message-factory", - "version": "v1.0.2", - "version_normalized": "1.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/php-http/message-factory.git", - "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/message-factory/zipball/a478cb11f66a6ac48d8954216cfed9aa06a501a1", - "reference": "a478cb11f66a6ac48d8954216cfed9aa06a501a1", - "shasum": "" - }, - "require": { - "php": ">=5.4", - "psr/http-message": "^1.0" - }, - "time": "2015-12-19T14:08:53+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } + "time": "2015-12-19T14:08:53+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } }, "installation-source": "dist", "autoload": { @@ -893,80 +569,6 @@ "uri" ] }, - { - "name": "php-http/message", - "version": "1.6.0", - "version_normalized": "1.6.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-http/message.git", - "reference": "2edd63bae5f52f79363c5f18904b05ce3a4b7253" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/2edd63bae5f52f79363c5f18904b05ce3a4b7253", - "reference": "2edd63bae5f52f79363c5f18904b05ce3a4b7253", - "shasum": "" - }, - "require": { - "clue/stream-filter": "^1.3", - "php": ">=5.4", - "php-http/message-factory": "^1.0.2", - "psr/http-message": "^1.0" - }, - "provide": { - "php-http/message-factory-implementation": "1.0" - }, - "require-dev": { - "akeneo/phpspec-skip-example-extension": "^1.0", - "coduo/phpspec-data-provider-extension": "^1.0", - "ext-zlib": "*", - "guzzlehttp/psr7": "^1.0", - "henrikbjorn/phpspec-code-coverage": "^1.0", - "phpspec/phpspec": "^2.4", - "slim/slim": "^3.0", - "zendframework/zend-diactoros": "^1.0" - }, - "suggest": { - "ext-zlib": "Used with compressor/decompressor streams", - "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories", - "slim/slim": "Used with Slim Framework PSR-7 implementation", - "zendframework/zend-diactoros": "Used with Diactoros Factories" - }, - "time": "2017-07-05T06:40:53+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Http\\Message\\": "src/" - }, - "files": [ - "src/filters.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "description": "HTTP Message related tools", - "homepage": "http://php-http.org", - "keywords": [ - "http", - "message", - "psr-7" - ] - }, { "name": "php-http/promise", "version": "v1.0.0", @@ -1548,27 +1150,27 @@ }, { "name": "symfony/options-resolver", - "version": "v3.4.13", - "version_normalized": "3.4.13.0", + "version": "v4.1.6", + "version_normalized": "4.1.6.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "638f5ad40a6400d78568187522731e5643eed60a" + "reference": "40f0e40d37c1c8a762334618dea597d64bbb75ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/638f5ad40a6400d78568187522731e5643eed60a", - "reference": "638f5ad40a6400d78568187522731e5643eed60a", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/40f0e40d37c1c8a762334618dea597d64bbb75ff", + "reference": "40f0e40d37c1c8a762334618dea597d64bbb75ff", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, - "time": "2018-07-07T15:09:44+00:00", + "time": "2018-09-18T12:45:12+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } }, "installation-source": "dist", @@ -1603,42 +1205,35 @@ ] }, { - "name": "php-http/multipart-stream-builder", - "version": "1.0.0", - "version_normalized": "1.0.0.0", + "name": "psr/http-client", + "version": "0.1.0", + "version_normalized": "0.1.0.0", "source": { "type": "git", - "url": "https://github.com/php-http/multipart-stream-builder.git", - "reference": "1fa3c623fc813a43b39494b2a1612174e36e0fb0" + "url": "https://github.com/php-fig/http-client.git", + "reference": "d4d3ec04b034120b0591ad9722a4c2be33a7dfec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/multipart-stream-builder/zipball/1fa3c623fc813a43b39494b2a1612174e36e0fb0", - "reference": "1fa3c623fc813a43b39494b2a1612174e36e0fb0", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/d4d3ec04b034120b0591ad9722a4c2be33a7dfec", + "reference": "d4d3ec04b034120b0591ad9722a4c2be33a7dfec", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "php-http/discovery": "^1.0", - "php-http/message-factory": "^1.0.2", + "php": "^7.0", "psr/http-message": "^1.0" }, - "require-dev": { - "php-http/message": "^1.5", - "phpunit/phpunit": "^4.8 || ^5.4", - "zendframework/zend-diactoros": "^1.3.5" - }, - "time": "2017-05-21T17:45:25+00:00", + "time": "2018-02-03T12:55:20+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "0.3-dev" + "dev-master": "1.0.x-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Http\\Message\\MultipartStream\\": "src/" + "Psr\\Http\\Client\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1647,62 +1242,114 @@ ], "authors": [ { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com" + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" } ], - "description": "A builder class that help you create a multipart stream", - "homepage": "http://php-http.org", + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ] + }, + { + "name": "psr/http-factory", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/378bfe27931ecc54ff824a20d6f6bfc303bbd04c", + "reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "time": "2018-07-30T21:54:04+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", "keywords": [ "factory", "http", "message", - "multipart stream", - "stream" + "psr", + "psr-17", + "psr-7", + "request", + "response" ] }, { - "name": "php-http/client-common", - "version": "1.7.0", - "version_normalized": "1.7.0.0", + "name": "nyholm/psr7", + "version": "1.0.1", + "version_normalized": "1.0.1.0", "source": { "type": "git", - "url": "https://github.com/php-http/client-common.git", - "reference": "9accb4a082eb06403747c0ffd444112eda41a0fd" + "url": "https://github.com/Nyholm/psr7.git", + "reference": "02a20d5e9241daefd68935f7a43d9a7a8b4b6277" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/9accb4a082eb06403747c0ffd444112eda41a0fd", - "reference": "9accb4a082eb06403747c0ffd444112eda41a0fd", + "url": "https://api.github.com/repos/Nyholm/psr7/zipball/02a20d5e9241daefd68935f7a43d9a7a8b4b6277", + "reference": "02a20d5e9241daefd68935f7a43d9a7a8b4b6277", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0", - "php-http/httplug": "^1.1", - "php-http/message": "^1.6", + "php": "^7.1", "php-http/message-factory": "^1.0", - "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0" }, - "require-dev": { - "guzzlehttp/psr7": "^1.4", - "phpspec/phpspec": "^2.5 || ^3.4 || ^4.2" + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" }, - "suggest": { - "php-http/cache-plugin": "PSR-6 Cache plugin", - "php-http/logger-plugin": "PSR-3 Logger plugin", - "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" + "require-dev": { + "http-interop/http-factory-tests": "dev-master", + "php-http/psr7-integration-tests": "dev-master", + "phpunit/phpunit": "^7.0" }, - "time": "2017-11-30T11:06:59+00:00", + "time": "2018-09-02T11:50:33+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "1.0-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Http\\Client\\Common\\": "src/" + "Nyholm\\Psr7\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1711,61 +1358,122 @@ ], "authors": [ { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com" + }, + { + "name": "Martijn van der Ven", + "email": "martijn@vanderven.se" } ], - "description": "Common HTTP Client implementations and tools for HTTPlug", - "homepage": "http://httplug.io", + "description": "A fast PHP7 implementation of PSR-7", + "homepage": "http://tnyholm.se", "keywords": [ - "client", - "common", - "http", - "httplug" + "psr-17", + "psr-7" + ] + }, + { + "name": "kriswallsmith/buzz", + "version": "0.17.2", + "version_normalized": "0.17.2.0", + "source": { + "type": "git", + "url": "https://github.com/kriswallsmith/Buzz.git", + "reference": "0d7e985003f074fca0ceb00bf2f650d749ae9710" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kriswallsmith/Buzz/zipball/0d7e985003f074fca0ceb00bf2f650d749ae9710", + "reference": "0d7e985003f074fca0ceb00bf2f650d749ae9710", + "shasum": "" + }, + "require": { + "nyholm/psr7": "^1.0", + "php": "^7.1", + "php-http/httplug": "^1.1", + "psr/http-client": "^0.1", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "symfony/options-resolver": "^3.4 || ^4.0" + }, + "conflict": { + "http-interop/http-factory": "<0.4.1" + }, + "provide": { + "php-http/client-implementation": "1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.11", + "php-http/client-integration-tests": "^0.6.2", + "phpunit/phpunit": "^6.5.7", + "psr/log": "^1.0", + "symfony/phpunit-bridge": "^4.0" + }, + "suggest": { + "ext-curl": "*" + }, + "time": "2018-09-05T17:20:52+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Buzz\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kris Wallsmith", + "email": "kris.wallsmith@gmail.com", + "homepage": "http://kriswallsmith.net/" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "http://tnyholm.se/" + } + ], + "description": "Lightweight HTTP client", + "homepage": "https://github.com/kriswallsmith/Buzz", + "keywords": [ + "curl", + "http client" ] }, { "name": "m4tthumphrey/php-gitlab-api", - "version": "9.5.0", - "version_normalized": "9.5.0.0", + "version": "8.0.0", + "version_normalized": "8.0.0.0", "source": { "type": "git", "url": "https://github.com/m4tthumphrey/php-gitlab-api.git", - "reference": "010fe9fbf415ee0563f0f892ffa9363d1fb890ab" + "reference": "51242d88b68d30a0f17662e481e96561bcf846d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/m4tthumphrey/php-gitlab-api/zipball/010fe9fbf415ee0563f0f892ffa9363d1fb890ab", - "reference": "010fe9fbf415ee0563f0f892ffa9363d1fb890ab", + "url": "https://api.github.com/repos/m4tthumphrey/php-gitlab-api/zipball/51242d88b68d30a0f17662e481e96561bcf846d0", + "reference": "51242d88b68d30a0f17662e481e96561bcf846d0", "shasum": "" }, "require": { + "ext-curl": "*", "ext-xml": "*", - "php": "^5.6 || ^7.0", - "php-http/client-common": "^1.5", - "php-http/client-implementation": "^1.0", - "php-http/discovery": "^1.2", - "php-http/httplug": "^1.1", - "php-http/multipart-stream-builder": "^1.0", - "symfony/options-resolver": "^2.6 || ^3.0" + "kriswallsmith/buzz": ">=0.7", + "php": ">=5.3.2" }, "require-dev": { - "guzzlehttp/psr7": "^1.2", - "php-http/guzzle6-adapter": "^1.0", - "php-http/mock-client": "^1.0", "phpunit/phpunit": "~4.5" }, - "time": "2017-10-11T08:57:20+00:00", + "time": "2017-06-06T07:40:46+00:00", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.0.x-dev" - } - }, "installation-source": "dist", "autoload": { - "psr-4": { - "Gitlab\\": "lib/Gitlab/" + "psr-0": { + "Gitlab\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1793,5 +1501,405 @@ "api", "gitlab" ] + }, + { + "name": "slim/slim", + "version": "3.11.0", + "version_normalized": "3.11.0.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "d378e70431e78ee92ee32ddde61ecc72edf5dc0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/d378e70431e78ee92ee32ddde61ecc72edf5dc0a", + "reference": "d378e70431e78ee92ee32ddde61ecc72edf5dc0a", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.2", + "nikic/fast-route": "^1.0", + "php": ">=5.5.0", + "pimple/pimple": "^3.0", + "psr/container": "^1.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.5" + }, + "time": "2018-09-16T10:54:21+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Slim\\": "Slim" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + } + ], + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "homepage": "https://slimframework.com", + "keywords": [ + "api", + "framework", + "micro", + "router" + ] + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "time": "2018-09-21T13:07:52+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "installation-source": "dist", + "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" + ] + }, + { + "name": "respect/validation", + "version": "1.1.28", + "version_normalized": "1.1.28.0", + "source": { + "type": "git", + "url": "https://github.com/Respect/Validation.git", + "reference": "48b06254c4af1a2d6c1715eb3a2bb3cb72e08bfc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Respect/Validation/zipball/48b06254c4af1a2d6c1715eb3a2bb3cb72e08bfc", + "reference": "48b06254c4af1a2d6c1715eb3a2bb3cb72e08bfc", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "symfony/polyfill-mbstring": "^1.2" + }, + "require-dev": { + "egulias/email-validator": "~1.2 || ~2.1", + "mikey179/vfsstream": "^1.5", + "phpunit/phpunit": "~4.0", + "symfony/validator": "~2.6.9", + "zendframework/zend-validator": "~2.3" + }, + "suggest": { + "egulias/email-validator": "Strict (RFC compliant) email validation", + "ext-bcmath": "Arbitrary Precision Mathematics", + "ext-mbstring": "Multibyte String Functions", + "friendsofphp/php-cs-fixer": "Fix PSR2 and other coding style issues", + "symfony/validator": "Use Symfony validator through Respect\\Validation", + "zendframework/zend-validator": "Use Zend Framework validator through Respect\\Validation" + }, + "time": "2018-10-11T12:18:10+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Respect\\Validation\\": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Respect/Validation Contributors", + "homepage": "https://github.com/Respect/Validation/graphs/contributors" + } + ], + "description": "The most awesome validation engine ever created for PHP", + "homepage": "http://respect.github.io/Validation/", + "keywords": [ + "respect", + "validation", + "validator" + ] + }, + { + "name": "setasign/fpdi", + "version": "v2.1.0", + "version_normalized": "2.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/Setasign/FPDI.git", + "reference": "99a3181db556020fafa8f4d416120d8d14dee2ee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Setasign/FPDI/zipball/99a3181db556020fafa8f4d416120d8d14dee2ee", + "reference": "99a3181db556020fafa8f4d416120d8d14dee2ee", + "shasum": "" + }, + "require": { + "ext-zlib": "*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "~5.7", + "setasign/fpdf": "~1.8", + "setasign/tfpdf": "1.25", + "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.", + "setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.", + "setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF.", + "setasign/fpdi-tfpdf": "Use this package to automatically evaluate dependencies to tFPDF." + }, + "time": "2018-09-13T14:55:17+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "setasign\\Fpdi\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "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" + } + ], + "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", + "keywords": [ + "fpdf", + "fpdi", + "pdf" + ] + }, + { + "name": "tecnickcom/tcpdf", + "version": "6.2.26", + "version_normalized": "6.2.26.0", + "source": { + "type": "git", + "url": "https://github.com/tecnickcom/TCPDF.git", + "reference": "367241059ca166e3a76490f4448c284e0a161f15" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/367241059ca166e3a76490f4448c284e0a161f15", + "reference": "367241059ca166e3a76490f4448c284e0a161f15", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2018-10-16T17:24:05+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "config", + "include", + "tcpdf.php", + "tcpdf_parser.php", + "tcpdf_import.php", + "tcpdf_barcodes_1d.php", + "tcpdf_barcodes_2d.php", + "include/tcpdf_colors.php", + "include/tcpdf_filters.php", + "include/tcpdf_font_data.php", + "include/tcpdf_fonts.php", + "include/tcpdf_images.php", + "include/tcpdf_static.php", + "include/barcodes/datamatrix.php", + "include/barcodes/pdf417.php", + "include/barcodes/qrcode.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", + "homepage": "http://www.tcpdf.org/", + "keywords": [ + "PDFD32000-2008", + "TCPDF", + "barcodes", + "datamatrix", + "pdf", + "pdf417", + "qrcode" + ] + }, + { + "name": "php-http/message", + "version": "1.7.2", + "version_normalized": "1.7.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/message.git", + "reference": "b159ffe570dffd335e22ef0b91a946eacb182fa1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/message/zipball/b159ffe570dffd335e22ef0b91a946eacb182fa1", + "reference": "b159ffe570dffd335e22ef0b91a946eacb182fa1", + "shasum": "" + }, + "require": { + "clue/stream-filter": "^1.4", + "php": "^5.4 || ^7.0", + "php-http/message-factory": "^1.0.2", + "psr/http-message": "^1.0" + }, + "provide": { + "php-http/message-factory-implementation": "1.0" + }, + "require-dev": { + "akeneo/phpspec-skip-example-extension": "^1.0", + "coduo/phpspec-data-provider-extension": "^1.0", + "ext-zlib": "*", + "guzzlehttp/psr7": "^1.0", + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4", + "slim/slim": "^3.0", + "zendframework/zend-diactoros": "^1.0" + }, + "suggest": { + "ext-zlib": "Used with compressor/decompressor streams", + "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories", + "slim/slim": "Used with Slim Framework PSR-7 implementation", + "zendframework/zend-diactoros": "Used with Diactoros Factories" + }, + "time": "2018-11-01T09:32:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Http\\Message\\": "src/" + }, + "files": [ + "src/filters.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "HTTP Message related tools", + "homepage": "http://php-http.org", + "keywords": [ + "http", + "message", + "psr-7" + ] } ] diff --git a/vendor/m4tthumphrey/php-gitlab-api/composer.json b/vendor/m4tthumphrey/php-gitlab-api/composer.json index 95c90732d39b8a245dfa44f952a4723880e39dc7..3c29600a42e14fbb5dac57b501e7b2af759ab425 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/composer.json +++ b/vendor/m4tthumphrey/php-gitlab-api/composer.json @@ -1,50 +1,35 @@ -{ - "name": "m4tthumphrey/php-gitlab-api", - "type": "library", - "description": "GitLab API client", - "homepage": "https://github.com/m4tthumphrey/php-gitlab-api", - "keywords": ["gitlab", "api"], - "license": "MIT", - "authors": [ - { - "name": "Matt Humphrey", - "homepage": "http://m4tt.io" - }, - { - "name": "KnpLabs Team", - "homepage": "http://knplabs.com" - }, - { - "name": "Thibault Duplessis", - "email": "thibault.duplessis@gmail.com", - "homepage": "http://ornicar.github.com" - } - ], - "require": { - "php": "^5.6 || ^7.0", - "ext-xml": "*", - "php-http/client-common": "^1.5", - "php-http/client-implementation": "^1.0", - "php-http/discovery": "^1.2", - "php-http/httplug": "^1.1", - "php-http/multipart-stream-builder": "^1.0", - "symfony/options-resolver": "^2.6 || ^3.0" - }, - "require-dev": { - "guzzlehttp/psr7": "^1.2", - "php-http/guzzle6-adapter": "^1.0", - "php-http/mock-client": "^1.0", - "phpunit/phpunit": "~4.5" - }, - "autoload": { - "psr-4": { "Gitlab\\": "lib/Gitlab/" } - }, - "autoload-dev": { - "psr-4": { "Gitlab\\Tests\\": "test/Gitlab/Tests/" } - }, - "extra": { - "branch-alias": { - "dev-master": "9.0.x-dev" - } - } -} +{ + "name": "m4tthumphrey/php-gitlab-api", + "type": "library", + "description": "GitLab API client", + "homepage": "https://github.com/m4tthumphrey/php-gitlab-api", + "keywords": ["gitlab", "api"], + "license": "MIT", + "authors": [ + { + "name": "Matt Humphrey", + "homepage": "http://m4tt.io" + }, + { + "name": "KnpLabs Team", + "homepage": "http://knplabs.com" + }, + { + "name": "Thibault Duplessis", + "email": "thibault.duplessis@gmail.com", + "homepage": "http://ornicar.github.com" + } + ], + "require": { + "php": ">=5.3.2", + "ext-curl": "*", + "ext-xml": "*", + "kriswallsmith/buzz": ">=0.7" + }, + "require-dev": { + "phpunit/phpunit": "~4.5" + }, + "autoload": { + "psr-0": { "Gitlab\\": "lib/" } + } +} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/AbstractApi.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/AbstractApi.php index ef9120a20d0fe1b9926d1541d773d5214676dabd..d6e3ab723c6db3c3e50718c38285ad16329f8f96 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/AbstractApi.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/AbstractApi.php @@ -1,14 +1,6 @@ <?php namespace Gitlab\Api; use Gitlab\Client; -use Gitlab\HttpClient\Message\QueryStringBuilder; -use Gitlab\HttpClient\Message\ResponseMediator; -use Gitlab\Tests\HttpClient\Message\QueryStringBuilderTest; -use Http\Discovery\StreamFactoryDiscovery; -use Http\Message\MultipartStream\MultipartStreamBuilder; -use Http\Message\StreamFactory; -use Psr\Http\Message\ResponseInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; /** * Abstract class for Api classes @@ -19,6 +11,11 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ abstract class AbstractApi implements ApiInterface { + /** + * Default entries per page + */ + const PER_PAGE = 20; + /** * The client * @@ -26,19 +23,12 @@ abstract class AbstractApi implements ApiInterface */ protected $client; - /** - * @var StreamFactory - */ - private $streamFactory; - /** * @param Client $client - * @param StreamFactory|null $streamFactory */ - public function __construct(Client $client, StreamFactory $streamFactory = null) + public function __construct(Client $client) { $this->client = $client; - $this->streamFactory = $streamFactory ?: StreamFactoryDiscovery::find(); } /** @@ -51,69 +41,43 @@ abstract class AbstractApi implements ApiInterface } /** - * Performs a GET query and returns the response as a PSR-7 response object. - * * @param string $path * @param array $parameters * @param array $requestHeaders - * @return ResponseInterface + * @return mixed */ - protected function getAsResponse($path, array $parameters = array(), $requestHeaders = array()) + protected function get($path, array $parameters = array(), $requestHeaders = array()) { - $path = $this->preparePath($path, $parameters); + $response = $this->client->getHttpClient()->get($path, $parameters, $requestHeaders); - return $this->client->getHttpClient()->get($path, $requestHeaders); + return $response->getContent(); } /** * @param string $path * @param array $parameters * @param array $requestHeaders + * @param array $files * @return mixed */ - protected function get($path, array $parameters = array(), $requestHeaders = array()) + protected function post($path, array $parameters = array(), $requestHeaders = array(), array $files = array()) { - return ResponseMediator::getContent($this->getAsResponse($path, $parameters, $requestHeaders)); + $response = $this->client->getHttpClient()->post($path, $parameters, $requestHeaders, $files); + + return $response->getContent(); } /** * @param string $path * @param array $parameters * @param array $requestHeaders - * @param array $files * @return mixed */ - protected function post($path, array $parameters = array(), $requestHeaders = array(), array $files = array()) + protected function patch($path, array $parameters = array(), $requestHeaders = array()) { - $path = $this->preparePath($path); - - $body = null; - if (empty($files) && !empty($parameters)) { - $body = $this->streamFactory->createStream(QueryStringBuilder::build($parameters)); - $requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; - } elseif (!empty($files)) { - $builder = new MultipartStreamBuilder($this->streamFactory); - - foreach ($parameters as $name => $value) { - $builder->addResource($name, $value); - } - - foreach ($files as $name => $file) { - $builder->addResource($name, fopen($file, 'r'), [ - 'headers' => [ - 'Content-Type' => $this->guessContentType($file), - ], - 'filename' => basename($file), - ]); - } - - $body = $builder->build(); - $requestHeaders['Content-Type'] = 'multipart/form-data; boundary='.$builder->getBoundary(); - } - - $response = $this->client->getHttpClient()->post($path, $requestHeaders, $body); - - return ResponseMediator::getContent($response); + $response = $this->client->getHttpClient()->patch($path, $parameters, $requestHeaders); + + return $response->getContent(); } /** @@ -124,17 +88,9 @@ abstract class AbstractApi implements ApiInterface */ protected function put($path, array $parameters = array(), $requestHeaders = array()) { - $path = $this->preparePath($path); - - $body = null; - if (!empty($parameters)) { - $body = $this->streamFactory->createStream(http_build_query($parameters)); - $requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded'; - } + $response = $this->client->getHttpClient()->put($path, $parameters, $requestHeaders); - $response = $this->client->getHttpClient()->put($path, $requestHeaders, $body); - - return ResponseMediator::getContent($response); + return $response->getContent(); } /** @@ -145,11 +101,9 @@ abstract class AbstractApi implements ApiInterface */ protected function delete($path, array $parameters = array(), $requestHeaders = array()) { - $path = $this->preparePath($path, $parameters); - - $response = $this->client->getHttpClient()->delete($path, $requestHeaders); + $response = $this->client->getHttpClient()->delete($path, $parameters, $requestHeaders); - return ResponseMediator::getContent($response); + return $response->getContent(); } /** @@ -172,52 +126,4 @@ abstract class AbstractApi implements ApiInterface return str_replace('.', '%2E', $path); } - - /** - * Create a new OptionsResolver with page and per_page options. - * - * @return OptionsResolver - */ - protected function createOptionsResolver() - { - $resolver = new OptionsResolver(); - $resolver->setDefined('page') - ->setAllowedTypes('page', 'int') - ->setAllowedValues('page', function ($value) { - return $value > 0; - }) - ; - $resolver->setDefined('per_page') - ->setAllowedTypes('per_page', 'int') - ->setAllowedValues('per_page', function ($value) { - return $value > 0 && $value <= 100; - }) - ; - - return $resolver; - } - - private function preparePath($path, array $parameters = []) - { - if (count($parameters) > 0) { - $path .= '?'.QueryStringBuilder::build($parameters); - } - - return $path; - } - - /** - * @param $file - * - * @return string - */ - private function guessContentType($file) - { - if (!class_exists(\finfo::class, false)) { - return 'application/octet-stream'; - } - $finfo = new \finfo(FILEINFO_MIME_TYPE); - - return $finfo->file($file); - } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/DeployKeys.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/DeployKeys.php index 32e0a82cbd02a10563325903160bd3ac2728e049..f7e2a39d5f5d451a5b6e40887e41f52c6ed74b31 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/DeployKeys.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/DeployKeys.php @@ -2,15 +2,23 @@ class DeployKeys extends AbstractApi { + const ORDER_BY = 'id'; + const SORT = 'asc'; + /** - * @param array $parameters - * + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort * @return mixed */ - public function all(array $parameters = []) + public function all($page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) { - $resolver = $this->createOptionsResolver(); - - return $this->get('deploy_keys', $resolver->resolve($parameters)); + return $this->get('deploy_keys', array( + 'page' => $page, + 'per_page' => $per_page, + 'order_by' => $order_by, + 'sort' => $sort + )); } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Groups.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Groups.php index 94484ead527f601d976ed732e52e778c5f3271dc..4ec574d64cdad22147dfc9266c44c7fbfbd21bf9 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Groups.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Groups.php @@ -3,52 +3,30 @@ class Groups extends AbstractApi { /** - * @param array $parameters ( - * - * @var int[] $skip_groups Skip the group IDs passes. - * @var bool $all_available Show all the groups you have access to. - * @var string $search Return list of authorized groups matching the search criteria. - * @var string $order_by Order groups by name or path. Default is name. - * @var string $sort Order groups in asc or desc order. Default is asc. - * @var bool $statistics Include group statistics (admins only). - * @var bool $owned Limit by groups owned by the current user. - * ) + * @param int $page + * @param int $per_page * @return mixed */ - public function all(array $parameters = []) + public function all($page = 1, $per_page = self::PER_PAGE) { - $resolver = $this->createOptionsResolver(); - $booleanNormalizer = function ($value) { - return $value ? 'true' : 'false'; - }; - - $resolver->setDefined('skip_groups') - ->setAllowedTypes('skip_groups', 'array') - ->setAllowedValues('skip_groups', function (array $value) { - return count($value) == count(array_filter($value, 'is_int')); - }) - ; - $resolver->setDefined('all_available') - ->setAllowedTypes('all_available', 'bool') - ->setNormalizer('all_available', $booleanNormalizer) - ; - $resolver->setDefined('search'); - $resolver->setDefined('order_by') - ->setAllowedValues('order_by', ['name', 'path']) - ; - $resolver->setDefined('sort') - ->setAllowedValues('sort', ['asc', 'desc']) - ; - $resolver->setDefined('statistics') - ->setAllowedTypes('statistics', 'bool') - ->setNormalizer('statistics', $booleanNormalizer) - ; - $resolver->setDefined('owned') - ->setAllowedTypes('owned', 'bool') - ->setNormalizer('owned', $booleanNormalizer) - ; + return $this->get('groups', array( + 'page' => $page, + 'per_page' => $per_page + )); + } - return $this->get('groups', $resolver->resolve($parameters)); + /** + * @param string $query + * @param int $page + * @param int $per_page + * @return mixed + */ + public function search($query, $page = 1, $per_page = self::PER_PAGE) + { + return $this->get('groups?search='.$this->encodePath($query), array( + 'page' => $page, + 'per_page' => $per_page + )); } /** @@ -64,16 +42,15 @@ class Groups extends AbstractApi * @param string $name * @param string $path * @param string $description - * @param string $visibility * @return mixed */ - public function create($name, $path, $description = null, $visibility = 'private') + public function create($name, $path, $description = null, $visibility_level = 0) { return $this->post('groups', array( 'name' => $name, 'path' => $path, 'description' => $description, - 'visibility' => $visibility, + 'visibility_level' => $visibility_level )); } @@ -107,20 +84,17 @@ class Groups extends AbstractApi } /** - * @param int $id - * @param array $parameters ( - * - * @var string $query A query string to search for members. - * ) - * + * @param int $id + * @param int $page + * @param int $per_page * @return mixed */ - public function members($id, array $parameters = []) + public function members($id, $page = 1, $per_page = self::PER_PAGE) { - $resolver = $this->createOptionsResolver(); - $resolver->setDefined('query'); - - return $this->get('groups/'.$this->encodePath($id).'/members', $resolver->resolve($parameters)); + return $this->get('groups/'.$this->encodePath($id).'/members', array( + 'page' => $page, + 'per_page' => $per_page + )); } /** @@ -162,55 +136,15 @@ class Groups extends AbstractApi /** * @param $id - * @param array $parameters ( - * - * @var bool $archived Limit by archived status. - * @var string $visibility Limit by visibility public, internal, or private. - * @var string $order_by Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields. - * Default is created_at. - * @var string $sort Return projects sorted in asc or desc order. Default is desc. - * @var string $search Return list of authorized projects matching the search criteria. - * @var bool $simple Return only the ID, URL, name, and path of each project. - * @var bool $owned Limit by projects owned by the current user. - * @var bool $starred Limit by projects starred by the current user. - * ) - * + * @param int $page + * @param int $per_page * @return mixed */ - public function projects($id, array $parameters = []) + public function projects($id, $page = 1, $per_page = self::PER_PAGE) { - $resolver = $this->createOptionsResolver(); - $booleanNormalizer = function ($value) { - return $value ? 'true' : 'false'; - }; - - $resolver->setDefined('archived') - ->setAllowedTypes('archived', 'bool') - ->setNormalizer('archived', $booleanNormalizer) - ; - $resolver->setDefined('visibility') - ->setAllowedValues('visibility', ['public', 'internal', 'private']) - ; - $resolver->setDefined('order_by') - ->setAllowedValues('order_by', ['id', 'name', 'path', 'created_at', 'updated_at', 'last_activity_at']) - ; - $resolver->setDefined('sort') - ->setAllowedValues('sort', ['asc', 'desc']) - ; - $resolver->setDefined('search'); - $resolver->setDefined('simple') - ->setAllowedTypes('simple', 'bool') - ->setNormalizer('simple', $booleanNormalizer) - ; - $resolver->setDefined('owned') - ->setAllowedTypes('owned', 'bool') - ->setNormalizer('owned', $booleanNormalizer) - ; - $resolver->setDefined('starred') - ->setAllowedTypes('starred', 'bool') - ->setNormalizer('starred', $booleanNormalizer) - ; - - return $this->get('groups/'.$this->encodePath($id).'/projects', $resolver->resolve($parameters)); + return $this->get('groups/'.$this->encodePath($id).'/projects', array( + 'page' => $page, + 'per_page' => $per_page + )); } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/IssueBoards.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/IssueBoards.php deleted file mode 100644 index e5d460bc553ba866d77057bd4baa355553dc7290..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/IssueBoards.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php namespace Gitlab\Api; - -class IssueBoards extends AbstractApi -{ - /** - * @param int $project_id - * @param array $parameters - * - * @return mixed - */ - public function all($project_id = null, array $parameters = []) - { - $resolver = $this->createOptionsResolver(); - - $path = $project_id === null ? 'boards' : $this->getProjectPath($project_id, 'boards'); - - return $this->get($path, $resolver->resolve($parameters)); - } - - /** - * @param int $project_id - * @param int $board_id - * @return mixed - */ - public function allLists($project_id, $board_id) - { - return $this->get($this->getProjectPath($project_id, 'boards/'.$this->encodePath($board_id).'/lists')); - } - - - /** - * @param int $project_id - * @param int $board_id - * @param int $list_id - * @return mixed - */ - public function showList($project_id, $board_id, $list_id) - { - return $this->get($this->getProjectPath($project_id, 'boards/'.$this->encodePath($board_id).'/lists'.$this->encodePath($list_id))); - } - - /** - * @param int $project_id - * @param int $board_id - * @param int $label_id - * @return mixed - */ - public function createList($project_id, $board_id, $label_id) - { - $params = array( - 'id' => $project_id, - 'board_id' => $board_id, - 'label_id' => $label_id - ); - - return $this->get($this->getProjectPath($project_id, 'boards/'.$this->encodePath($board_id).'/lists'), $params); - } - - /** - * @param int $project_id - * @param int $board_id - * @param int $list_id - * @param int $position - * @return mixed - */ - public function updateList($project_id, $board_id, $list_id, $position) - { - $params = array( - 'id' => $project_id, - 'board_id' => $board_id, - 'list_id' => $list_id, - 'position' => $position - ); - - return $this->put($this->getProjectPath($project_id, 'boards/'.$this->encodePath($board_id).'/lists/'.$this->encodePath($list_id)), $params); - } - - /** - * @param int $project_id - * @param int $board_id - * @param int $list_id - * @return mixed - */ - public function deleteList($project_id, $board_id, $list_id) - { - return $this->delete($this->getProjectPath($project_id, 'boards/'.$this->encodePath($board_id).'/lists/'.$this->encodePath($list_id))); - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Issues.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Issues.php index 9fa0f74da2b6f9caf6bc7e6bc19600d5aef4aeb0..661ea7ac18a4eb92df04f32f43827418f8b80a21 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Issues.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Issues.php @@ -4,60 +4,32 @@ class Issues extends AbstractApi { /** * @param int $project_id - * @param array $parameters ( - * - * @var string $state Return all issues or just those that are opened or closed. - * @var string $labels Comma-separated list of label names, issues must have all labels to be returned. - * No+Label lists all issues with no labels. - * @var string $milestone The milestone title. - * @var string scope Return issues for the given scope: created-by-me, assigned-to-me or all. Defaults to created-by-me - * @var int[] $iids Return only the issues having the given iid. - * @var string $order_by Return requests ordered by created_at or updated_at fields. Default is created_at. - * @var string $sort Return requests sorted in asc or desc order. Default is desc. - * @var string $search Search issues against their title and description. - * ) - * + * @param int $page + * @param int $per_page + * @param array $params * @return mixed */ - public function all($project_id = null, array $parameters = []) + public function all($project_id = null, $page = 1, $per_page = self::PER_PAGE, array $params = array()) { - $resolver = $this->createOptionsResolver(); - - $resolver->setDefined('state') - ->setAllowedValues('state', ['opened', 'closed']) - ; - $resolver->setDefined('labels'); - $resolver->setDefined('milestone'); - $resolver->setDefined('iids') - ->setAllowedTypes('iids', 'array') - ->setAllowedValues('iids', function (array $value) { - return count($value) == count(array_filter($value, 'is_int')); - }) - ; - $resolver->setDefined('scope') - ->setAllowedValues('scope', ['created-by-me', 'assigned-to-me', 'all']) - ; - $resolver->setDefined('order_by') - ->setAllowedValues('order_by', ['created_at', 'updated_at']) - ; - $resolver->setDefined('sort') - ->setAllowedValues('sort', ['asc', 'desc']) - ; - $resolver->setDefined('search'); - $path = $project_id === null ? 'issues' : $this->getProjectPath($project_id, 'issues'); - return $this->get($path, $resolver->resolve($parameters)); + $params = array_intersect_key($params, array('labels' => '', 'state' => '', 'sort' => '', 'order_by' => '', 'milestone' => '')); + $params = array_merge(array( + 'page' => $page, + 'per_page' => $per_page + ), $params); + + return $this->get($path, $params); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @return mixed */ - public function show($project_id, $issue_iid) + public function show($project_id, $issue_id) { - return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid))); + return $this->get($this->getProjectPath($project_id, 'issues?iid='.$this->encodePath($issue_id))); } /** @@ -72,53 +44,53 @@ class Issues extends AbstractApi /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @param array $params * @return mixed */ - public function update($project_id, $issue_iid, array $params) + public function update($project_id, $issue_id, array $params) { - return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)), $params); + return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)), $params); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @return mixed */ - public function remove($project_id, $issue_iid) + public function remove($project_id, $issue_id) { - return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid))); + return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id))); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @return mixed */ - public function showComments($project_id, $issue_iid) + public function showComments($project_id, $issue_id) { - return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/notes'); + return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)).'/notes'); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @param int $note_id * @return mixed */ - public function showComment($project_id, $issue_iid, $note_id) + public function showComment($project_id, $issue_id, $note_id) { - return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/notes/'.$this->encodePath($note_id)); + return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id)).'/notes/'.$this->encodePath($note_id)); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @param string|array $body * @return mixed */ - public function addComment($project_id, $issue_iid, $body) + public function addComment($project_id, $issue_id, $body) { // backwards compatibility if (is_array($body)) { @@ -127,70 +99,70 @@ class Issues extends AbstractApi $params = array('body' => $body); } - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/notes'), $params); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes'), $params); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @param int $note_id * @param string $body * @return mixed */ - public function updateComment($project_id, $issue_iid, $note_id, $body) + public function updateComment($project_id, $issue_id, $note_id, $body) { - return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/notes/'.$this->encodePath($note_id)), array( + return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes/'.$this->encodePath($note_id)), array( 'body' => $body )); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @param int $note_id * @return mixed */ - public function removeComment($project_id, $issue_iid, $note_id) + public function removeComment($project_id, $issue_id, $note_id) { - return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/notes/'.$this->encodePath($note_id))); + return $this->delete($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/notes/'.$this->encodePath($note_id))); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @param string $duration */ - public function setTimeEstimate($project_id, $issue_iid, $duration) + public function setTimeEstimate($project_id, $issue_id, $duration) { - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/time_estimate'), array('duration' => $duration)); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/time_estimate'), array('duration' => $duration)); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id */ - public function resetTimeEstimate($project_id, $issue_iid) + public function resetTimeEstimate($project_id, $issue_id) { - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/reset_time_estimate')); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/reset_time_estimate')); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id * @param string $duration */ - public function addSpentTime($project_id, $issue_iid, $duration) + public function addSpentTime($project_id, $issue_id, $duration) { - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/add_spent_time'), array('duration' => $duration)); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/add_spent_time'), array('duration' => $duration)); } /** * @param int $project_id - * @param int $issue_iid + * @param int $issue_id */ - public function resetSpentTime($project_id, $issue_iid) + public function resetSpentTime($project_id, $issue_id) { - return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/reset_spent_time')); + return $this->post($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_id).'/reset_spent_time')); } /** @@ -202,25 +174,4 @@ class Issues extends AbstractApi { return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid) .'/time_stats')); } - - /** - * @param int $project_id - * @param int $issue_iid - * - * @return mixed - */ - public function awardEmoji($project_id, $issue_iid) - { - return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid).'/award_emoji')); - } - - /** - * @param int $project_id - * @param int $issue_iid - * @return mixed - */ - public function closedByMergeRequests($project_id, $issue_iid) - { - return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/closed_by'); - } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Jobs.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Jobs.php deleted file mode 100644 index 2bec5679621145ff75b0b1bc56c55672ec0732d4..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Jobs.php +++ /dev/null @@ -1,178 +0,0 @@ -<?php namespace Gitlab\Api; - -use Psr\Http\Message\StreamInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; - -class Jobs extends AbstractApi -{ - const SCOPE_CREATED = 'created'; - const SCOPE_PENDING = 'pending'; - const SCOPE_RUNNING = 'running'; - const SCOPE_FAILED = 'failed'; - const SCOPE_SUCCESS = 'success'; - const SCOPE_CANCELED = 'canceled'; - const SCOPE_SKIPPED = 'skipped'; - const SCOPE_MANUAL = 'manual'; - - /** - * @param int|string $project_id - * @param array $parameters ( - * - * @var string|string[] $scope The scope of jobs to show, one or array of: created, pending, running, failed, - * success, canceled, skipped, manual; showing all jobs if none provided. - * ) - * - * @return mixed - */ - public function all($project_id, array $parameters = []) - { - $resolver = $this->createOptionsResolver(); - - return $this->get("projects/".$this->encodePath($project_id)."/jobs", $resolver->resolve($parameters)); - } - - /** - * @param int|string $project_id - * @param int $pipeline_id - * @param array $parameters ( - * - * @var string|string[] $scope The scope of jobs to show, one or array of: created, pending, running, failed, - * success, canceled, skipped, manual; showing all jobs if none provided. - * ) - * - * @return mixed - */ - public function pipelineJobs($project_id, $pipeline_id, array $parameters = []) - { - $resolver = $this->createOptionsResolver(); - - return $this->get( - $this->getProjectPath($project_id, 'pipelines/').$this->encodePath($pipeline_id)."/jobs", - $resolver->resolve($parameters) - ); - } - - /** - * @param int|string $project_id - * @param int $job_id - * @return mixed - */ - public function show($project_id, $job_id) - { - return $this->get("projects/".$this->encodePath($project_id)."/jobs/".$this->encodePath($job_id)); - } - - /** - * @param int|string $project_id - * @param int $job_id - * @return StreamInterface - */ - public function artifacts($project_id, $job_id) - { - return $this->getAsResponse("projects/".$this->encodePath($project_id)."/jobs/".$this->encodePath($job_id)."/artifacts")->getBody(); - } - - /** - * @param int|string $project_id - * @param string $ref_name - * @param string $job_name - * @return StreamInterface - */ - public function artifactsByRefName($project_id, $ref_name, $job_name) - { - return $this->getAsResponse("projects/".$this->encodePath($project_id)."/jobs/artifacts/".$this->encodePath($ref_name)."/download", array( - 'job' => $job_name - ))->getBody(); - } - - /** - * @param int|string $project_id - * @param int $job_id - * @return string - */ - public function trace($project_id, $job_id) - { - return $this->get("projects/".$this->encodePath($project_id)."/jobs/".$this->encodePath($job_id)."/trace"); - } - - /** - * @param int|string $project_id - * @param int $job_id - * @return mixed - */ - public function cancel($project_id, $job_id) - { - return $this->post("projects/".$this->encodePath($project_id)."/jobs/".$this->encodePath($job_id)."/cancel"); - } - - /** - * @param int|string $project_id - * @param int $job_id - * @return mixed - */ - public function retry($project_id, $job_id) - { - return $this->post("projects/".$this->encodePath($project_id)."/jobs/".$this->encodePath($job_id)."/retry"); - } - - /** - * @param int|string $project_id - * @param int $job_id - * @return mixed - */ - public function erase($project_id, $job_id) - { - return $this->post("projects/".$this->encodePath($project_id)."/jobs/".$this->encodePath($job_id)."/erase"); - } - - /** - * @param int|string $project_id - * @param int $job_id - * @return mixed - */ - public function keepArtifacts($project_id, $job_id) - { - return $this->post("projects/".$this->encodePath($project_id)."/jobs/".$this->encodePath($job_id)."/artifacts/keep"); - } - - /** - * @param int|string $project_id - * @param int $job_id - * @return mixed - */ - public function play($project_id, $job_id) - { - return $this->post("projects/".$this->encodePath($project_id)."/jobs/".$this->encodePath($job_id)."/play"); - } - - /** - * {@inheritdoc} - */ - protected function createOptionsResolver() - { - $allowedScopeValues = [ - self::SCOPE_CANCELED, - self::SCOPE_CREATED, - self::SCOPE_FAILED, - self::SCOPE_MANUAL, - self::SCOPE_PENDING, - self::SCOPE_RUNNING, - self::SCOPE_SKIPPED, - self::SCOPE_SUCCESS, - ]; - - $resolver = parent::createOptionsResolver(); - $resolver->setDefined('scope') - ->setAllowedTypes('scope', ['string', 'array']) - ->setAllowedValues('scope', $allowedScopeValues) - ->addAllowedValues('scope', function ($value) use ($allowedScopeValues) { - return is_array($value) && empty(array_diff($value, $allowedScopeValues)); - }) - ->setNormalizer('scope', function (OptionsResolver $resolver, $value) { - return (array) $value; - }) - ; - - return $resolver; - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/MergeRequests.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/MergeRequests.php index 0cdc602ddb402a70e43388d3fa32dfbe768b1ee1..2d6dc6184957beb158c94567af60e147dea670d4 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/MergeRequests.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/MergeRequests.php @@ -1,8 +1,5 @@ <?php namespace Gitlab\Api; -use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; -use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; - class MergeRequests extends AbstractApi { const STATE_ALL = 'all'; @@ -10,65 +7,80 @@ class MergeRequests extends AbstractApi const STATE_OPENED = 'opened'; const STATE_CLOSED = 'closed'; + const ORDER_BY = 'created_at'; + const SORT = 'asc'; + + /** + * @param int $project_id + * @param string $state + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort + * @param string $object + * @return mixed + */ + public function getList($project_id, $state = self::STATE_ALL, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT, $object = 'merge_requests') + { + return $this->get($this->getProjectPath($project_id, $object), array( + 'page' => $page, + 'per_page' => $per_page, + 'state' => $state, + 'order_by' => $order_by, + 'sort' => $sort + )); + } + + /** + * @param int $project_id + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort + * @return mixed + */ + public function all($project_id, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) + { + return $this->getList($project_id, self::STATE_ALL, $page, $per_page, $order_by, $sort); + } + + /** + * @param int $project_id + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort + * @return mixed + */ + public function merged($project_id, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) + { + return $this->getList($project_id, self::STATE_MERGED, $page, $per_page, $order_by, $sort); + } + /** - * @param int $project_id - * @param array $parameters { - * - * @var int[] $iids Return the request having the given iid. - * @var string $state Return all merge requests or just those that are opened, closed, or - * merged. - * @var string $order_by Return requests ordered by created_at or updated_at fields. Default - * is created_at. - * @var string $sort Return requests sorted in asc or desc order. Default is desc. - * @var string $milestone Return merge requests for a specific milestone. - * @var string $view If simple, returns the iid, URL, title, description, and basic state - * of merge request. - * @var string $labels Return merge requests matching a comma separated list of labels. - * @var \DateTimeInterface $created_after Return merge requests created after the given time (inclusive). - * @var \DateTimeInterface $created_before Return merge requests created before the given time (inclusive). - * } - * - * @throws UndefinedOptionsException If an option name is undefined. - * @throws InvalidOptionsException If an option doesn't fulfill the specified validation rules. - * + * @param int $project_id + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort * @return mixed */ - public function all($project_id, array $parameters = []) + public function opened($project_id, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) { - $resolver = $this->createOptionsResolver(); - $datetimeNormalizer = function (\DateTimeInterface $value) { - return $value->format('c'); - }; - $resolver->setDefined('iids') - ->setAllowedTypes('iids', 'array') - ->setAllowedValues('iids', function (array $value) { - return count($value) == count(array_filter($value, 'is_int')); - }) - ; - $resolver->setDefined('state') - ->setAllowedValues('state', ['all', 'opened', 'merged', 'closed']) - ; - $resolver->setDefined('order_by') - ->setAllowedValues('order_by', ['created_at', 'updated_at']) - ; - $resolver->setDefined('sort') - ->setAllowedValues('sort', ['asc', 'desc']) - ; - $resolver->setDefined('milestone'); - $resolver->setDefined('view') - ->setAllowedValues('view', ['simple']) - ; - $resolver->setDefined('labels'); - $resolver->setDefined('created_after') - ->setAllowedTypes('created_after', \DateTimeInterface::class) - ->setNormalizer('created_after', $datetimeNormalizer) - ; - $resolver->setDefined('created_before') - ->setAllowedTypes('created_before', \DateTimeInterface::class) - ->setNormalizer('created_before', $datetimeNormalizer) - ; + return $this->getList($project_id, self::STATE_OPENED, $page, $per_page, $order_by, $sort); + } - return $this->get($this->getProjectPath($project_id, 'merge_requests'), $resolver->resolve($parameters)); + /** + * @param int $project_id + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort + * @return mixed + */ + public function closed($project_id, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) + { + return $this->getList($project_id, self::STATE_CLOSED, $page, $per_page, $order_by, $sort); } /** @@ -78,7 +90,7 @@ class MergeRequests extends AbstractApi */ public function show($project_id, $mr_id) { - return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id))); + return $this->get($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id))); } /** @@ -111,7 +123,7 @@ class MergeRequests extends AbstractApi */ public function update($project_id, $mr_id, array $params) { - return $this->put($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id)), $params); + return $this->put($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id)), $params); } /** @@ -128,18 +140,17 @@ class MergeRequests extends AbstractApi $params = array('merge_commit_message' => $message); } - return $this->put($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/merge'), $params); + return $this->put($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/merge'), $params); } /** - * @param int $project_id - * @param int $mr_id - * + * @param int $project_id + * @param int $mr_id * @return mixed */ - public function showNotes($project_id, $mr_id) + public function showNotes($project_id, $mr_id, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = 'desc') { - return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/notes')); + return $this->getList($project_id, null, $page, $per_page, $order_by, $sort, 'merge_requests/'.$this->encodePath($mr_id).'/notes'); } /** @@ -162,9 +173,7 @@ class MergeRequests extends AbstractApi */ public function showComments($project_id, $mr_id) { - @trigger_error(sprintf('The %s() method is deprecated since version 9.1 and will be removed in 10.0. Use the showNotes() method instead.', __METHOD__), E_USER_DEPRECATED); - - return $this->showNotes($project_id, $mr_id); + return $this->get($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/comments')); } /** @@ -175,9 +184,9 @@ class MergeRequests extends AbstractApi */ public function addComment($project_id, $mr_id, $note) { - @trigger_error(sprintf('The %s() method is deprecated since version 9.1 and will be removed in 10.0. Use the addNote() method instead.', __METHOD__), E_USER_DEPRECATED); - - return $this->addNote($project_id, $mr_id, $note); + return $this->post($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/comments'), array( + 'note' => $note + )); } /** @@ -187,70 +196,26 @@ class MergeRequests extends AbstractApi */ public function changes($project_id, $mr_id) { - return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/changes')); - } - - /** - * @param int $project_id - * @param int $mr_id - * @return mixed - */ - public function commits($project_id, $mr_id) - { - return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/commits')); - } - - /** - * @param int $project_id - * @param int $mr_id - * @return mixed - */ - public function closesIssues($project_id, $mr_id) - { - return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/closes_issues')); - } - - /** - * @param int $project_id - * @param int $mr_id - * - * @return mixed - */ - public function approvals($project_id, $merge_request_iid) - { - return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($merge_request_iid).'/approvals')); + return $this->get($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/changes')); } /** - * @param int $project_id - * @param int $mr_id - * + * @param $project_id + * @param $mr_iid * @return mixed */ - public function approve($project_id, $merge_request_iid) + public function getByIid($project_id, $mr_iid) { - return $this->post($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($merge_request_iid).'/approve')); + return $this->get($this->getProjectPath($project_id, 'merge_requests'), array('iid' => $mr_iid)); } /** * @param int $project_id * @param int $mr_id - * * @return mixed */ - public function unapprove($project_id, $merge_request_iid) - { - return $this->post($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($merge_request_iid).'/unapprove')); - } - - /** - * @param int $project_id - * @param int $merge_request_iid - * - * @return mixed - */ - public function awardEmoji($project_id, $merge_request_iid) + public function commits($project_id, $mr_id) { - return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($merge_request_iid).'/award_emoji')); + return $this->get($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/commits')); } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Milestones.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Milestones.php index 0f9b2d25ed55cc1e02dd0a5ff0ed6dd6fb2fae66..3b15281834e07651e1a2cb6d75504beaf78629ac 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Milestones.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Milestones.php @@ -4,30 +4,16 @@ class Milestones extends AbstractApi { /** * @param int $project_id - * @param array $parameters ( - * - * @var int[] $iids Return only the milestones having the given iids. - * @var string $state Return only active or closed milestones. - * @var string $search Return only milestones with a title or description matching the provided string. - * ) - * + * @param int $page + * @param int $per_page * @return mixed */ - public function all($project_id, array $parameters = []) + public function all($project_id, $page = 1, $per_page = self::PER_PAGE) { - $resolver = $this->createOptionsResolver(); - $resolver->setDefined('iids') - ->setAllowedTypes('iids', 'array') - ->setAllowedValues('iids', function (array $value) { - return count($value) == count(array_filter($value, 'is_int')); - }) - ; - $resolver->setDefined('state') - ->setAllowedValues('state', ['active', 'closed']) - ; - $resolver->setDefined('search'); - - return $this->get($this->getProjectPath($project_id, 'milestones'), $resolver->resolve($parameters)); + return $this->get($this->getProjectPath($project_id, 'milestones'), array( + 'page' => $page, + 'per_page' => $per_page + )); } /** diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/ProjectNamespaces.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/ProjectNamespaces.php index 815d4e083addf8ebcd669ad5b74a5700911cb410..480fa79c88097df77b99386a32e408f67552f070 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/ProjectNamespaces.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/ProjectNamespaces.php @@ -3,18 +3,30 @@ class ProjectNamespaces extends AbstractApi { /** - * @param array $parameters ( - * - * @var string $search Returns a list of namespaces the user is authorized to see based on the search criteria. - * ) - * + * @param int $page + * @param int $per_page * @return mixed */ - public function all(array $parameters = []) + public function all($page = 1, $per_page = self::PER_PAGE) { - $resolver = $this->createOptionsResolver(); - $resolver->setDefined('search'); + return $this->get('namespaces', array( + 'page' => $page, + 'per_page' => $per_page + )); + } - return $this->get('namespaces', $resolver->resolve($parameters)); + /** + * @param string $terms + * @param int $page + * @param int $per_page + * @return mixed + */ + public function search($terms, $page = 1, $per_page = self::PER_PAGE) + { + return $this->get('namespaces', array( + 'search' => $terms, + 'page' => $page, + 'per_page' => $per_page + )); } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Projects.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Projects.php index 489ddb666cd7e570163477c47df23324be221ae8..65781babcb45964aa0a9126d7e10cf0f2138d8c1 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Projects.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Projects.php @@ -1,84 +1,78 @@ <?php namespace Gitlab\Api; -use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; -use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; - class Projects extends AbstractApi { + const ORDER_BY = 'created_at'; + const SORT = 'asc'; + + /** + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort + * @return mixed + */ + public function all($page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) + { + return $this->get('projects/all', array( + 'page' => $page, + 'per_page' => $per_page, + 'order_by' => $order_by, + 'sort' => $sort + )); + } + + /** + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort + * @return mixed + */ + public function accessible($page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) + { + return $this->get('projects', array( + 'page' => $page, + 'per_page' => $per_page, + 'order_by' => $order_by, + 'sort' => $sort + )); + } + /** - * @param array $parameters { - * - * @var bool $archived Limit by archived status. - * @var string $visibility Limit by visibility public, internal, or private. - * @var string $order_by Return projects ordered by id, name, path, created_at, updated_at, - * or last_activity_at fields. Default is created_at. - * @var string $sort Return projects sorted in asc or desc order. Default is desc. - * @var string $search Return list of projects matching the search criteria. - * @var bool $simple Return only the ID, URL, name, and path of each project. - * @var bool $owned Limit by projects owned by the current user. - * @var bool $membership Limit by projects that the current user is a member of. - * @var bool $starred Limit by projects starred by the current user. - * @var bool $statistics Include project statistics. - * @var bool $with_issues_enabled Limit by enabled issues feature. - * @var bool $with_merge_requests_enabled Limit by enabled merge requests feature. - * } - * - * @throws UndefinedOptionsException If an option name is undefined - * @throws InvalidOptionsException If an option doesn't fulfill the - * specified validation rules - * - * @return mixed - */ - public function all(array $parameters = []) - { - $resolver = $this->createOptionsResolver(); - $booleanNormalizer = function ($value) { - return $value ? 'true' : 'false'; - }; - $resolver->setDefined('archived') - ->setAllowedTypes('archived', 'bool') - ->setNormalizer('archived', $booleanNormalizer) - ; - $resolver->setDefined('visibility') - ->setAllowedValues('visibility', ['public', 'internal', 'private']) - ; - $resolver->setDefined('order_by') - ->setAllowedValues('order_by', ['id', 'name', 'path', 'created_at', 'updated_at', 'last_activity_at']) - ; - $resolver->setDefined('sort') - ->setAllowedValues('sort', ['asc', 'desc']) - ; - $resolver->setDefined('search'); - $resolver->setDefined('simple') - ->setAllowedTypes('simple', 'bool') - ->setNormalizer('simple', $booleanNormalizer) - ; - $resolver->setDefined('owned') - ->setAllowedTypes('owned', 'bool') - ->setNormalizer('owned', $booleanNormalizer) - ; - $resolver->setDefined('membership') - ->setAllowedTypes('membership', 'bool') - ->setNormalizer('membership', $booleanNormalizer) - ; - $resolver->setDefined('starred') - ->setAllowedTypes('starred', 'bool') - ->setNormalizer('starred', $booleanNormalizer) - ; - $resolver->setDefined('statistics') - ->setAllowedTypes('statistics', 'bool') - ->setNormalizer('statistics', $booleanNormalizer) - ; - $resolver->setDefined('with_issues_enabled') - ->setAllowedTypes('with_issues_enabled', 'bool') - ->setNormalizer('with_issues_enabled', $booleanNormalizer) - ; - $resolver->setDefined('with_merge_requests_enabled') - ->setAllowedTypes('with_merge_requests_enabled', 'bool') - ->setNormalizer('with_merge_requests_enabled', $booleanNormalizer) - ; - - return $this->get('projects', $resolver->resolve($parameters)); + * Get projects owned by the current user + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort + * @return mixed + */ + public function owned($page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) + { + return $this->get('projects?owned=1', array( + 'page' => $page, + 'per_page' => $per_page, + 'order_by' => $order_by, + 'sort' => $sort + )); + } + + /** + * @param string $query + * @param int $page + * @param int $per_page + * @param string $order_by + * @param string $sort + * @return mixed + */ + public function search($query, $page = 1, $per_page = self::PER_PAGE, $order_by = self::ORDER_BY, $sort = self::SORT) + { + return $this->get('projects/search/'.$this->encodePath($query), array( + 'page' => $page, + 'per_page' => $per_page, + 'order_by' => $order_by, + 'sort' => $sort + )); } /** @@ -138,8 +132,7 @@ class Projects extends AbstractApi * @param int $project_id * @return mixed */ - public function archive($project_id) - { + public function archive($project_id){ return $this->post("projects/".$this->encodePath($project_id)."/archive"); } @@ -147,54 +140,49 @@ class Projects extends AbstractApi * @param int $project_id * @return mixed */ - public function unarchive($project_id) - { + public function unarchive($project_id){ return $this->post("projects/".$this->encodePath($project_id)."/unarchive"); } /** - * @param int $project_id - * @param array $parameters ( - * - * @var string $scope The scope of pipelines, one of: running, pending, finished, branches, tags. - * @var string $status The status of pipelines, one of: running, pending, success, failed, canceled, skipped. - * @var string $ref The ref of pipelines. - * @var bool $yaml_errors Returns pipelines with invalid configurations. - * @var string $name The name of the user who triggered pipelines. - * @var string $username The username of the user who triggered pipelines. - * @var string $order_by Order pipelines by id, status, ref, or user_id (default: id). - * @var string $order Sort pipelines in asc or desc order (default: desc). - * ) + * @param int $project_id + * @param array $scope * @return mixed */ - public function pipelines($project_id, array $parameters = []) + public function builds($project_id, $scope = null) { - $resolver = $this->createOptionsResolver(); - $booleanNormalizer = function ($value) { - return $value ? 'true' : 'false'; - }; + return $this->get($this->getProjectPath($project_id, 'builds'), array( + 'scope' => $scope + )); + } - $resolver->setDefined('scope') - ->setAllowedValues('scope', ['running', 'pending', 'finished', 'branches', 'tags']) - ; - $resolver->setDefined('status') - ->setAllowedValues('status', ['running', 'pending', 'success', 'failed', 'canceled', 'skipped']) - ; - $resolver->setDefined('ref'); - $resolver->setDefined('yaml_errors') - ->setAllowedTypes('yaml_errors', 'bool') - ->setNormalizer('yaml_errors', $booleanNormalizer) - ; - $resolver->setDefined('name'); - $resolver->setDefined('username'); - $resolver->setDefined('order_by') - ->setAllowedValues('order_by', ['id', 'status', 'ref', 'user_id']) - ; - $resolver->setDefined('sort') - ->setAllowedValues('sort', ['asc', 'desc']) - ; + /** + * @param int $project_id + * @param int $build_id + * @return mixed + */ + public function build($project_id, $build_id) + { + return $this->get($this->getProjectPath($project_id, 'builds/'.$this->encodePath($build_id))); + } - return $this->get($this->getProjectPath($project_id, 'pipelines'), $resolver->resolve($parameters)); + /** + * @param int $project_id + * @param int $build_id + * @return mixed + */ + public function trace($project_id, $build_id) + { + return $this->get($this->getProjectPath($project_id, 'builds/'.$this->encodePath($build_id).'/trace')); + } + + /** + * @param int $project_id + * @return mixed + */ + public function pipelines($project_id) + { + return $this->get($this->getProjectPath($project_id, 'pipelines')); } /** @@ -214,7 +202,7 @@ class Projects extends AbstractApi */ public function createPipeline($project_id, $commit_ref) { - return $this->post($this->getProjectPath($project_id, 'pipeline'), array( + return $this->post($this->getProjectPath($project_id, 'pipelines'), array( 'ref' => $commit_ref)); } @@ -299,15 +287,25 @@ class Projects extends AbstractApi /** * @param int $project_id - * @param array $parameters - * * @return mixed */ - public function hooks($project_id, array $parameters = []) + public function deployKeys($project_id) { - $resolver = $this->createOptionsResolver(); + return $this->get($this->getProjectPath($project_id, 'deploy_keys')); + } - return $this->get($this->getProjectPath($project_id, 'hooks'), $resolver->resolve($parameters)); + /** + * @param int $project_id + * @param int $page + * @param int $per_page + * @return mixed + */ + public function hooks($project_id, $page = 1, $per_page = self::PER_PAGE) + { + return $this->get($this->getProjectPath($project_id, 'hooks'), array( + 'page' => $page, + 'per_page' => $per_page + )); } /** @@ -362,9 +360,9 @@ class Projects extends AbstractApi * @param int $project_id * @return mixed */ - public function deployKeys($project_id) + public function keys($project_id) { - return $this->get($this->getProjectPath($project_id, 'deploy_keys')); + return $this->get($this->getProjectPath($project_id, 'keys')); } /** @@ -372,24 +370,22 @@ class Projects extends AbstractApi * @param int $key_id * @return mixed */ - public function deployKey($project_id, $key_id) + public function key($project_id, $key_id) { - return $this->get($this->getProjectPath($project_id, 'deploy_keys/'.$this->encodePath($key_id))); + return $this->get($this->getProjectPath($project_id, 'keys/'.$this->encodePath($key_id))); } /** * @param int $project_id * @param string $title * @param string $key - * @param bool $canPush * @return mixed */ - public function addDeployKey($project_id, $title, $key, $canPush = false) + public function addKey($project_id, $title, $key) { - return $this->post($this->getProjectPath($project_id, 'deploy_keys'), array( + return $this->post($this->getProjectPath($project_id, 'keys'), array( 'title' => $title, - 'key' => $key, - 'can_push' => $canPush + 'key' => $key )); } @@ -398,9 +394,9 @@ class Projects extends AbstractApi * @param int $key_id * @return mixed */ - public function deleteDeployKey($project_id, $key_id) + public function removeKey($project_id, $key_id) { - return $this->delete($this->getProjectPath($project_id, 'deploy_keys/'.$this->encodePath($key_id))); + return $this->delete($this->getProjectPath($project_id, 'keys/'.$this->encodePath($key_id))); } /** @@ -408,49 +404,33 @@ class Projects extends AbstractApi * @param int $key_id * @return mixed */ - public function enableDeployKey($project_id, $key_id) + public function enableKey($project_id, $key_id) { - return $this->post($this->getProjectPath($project_id, 'deploy_keys/'.$this->encodePath($key_id).'/enable')); + return $this->post($this->getProjectPath($project_id, 'keys/'.$this->encodePath($key_id).'/enable')); } /** * @param int $project_id - * @param array $parameters ( - * - * @var string $action Include only events of a particular action type. - * @var string $target_type Include only events of a particular target type. - * @var \DateTimeInterface $before Include only events created before a particular date. - * @var \DateTimeInterface $after Include only events created after a particular date. - * @var string $sort Sort events in asc or desc order by created_at. Default is desc. - * ) - * + * @param int $key_id * @return mixed */ - public function events($project_id, array $parameters = []) + public function disableKey($project_id, $key_id) { - $resolver = $this->createOptionsResolver(); - $datetimeNormalizer = function (\DateTimeInterface $value) { - return $value->format('Y-m-d'); - }; - - $resolver->setDefined('action') - ->setAllowedValues('action', ['created', 'updated', 'closed', 'reopened', 'pushed', 'commented', 'merged', 'joined', 'left', 'destroyed', 'expired']) - ; - $resolver->setDefined('target_type') - ->setAllowedValues('target_type', ['issue', 'milestone', 'merge_request', 'note', 'project', 'snippet', 'user']) - ; - $resolver->setDefined('before') - ->setAllowedTypes('before', \DateTimeInterface::class) - ->setNormalizer('before', $datetimeNormalizer); - $resolver->setDefined('after') - ->setAllowedTypes('after', \DateTimeInterface::class) - ->setNormalizer('after', $datetimeNormalizer) - ; - $resolver->setDefined('sort') - ->setAllowedValues('sort', ['asc', 'desc']) - ; + return $this->delete($this->getProjectPath($project_id, 'keys/'.$this->encodePath($key_id).'/disable')); + } - return $this->get($this->getProjectPath($project_id, 'events'), $resolver->resolve($parameters)); + /** + * @param int $project_id + * @param int $page + * @param int $per_page + * @return mixed + */ + public function events($project_id, $page = 1, $per_page = self::PER_PAGE) + { + return $this->get($this->getProjectPath($project_id, 'events'), array( + 'page' => $page, + 'per_page' => $per_page + )); } /** @@ -500,7 +480,7 @@ class Projects extends AbstractApi */ public function fork($project_id) { - return $this->post('projects/'.$this->encodePath($project_id).'/fork'); + return $this->post('projects/fork/'.$this->encodePath($project_id)); } /** @@ -566,51 +546,27 @@ class Projects extends AbstractApi * @param int $project_id * @param string $key * @param string $value - * @param bool $protected - * @param string $environment_scope * @return mixed */ - public function addVariable($project_id, $key, $value, $protected = null, $environment_scope = null) + public function addVariable($project_id, $key, $value) { - $payload = array( + return $this->post($this->getProjectPath($project_id, 'variables'), array( 'key' => $key, - 'value' => $value, - ); - - if ($protected) { - $payload['protected'] = $protected; - } - - if ($environment_scope) { - $payload['environment_scope'] = $environment_scope; - } - - return $this->post($this->getProjectPath($project_id, 'variables'), $payload); + 'value' => $value + )); } /** * @param int $project_id * @param string $key * @param string $value - * @param bool $protected - * @param string $environment_scope * @return mixed */ - public function updateVariable($project_id, $key, $value, $protected = null, $environment_scope = null) + public function updateVariable($project_id, $key, $value) { - $payload = array( + return $this->put($this->getProjectPath($project_id, 'variables/'.$this->encodePath($key)), array( 'value' => $value, - ); - - if ($protected) { - $payload['protected'] = $protected; - } - - if ($environment_scope) { - $payload['environment_scope'] = $environment_scope; - } - - return $this->put($this->getProjectPath($project_id, 'variables/'.$this->encodePath($key)), $payload); + )); } /** @@ -635,15 +591,16 @@ class Projects extends AbstractApi /** * @param int $project_id - * @param array $parameters - * + * @param int $page + * @param int $per_page * @return mixed */ - public function deployments($project_id, array $parameters = []) + public function deployments($project_id, $page = 1, $per_page = self::PER_PAGE) { - $resolver = $this->createOptionsResolver(); - - return $this->get($this->getProjectPath($project_id, 'deployments'), $resolver->resolve($parameters)); + return $this->get($this->getProjectPath($project_id, 'deployments'), array( + 'page' => $page, + 'per_page' => $per_page + )); } /** diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Repositories.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Repositories.php index 9fcca55a63684154cdb5ed03757760ba753d818f..bb6e842e8582e56a9dd1c006bea80bbb77f6da87 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Repositories.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Repositories.php @@ -1,7 +1,5 @@ <?php namespace Gitlab\Api; -use Symfony\Component\OptionsResolver\OptionsResolver; - class Repositories extends AbstractApi { /** @@ -25,26 +23,26 @@ class Repositories extends AbstractApi /** * @param int $project_id - * @param string $branch + * @param string $branch_name * @param string $ref * @return mixed */ - public function createBranch($project_id, $branch, $ref) + public function createBranch($project_id, $branch_name, $ref) { return $this->post($this->getProjectPath($project_id, 'repository/branches'), array( - 'branch' => $branch, + 'branch_name' => $branch_name, 'ref' => $ref )); } /** * @param int $project_id - * @param string $branch + * @param string $branch_name * @return mixed */ - public function deleteBranch($project_id, $branch) + public function deleteBranch($project_id, $branch_name) { - return $this->delete($this->getProjectPath($project_id, 'repository/branches/'.$this->encodeBranch($branch))); + return $this->delete($this->getProjectPath($project_id, 'repository/branches/'.$this->encodeBranch($branch_name))); } /** @@ -74,14 +72,11 @@ class Repositories extends AbstractApi /** * @param int $project_id - * @param array $parameters * @return mixed */ - public function tags($project_id, array $parameters = []) + public function tags($project_id) { - $resolver = $this->createOptionsResolver(); - - return $this->get($this->getProjectPath($project_id, 'repository/tags'), $resolver->resolve($parameters)); + return $this->get($this->getProjectPath($project_id, 'repository/tags')); } /** @@ -107,13 +102,12 @@ class Repositories extends AbstractApi * * @return mixed */ - public function createRelease($project_id, $tag_name, $description) - { - return $this->post($this->getProjectPath($project_id, 'repository/tags/' . $this->encodeBranch($tag_name) . '/release'), array( + public function createRelease( $project_id, $tag_name, $description ) { + return $this->post( $this->getProjectPath( $project_id, 'repository/tags/' . $this->encodeBranch( $tag_name ) . '/release' ), array( 'id' => $project_id, 'tag_name' => $tag_name, 'description' => $description - )); + ) ); } /** @@ -123,134 +117,71 @@ class Repositories extends AbstractApi * * @return mixed */ - public function updateRelease($project_id, $tag_name, $description) - { - return $this->put($this->getProjectPath($project_id, 'repository/tags/' . $this->encodeBranch($tag_name) . '/release'), array( + public function updateRelease( $project_id, $tag_name, $description ) { + return $this->put( $this->getProjectPath( $project_id, 'repository/tags/' . $this->encodeBranch( $tag_name ) . '/release' ), array( 'id' => $project_id, 'tag_name' => $tag_name, 'description' => $description - )); + ) ); } /** * @param int $project_id - * @param array $parameters ( - * - * @var string $ref_name The name of a repository branch or tag or if not given the default branch. - * @var \DateTimeInterface $since Only commits after or on this date will be returned. - * @var \DateTimeInterface $until Only commits before or on this date will be returned. - * ) + * @param string $sha + * @param string $scope + * @param int $page + * @param int $per_page * * @return mixed */ - public function commits($project_id, array $parameters = []) + public function commitBuilds($project_id, $sha, $scope = null, $page = 0, $per_page = self::PER_PAGE) { - $resolver = $this->createOptionsResolver(); - $datetimeNormalizer = function (\DateTimeInterface $value) { - return $value->format('c'); - }; - - $resolver->setDefined('ref_name'); - $resolver->setDefined('since') - ->setAllowedTypes('since', \DateTimeInterface::class) - ->setNormalizer('since', $datetimeNormalizer) - ; - $resolver->setDefined('until') - ->setAllowedTypes('until', \DateTimeInterface::class) - ->setNormalizer('until', $datetimeNormalizer) - ; - - return $this->get($this->getProjectPath($project_id, 'repository/commits'), $resolver->resolve($parameters)); + return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/builds'), array( + 'page' => $page, + 'per_page' => $per_page, + 'scope' => $scope + )); } /** * @param int $project_id - * @param $sha + * @param int $page + * @param int $per_page + * @param null $ref_name * @return mixed */ - public function commit($project_id, $sha) + public function commits($project_id, $page = 0, $per_page = self::PER_PAGE, $ref_name = null) { - return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha))); + return $this->get($this->getProjectPath($project_id, 'repository/commits'), array( + 'page' => $page, + 'per_page' => $per_page, + 'ref_name' => $ref_name + )); } /** * @param int $project_id - * @param array $parameters ( - * - * @var string $branch Name of the branch to commit into. To create a new branch, also provide start_branch. - * @var string $commit_message Commit message. - * @var string $start_branch Name of the branch to start the new commit from. - * @var array $actions ( - * - * @var string $action he action to perform, create, delete, move, update. - * @var string $file_path Full path to the file. - * @var string $previous_path Original full path to the file being moved. - * @var string $content File content, required for all except delete. Optional for move. - * @var string $encoding text or base64. text is default. - * ) - * @var string $author_email Specify the commit author's email address. - * @var string $author_name Specify the commit author's name. - * ) - * + * @param $sha * @return mixed */ - public function createCommit($project_id, array $parameters = []) + public function commit($project_id, $sha) { - $resolver = new OptionsResolver(); - $resolver->setDefined('branch') - ->setRequired('branch') - ; - $resolver->setDefined('commit_message') - ->setRequired('commit_message') - ; - $resolver->setDefined('start_branch'); - $resolver->setDefined('actions') - ->setRequired('actions') - ->setAllowedTypes('actions', 'array') - ->setAllowedValues('actions', function (array $actions) { - return !empty($actions); - }) - ->setNormalizer('actions', function (OptionsResolver $resolver, array $actions) { - $actionsOptionsResolver = new OptionsResolver(); - $actionsOptionsResolver->setDefined('action') - ->setRequired('action') - ->setAllowedValues('action', ['create', 'delete', 'move', 'update']) - ; - $actionsOptionsResolver->setDefined('file_path') - ->setRequired('file_path') - ; - $actionsOptionsResolver->setDefined('previous_path'); - $actionsOptionsResolver->setDefined('content'); - $actionsOptionsResolver->setDefined('encoding') - ->setAllowedValues('encoding', ['test', 'base64']) - ; - - return array_map(function ($action) use ($actionsOptionsResolver) { - return $actionsOptionsResolver->resolve($action); - }, $actions); - }) - ; - $resolver->setDefined('author_email'); - $resolver->setDefined('author_name'); - - return $this->post($this->getProjectPath($project_id, 'repository/commits'), $resolver->resolve($parameters)); + return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha))); } /** - * @param int $project_id + * @param int $project_id * @param string $sha - * @param array $parameters - * + * @param int $page + * @param int $per_page * @return mixed */ - public function commitComments($project_id, $sha, array $parameters = []) + public function commitComments($project_id, $sha, $page = 0, $per_page = self::PER_PAGE) { - $resolver = $this->createOptionsResolver(); - - return $this->get( - $this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/comments'), - $resolver->resolve($parameters) - ); + return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/comments'), array( + 'page' => $page, + 'per_page' => $per_page + )); } /** @@ -309,9 +240,9 @@ class Repositories extends AbstractApi */ public function blob($project_id, $sha, $filepath) { - @trigger_error(sprintf('The %s() method is deprecated since version 9.2 and will be removed in 10.0. Use the %s::getRawFile() method instead.', __METHOD__, RepositoryFiles::class), E_USER_DEPRECATED); - - return $this->client->repositoryFiles()->getRawFile($project_id, $filepath, $sha); + return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/blob'), array( + 'filepath' => $filepath + )); } /** @@ -322,83 +253,78 @@ class Repositories extends AbstractApi */ public function getFile($project_id, $file_path, $ref) { - @trigger_error(sprintf('The %s() method is deprecated since version 9.2 and will be removed in 10.0. Use the %s::getFile() method instead.', __METHOD__, RepositoryFiles::class), E_USER_DEPRECATED); - - return $this->client->repositoryFiles()->getFile($project_id, $file_path, $ref); + return $this->get($this->getProjectPath($project_id, 'repository/files'), array( + 'file_path' => $file_path, + 'ref' => $ref + )); } /** * @param int $project_id * @param string $file_path * @param string $content - * @param string $branch + * @param string $branch_name * @param string $commit_message * @param string $encoding * @param string $author_email * @param string $author_name * @return mixed */ - public function createFile($project_id, $file_path, $content, $branch, $commit_message, $encoding = null, $author_email = null, $author_name = null) + public function createFile($project_id, $file_path, $content, $branch_name, $commit_message, $encoding = null, $author_email = null, $author_name = null) { - @trigger_error(sprintf('The %s() method is deprecated since version 9.2 and will be removed in 10.0. Use the %s::createFile() method instead.', __METHOD__, RepositoryFiles::class), E_USER_DEPRECATED); - - return $this->client->repositoryFiles()->createFile($project_id, [ + return $this->post($this->getProjectPath($project_id, 'repository/files'), array( 'file_path' => $file_path, - 'branch' => $branch, + 'branch_name' => $branch_name, 'content' => $content, 'commit_message' => $commit_message, 'encoding' => $encoding, 'author_email' => $author_email, 'author_name' => $author_name, - ]); + )); } /** * @param int $project_id * @param string $file_path * @param string $content - * @param string $branch + * @param string $branch_name * @param string $commit_message * @param string $encoding * @param string $author_email * @param string $author_name * @return mixed */ - public function updateFile($project_id, $file_path, $content, $branch, $commit_message, $encoding = null, $author_email = null, $author_name = null) + public function updateFile($project_id, $file_path, $content, $branch_name, $commit_message, $encoding = null, $author_email = null, $author_name = null) { - @trigger_error(sprintf('The %s() method is deprecated since version 9.2 and will be removed in 10.0. Use the %s::updateFile() method instead.', __METHOD__, RepositoryFiles::class), E_USER_DEPRECATED); - - return $this->client->repositoryFiles()->updateFile($project_id, [ + return $this->put($this->getProjectPath($project_id, 'repository/files'), array( 'file_path' => $file_path, - 'branch' => $branch, + 'branch_name' => $branch_name, 'content' => $content, 'commit_message' => $commit_message, 'encoding' => $encoding, 'author_email' => $author_email, 'author_name' => $author_name, - ]); + )); } /** * @param int $project_id * @param string $file_path - * @param string $branch + * @param string $branch_name * @param string $commit_message * @param string $author_email * @param string $author_name * @return mixed */ - public function deleteFile($project_id, $file_path, $branch, $commit_message, $author_email = null, $author_name = null) + public function deleteFile($project_id, $file_path, $branch_name, $commit_message, $author_email = null, $author_name = null) { - @trigger_error(sprintf('The %s() method is deprecated since version 9.2 and will be removed in 10.0. Use the %s::deleteFile() method instead.', __METHOD__, RepositoryFiles::class), E_USER_DEPRECATED); - - return $this->client->repositoryFiles()->deleteFile($project_id, [ + return $this->delete($this->getProjectPath($project_id, 'repository/files'), array( 'file_path' => $file_path, - 'branch' => $branch, + 'branch_name' => $branch_name, 'commit_message' => $commit_message, 'author_email' => $author_email, 'author_name' => $author_name, - ]); + )); } /** diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/RepositoryFiles.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/RepositoryFiles.php deleted file mode 100644 index bc20c00f0d8604756353474517e7dbfe84e4e7c7..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/RepositoryFiles.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php - -namespace Gitlab\Api; - -use Symfony\Component\OptionsResolver\OptionsResolver; - -class RepositoryFiles extends AbstractApi -{ - /** - * @param int $project_id - * @param string $file_path - * @param string $ref - * @return mixed - */ - public function getFile($project_id, $file_path, $ref) - { - return $this->get($this->getProjectPath($project_id, 'repository/files/'.$this->encodePath($file_path)), array( - 'ref' => $ref - )); - } - - /** - * @param int $project_id - * @param string $file_path - * @param string $ref - * @return mixed - */ - public function getRawFile($project_id, $file_path, $ref) - { - return $this->get($this->getProjectPath($project_id, 'repository/files/'.$this->encodePath($file_path).'/raw'), array( - 'ref' => $ref, - )); - } - - /** - * @param int $project_id - * @param array $parameters ( - * - * @var string $file_path Url encoded full path to new file. Ex. lib%2Fclass%2Erb. - * @var string $branch Name of the branch. - * @var string $start_branch Name of the branch to start the new commit from. - * @var string $encoding Change encoding to 'base64'. Default is text. - * @var string $author_email Specify the commit author's email address. - * @var string $author_name Specify the commit author's name. - * @var string $content File content. - * @var string $commit_message Commit message. - * ) - * - * @return mixed - */ - public function createFile($project_id, array $parameters = []) - { - $resolver = new OptionsResolver(); - $resolver->setRequired('file_path'); - $resolver->setRequired('branch'); - $resolver->setDefined('start_branch'); - $resolver->setDefined('encoding') - ->setAllowedValues('encoding', ['text', 'base64']) - ; - $resolver->setDefined('author_email'); - $resolver->setDefined('author_name'); - $resolver->setRequired('content'); - $resolver->setRequired('commit_message'); - - $resolved = $resolver->resolve($parameters); - - return $this->post($this->getProjectPath($project_id, 'repository/files/'.$this->encodePath($resolved['file_path'])), $resolved); - } - - /** - * @param int $project_id - * @param array $parameters ( - * - * @var string $file_path Url encoded full path to new file. Ex. lib%2Fclass%2Erb. - * @var string $branch Name of the branch. - * @var string $start_branch Name of the branch to start the new commit from. - * @var string $encoding Change encoding to 'base64'. Default is text. - * @var string $author_email Specify the commit author's email address. - * @var string $author_name Specify the commit author's name. - * @var string $content File content. - * @var string $commit_message Commit message. - * @var string $last_commit_id Last known file commit id. - * ) - * - * @return mixed - */ - public function updateFile($project_id, array $parameters = []) - { - $resolver = new OptionsResolver(); - $resolver->setRequired('file_path'); - $resolver->setRequired('branch'); - $resolver->setDefined('start_branch'); - $resolver->setDefined('encoding') - ->setAllowedValues('encoding', ['text', 'base64']) - ; - $resolver->setDefined('author_email'); - $resolver->setDefined('author_name'); - $resolver->setRequired('content'); - $resolver->setRequired('commit_message'); - $resolver->setDefined('last_commit_id'); - - $resolved = $resolver->resolve($parameters); - - return $this->put($this->getProjectPath($project_id, 'repository/files/'.$this->encodePath($resolved['file_path'])), $resolved); - } - - /** - * @param int $project_id - * @param array $parameters ( - * - * @var string $file_path Url encoded full path to new file. Ex. lib%2Fclass%2Erb. - * @var string $branch Name of the branch. - * @var string $start_branch Name of the branch to start the new commit from. - * @var string $author_email Specify the commit author's email address. - * @var string $author_name Specify the commit author's name. - * @var string $commit_message Commit message. - * ) - * - * @return mixed - */ - public function deleteFile($project_id, array $parameters = []) - { - $resolver = new OptionsResolver(); - $resolver->setRequired('file_path'); - $resolver->setRequired('branch'); - $resolver->setDefined('start_branch'); - $resolver->setDefined('author_email'); - $resolver->setDefined('author_name'); - $resolver->setRequired('commit_message'); - - $resolved = $resolver->resolve($parameters); - - return $this->delete($this->getProjectPath($project_id, 'repository/files/'.$this->encodePath($resolved['file_path'])), $resolved); - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Snippets.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Snippets.php index e17c0cba754aaafb8cbd437eb4fe7d16b0f33f85..00921128c8922b3354885c8ddf48a27b08d165f0 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Snippets.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Snippets.php @@ -67,15 +67,4 @@ class Snippets extends AbstractApi { return $this->delete($this->getProjectPath($project_id, 'snippets/'.$this->encodePath($snippet_id))); } - - /** - * @param int $project_id - * @param int $snippet_id - * - * @return mixed - */ - public function awardEmoji($project_id, $snippet_id) - { - return $this->get($this->getProjectPath($project_id, 'snippets/'.$this->encodePath($snippet_id).'/award_emoji')); - } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Users.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Users.php index b23430078e58a447f01a17dea4e660058996a7ea..a3e31ff5cfcd908bb394b4121c1e2f759260ad9d 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Users.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Api/Users.php @@ -3,71 +3,55 @@ class Users extends AbstractApi { /** - * @param array $parameters ( - * - * @var string $search Search for user by email or username. - * @var string $username Lookup for user by username. - * @var bool $external Search for external users only. - * @var string $extern_uid Lookup for users by external uid. - * @var string $provider Lookup for users by provider. - * @var \DateTimeInterface $created_before Return users created before the given time (inclusive). - * @var \DateTimeInterface $created_after Return users created after the given time (inclusive). - * @var bool $active Return only active users. It does not support filtering inactive users. - * @var bool $blocked Return only blocked users. It does not support filtering non-blocked users. - * ) - * - * @return mixed - */ - public function all(array $parameters = []) - { - $resolver = $this->createOptionsResolver(); - $datetimeNormalizer = function (\DateTimeInterface $value) { - return $value->format('c'); - }; - - $resolver->setDefined('search'); - $resolver->setDefined('username'); - $resolver->setDefined('external') - ->setAllowedTypes('external', 'bool') - ; - $resolver->setDefined('extern_uid'); - $resolver->setDefined('provider'); - $resolver->setDefined('created_before') - ->setAllowedTypes('created_before', \DateTimeInterface::class) - ->setNormalizer('created_before', $datetimeNormalizer) - ; - $resolver->setDefined('created_after') - ->setAllowedTypes('created_after', \DateTimeInterface::class) - ->setNormalizer('created_after', $datetimeNormalizer) - ; - $resolver->setDefined('active') - ->setAllowedTypes('active', 'bool') - ->setAllowedValues('active', true) - ; - $resolver->setDefined('blocked') - ->setAllowedTypes('blocked', 'bool') - ->setAllowedValues('blocked', true) - ; - - - return $this->get('users', $resolver->resolve($parameters)); + * @param null|true $active + * @param int $page + * @param int $per_page + * @return mixed + */ + public function all($active = null, $page = 1, $per_page = self::PER_PAGE) + { + return $this->get('users', array( + 'active' => $active, + 'page' => $page, + 'per_page' => $per_page + )); } /** - * @param int $id + * @param string $username * @return mixed */ - public function show($id) + public function lookup($username) { - return $this->get('users/'.$this->encodePath($id)); + return $this->get('users', array( + 'username' => $username + )); } /** + * @param string $query + * @param null|true $active + * @param int $page + * @param int $per_page * @return mixed */ - public function user() + public function search($query, $active = null, $page = 1, $per_page = self::PER_PAGE) { - return $this->get('user'); + return $this->get('users', array( + 'search' => $query, + 'active' => $active, + 'page' => $page, + 'per_page' => $per_page + )); + } + + /** + * @param int $id + * @return mixed + */ + public function show($id) + { + return $this->get('users/'.$this->encodePath($id)); } /** @@ -109,7 +93,7 @@ class Users extends AbstractApi */ public function block($id) { - return $this->post('users/'.$this->encodePath($id).'/block'); + return $this->put('users/'.$this->encodePath($id).'/block'); } /** @@ -118,7 +102,7 @@ class Users extends AbstractApi */ public function unblock($id) { - return $this->post('users/'.$this->encodePath($id).'/unblock'); + return $this->put('users/'.$this->encodePath($id).'/unblock'); } /** diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Client.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Client.php index 08679e0116bd2d58ec3ab415e340074d8faabbbb..5f0fd395091a49128cbcbd4af974e42a3f20ba0a 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Client.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Client.php @@ -1,18 +1,14 @@ <?php namespace Gitlab; +use Buzz\Client\Curl; +use Buzz\Client\ClientInterface; + use Gitlab\Api\AbstractApi; use Gitlab\Exception\InvalidArgumentException; -use Gitlab\HttpClient\Builder; -use Gitlab\HttpClient\Plugin\ApiVersion; -use Gitlab\HttpClient\Plugin\History; -use Gitlab\HttpClient\Plugin\Authentication; -use Gitlab\HttpClient\Plugin\GitlabExceptionThrower; -use Http\Client\Common\HttpMethodsClient; -use Http\Client\Common\Plugin\AddHostPlugin; -use Http\Client\Common\Plugin\HeaderDefaultsPlugin; -use Http\Client\Common\Plugin\HistoryPlugin; -use Http\Client\HttpClient; -use Http\Discovery\UriFactoryDiscovery; +use Gitlab\HttpClient\HttpClient; +use Gitlab\HttpClient\HttpClientInterface; +use Gitlab\HttpClient\Listener\AuthListener; +use Gitlab\HttpClient\Listener\PaginationListener; /** * Simple API wrapper for Gitlab @@ -21,7 +17,6 @@ use Http\Discovery\UriFactoryDiscovery; * * @property-read \Gitlab\Api\Groups $groups * @property-read \Gitlab\Api\Issues $issues - * @property-read \Gitlab\Api\Jobs $jobs * @property-read \Gitlab\Api\MergeRequests $merge_requests * @property-read \Gitlab\Api\MergeRequests $mr * @property-read \Gitlab\Api\Milestones $milestones @@ -59,190 +54,48 @@ class Client const AUTH_OAUTH_TOKEN = 'oauth_token'; /** - * @var History - */ - private $responseHistory; - - /** - * @var Builder - */ - private $httpClientBuilder; - - /** - * Instantiate a new Gitlab client - * - * @param Builder $httpClientBuilder + * @var array */ - public function __construct(Builder $httpClientBuilder = null) - { - $this->responseHistory = new History(); - $this->httpClientBuilder = $httpClientBuilder ?: new Builder(); + private $options = array( + 'user_agent' => 'php-gitlab-api (http://github.com/m4tthumphrey/php-gitlab-api)', + 'timeout' => 60 + ); - $this->httpClientBuilder->addPlugin(new GitlabExceptionThrower()); - $this->httpClientBuilder->addPlugin(new HistoryPlugin($this->responseHistory)); - $this->httpClientBuilder->addPlugin(new ApiVersion()); - $this->httpClientBuilder->addPlugin(new HeaderDefaultsPlugin([ - 'User-Agent' => 'php-gitlab-api (http://github.com/m4tthumphrey/php-gitlab-api)', - ])); - - $this->setUrl('https://gitlab.com'); - } + private $baseUrl; /** - * Create a Gitlab\Client using an url. + * The Buzz instance used to communicate with Gitlab * - * @param string $url - * - * @return Client + * @var HttpClient */ - public static function create($url) - { - $client = new self(); - $client->setUrl($url); - - return $client; - } + private $httpClient; /** - * Create a Gitlab\Client using an HttpClient. - * - * @param HttpClient $httpClient + * Instantiate a new Gitlab client * - * @return Client - */ - public static function createWithHttpClient(HttpClient $httpClient) - { - $builder = new Builder($httpClient); - - return new self($builder); - } - - /** - * @return Api\DeployKeys - */ - public function deployKeys() - { - return new Api\DeployKeys($this); - } - - /** - * @return Api\Groups - */ - public function groups() - { - return new Api\Groups($this); - } - - /** - * @return Api\Issues - */ - public function issues() - { - return new Api\Issues($this); - } - - /** - * @return Api\IssueBoards - */ - public function issueBoards() - { - return new Api\IssueBoards($this); - } - - /** - * @return Api\Jobs - */ - public function jobs() - { - return new Api\Jobs($this); - } - - /** - * @return Api\MergeRequests - */ - public function mergeRequests() - { - return new Api\MergeRequests($this); - } - - /** - * @return Api\Milestones - */ - public function milestones() - { - return new Api\Milestones($this); - } - - /** - * @return Api\ProjectNamespaces - */ - public function namespaces() - { - return new Api\ProjectNamespaces($this); - } - - /** - * @return Api\Projects - */ - public function projects() - { - return new Api\Projects($this); - } - - /** - * @return Api\Repositories - */ - public function repositories() - { - return new Api\Repositories($this); - } - - /** - * @return Api\RepositoryFiles - */ - public function repositoryFiles() - { - return new Api\RepositoryFiles($this); - } - - /** - * @return Api\Snippets - */ - public function snippets() - { - return new Api\Snippets($this); - } - - /** - * @return Api\SystemHooks + * @param string $baseUrl + * @param null|ClientInterface $httpClient Buzz client + * @param array $options */ - public function systemHooks() + public function __construct($baseUrl, ClientInterface $httpClient = null, array $options = array()) { - return new Api\SystemHooks($this); - } + foreach ($options as $name => $value) { + $this->setOption($name, $value); + } - /** - * @return Api\Users - */ - public function users() - { - return new Api\Users($this); - } + $httpClient = $httpClient ?: new Curl(); + $httpClient->setTimeout($this->options['timeout']); + $httpClient->setVerifyPeer(false); - /** - * @return Api\Keys - */ - public function keys() - { - return new Api\Keys($this); - } + $this->baseUrl = $baseUrl; + $this->httpClient = new HttpClient($this->baseUrl, $this->options, $httpClient); - /** - * @return Api\Tags - */ - public function tags() - { - return new Api\Tags($this); + /** + * a Pagination listener on Response + */ + $this->httpClient->addListener( + new PaginationListener() + ); } /** @@ -256,58 +109,68 @@ class Client switch ($name) { case 'deploy_keys': - return $this->deployKeys(); + $api = new Api\DeployKeys($this); + break; case 'groups': - return $this->groups(); + $api = new Api\Groups($this); + break; case 'issues': - return $this->issues(); - - case 'board': - case 'issue_boards': - return $this->issueBoards(); - case 'jobs': - return $this->jobs(); + $api = new Api\Issues($this); + break; case 'mr': case 'merge_requests': - return $this->mergeRequests(); + $api = new Api\MergeRequests($this); + break; case 'milestones': case 'ms': - return $this->milestones(); + $api = new Api\Milestones($this); + break; case 'namespaces': case 'ns': - return $this->namespaces(); + $api = new Api\ProjectNamespaces($this); + break; case 'projects': - return $this->projects(); + $api = new Api\Projects($this); + break; case 'repo': case 'repositories': - return $this->repositories(); + $api = new Api\Repositories($this); + break; case 'snippets': - return $this->snippets(); + $api = new Api\Snippets($this); + break; case 'hooks': case 'system_hooks': - return $this->systemHooks(); + $api = new Api\SystemHooks($this); + break; case 'users': - return $this->users(); + $api = new Api\Users($this); + break; case 'keys': - return $this->keys(); + $api = new Api\Keys($this); + break; case 'tags': - return $this->tags(); + $api = new Api\Tags($this); + break; default: throw new InvalidArgumentException('Invalid endpoint: "'.$name.'"'); + } + + return $api; } /** @@ -320,47 +183,117 @@ class Client */ public function authenticate($token, $authMethod = self::AUTH_URL_TOKEN, $sudo = null) { - $this->httpClientBuilder->removePlugin(Authentication::class); - $this->httpClientBuilder->addPlugin(new Authentication($authMethod, $token, $sudo)); + $this->httpClient->addListener( + new AuthListener( + $authMethod, + $token, + $sudo + ) + ); + + return $this; + } + + /** + * @return HttpClient + */ + public function getHttpClient() + { + return $this->httpClient; + } + + /** + * @param HttpClientInterface $httpClient + * @return $this + */ + public function setHttpClient(HttpClientInterface $httpClient) + { + $this->httpClient = $httpClient; return $this; } /** * @param string $url + * @return $this + */ + public function setBaseUrl($url) + { + $this->baseUrl = $url; + + return $this; + } + + /** + * @return string + */ + public function getBaseUrl() + { + return $this->baseUrl; + } + + /** + * Clears used headers * * @return $this */ - public function setUrl($url) + public function clearHeaders() { - $this->httpClientBuilder->removePlugin(AddHostPlugin::class); - $this->httpClientBuilder->addPlugin(new AddHostPlugin(UriFactoryDiscovery::find()->createUri($url))); + $this->httpClient->clearHeaders(); return $this; } /** - * @param string $api - * @return AbstractApi + * @param array $headers + * @return $this */ - public function __get($api) + public function setHeaders(array $headers) { - return $this->api($api); + $this->httpClient->setHeaders($headers); + + return $this; } /** - * @return HttpMethodsClient + * @param string $name + * + * @return mixed + * + * @throws InvalidArgumentException */ - public function getHttpClient() + public function getOption($name) { - return $this->httpClientBuilder->getHttpClient(); + if (!array_key_exists($name, $this->options)) { + throw new InvalidArgumentException(sprintf('Undefined option called: "%s"', $name)); + } + + return $this->options[$name]; } /** - * @return History + * @param string $name + * @param mixed $value + * @throws InvalidArgumentException + * @return $this */ - public function getResponseHistory() + public function setOption($name, $value) { - return $this->responseHistory; + if (!array_key_exists($name, $this->options)) { + throw new InvalidArgumentException(sprintf('Undefined option called: "%s"', $name)); + } + + $this->options[$name] = $value; + + return $this; + } + + /** + * @param string $api + * @return AbstractApi + */ + public function __get($api) + { + return $this->api($api); } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/ErrorException.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/ErrorException.php index 49e1a1769bef3c53ed6832df3b635fd2aeac3c6c..322a7082da842e0a605b6ade666f9ecc23f54aec 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/ErrorException.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/ErrorException.php @@ -7,4 +7,5 @@ */ class ErrorException extends \ErrorException { + } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/InvalidArgumentException.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/InvalidArgumentException.php index 86f9d60e1d7ad03d2f35f5040ae75230e4a25f60..892a6dc4bd945fbe0ff6889d93aeb9f45906c721 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/InvalidArgumentException.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/InvalidArgumentException.php @@ -7,4 +7,5 @@ */ class InvalidArgumentException extends \InvalidArgumentException { + } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/RuntimeException.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/RuntimeException.php index ace4bcca436541a4294907db062e85f660607cbd..9d938e2cc3948e6c7858fc020d4cb753d828f709 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/RuntimeException.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/RuntimeException.php @@ -7,4 +7,5 @@ */ class RuntimeException extends \RuntimeException { + } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/ValidationFailedException.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/ValidationFailedException.php index c6ed9b0b4186fec62b3d3f3a4780b2260ced9481..9ce6635fe58795a4b740ea1a8208d04cfac8d2bd 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/ValidationFailedException.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Exception/ValidationFailedException.php @@ -7,4 +7,5 @@ */ class ValidationFailedException extends ErrorException { + } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Builder.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Builder.php deleted file mode 100644 index 15be1ff12bb8e04fcd85fa65122440cf1bf430b5..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Builder.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -namespace Gitlab\HttpClient; - -use Http\Client\Common\HttpMethodsClient; -use Http\Client\Common\Plugin; -use Http\Client\Common\PluginClient; -use Http\Client\HttpClient; -use Http\Discovery\HttpClientDiscovery; -use Http\Discovery\MessageFactoryDiscovery; -use Http\Discovery\StreamFactoryDiscovery; -use Http\Message\MessageFactory; -use Http\Message\RequestFactory; -use Http\Message\StreamFactory; - -/** - * A builder that builds the API client. - * This will allow you to fluently add and remove plugins. - * - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - */ -class Builder -{ - /** - * The object that sends HTTP messages. - * - * @var HttpClient - */ - private $httpClient; - - /** - * A HTTP client with all our plugins. - * - * @var HttpMethodsClient - */ - private $pluginClient; - - /** - * @var MessageFactory - */ - private $requestFactory; - - /** - * @var StreamFactory - */ - private $streamFactory; - - /** - * True if we should create a new Plugin client at next request. - * - * @var bool - */ - private $httpClientModified = true; - - /** - * @var Plugin[] - */ - private $plugins = []; - - /** - * @param HttpClient $httpClient - * @param RequestFactory $requestFactory - * @param StreamFactory $streamFactory - */ - public function __construct( - HttpClient $httpClient = null, - RequestFactory $requestFactory = null, - StreamFactory $streamFactory = null - ) { - $this->httpClient = $httpClient ?: HttpClientDiscovery::find(); - $this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find(); - $this->streamFactory = $streamFactory ?: StreamFactoryDiscovery::find(); - } - - /** - * @return HttpMethodsClient - */ - public function getHttpClient() - { - if ($this->httpClientModified) { - $this->httpClientModified = false; - - $this->pluginClient = new HttpMethodsClient( - new PluginClient($this->httpClient, $this->plugins), - $this->requestFactory - ); - } - - return $this->pluginClient; - } - - /** - * Add a new plugin to the end of the plugin chain. - * - * @param Plugin $plugin - */ - public function addPlugin(Plugin $plugin) - { - $this->plugins[] = $plugin; - $this->httpClientModified = true; - } - - /** - * Remove a plugin by its fully qualified class name (FQCN). - * - * @param string $fqcn - */ - public function removePlugin($fqcn) - { - foreach ($this->plugins as $idx => $plugin) { - if ($plugin instanceof $fqcn) { - unset($this->plugins[$idx]); - $this->httpClientModified = true; - } - } - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Message/QueryStringBuilder.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Message/QueryStringBuilder.php deleted file mode 100644 index 03e16a32610668223fe1d467c637fb74d65845cb..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Message/QueryStringBuilder.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -namespace Gitlab\HttpClient\Message; - -final class QueryStringBuilder -{ - /** - * Encode a query as a query string according to RFC 3986. Indexed arrays are encoded using - * empty squared brackets ([]) unlike http_build_query. - * - * @param mixed $query - * - * @return string - */ - public static function build($query) - { - if (!is_array($query)) { - return static::rawurlencode($query); - } - return implode('&', array_map(function ($value, $key) { - return static::encode($value, $key); - }, $query, array_keys($query))); - } - - /** - * Encode a value - * @param mixed $query - * @param string $prefix - * - * @return string - */ - private static function encode($query, $prefix) - { - if (!is_array($query)) { - return static::rawurlencode($prefix).'='.static::rawurlencode($query); - } - - $isIndexedArray = static::isIndexedArray($query); - return implode('&', array_map(function ($value, $key) use ($prefix, $isIndexedArray) { - $prefix = $isIndexedArray ? $prefix.'[]' : $prefix.'['.$key.']'; - return static::encode($value, $prefix); - }, $query, array_keys($query))); - } - - /** - * Tell if the given array is an indexed one (i.e. contains only sequential integer keys starting from 0). - * - * @param array $query - * - * @return bool - */ - public static function isIndexedArray(array $query) - { - if (empty($query) || !isset($query[0])) { - return false; - } - - return array_keys($query) === range(0, count($query) - 1); - } - - /** - * Encode a value like rawurlencode, but return "0" when false is given. - * - * @param mixed $value - * - * @return string - */ - private static function rawurlencode($value) - { - if ($value === false) { - return '0'; - } - - return rawurlencode($value); - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Message/ResponseMediator.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Message/ResponseMediator.php deleted file mode 100644 index 16bd781f07f7179bc93d508e262724da8cddc4a6..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Message/ResponseMediator.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -namespace Gitlab\HttpClient\Message; - -use Psr\Http\Message\ResponseInterface; - -/** - * Utilities to parse response headers and content. - */ -class ResponseMediator -{ - /** - * Return the response body as a string or json array if content type is application/json. - *. - * @param ResponseInterface $response - * - * @return array|string - */ - public static function getContent(ResponseInterface $response) - { - $body = $response->getBody()->__toString(); - if (strpos($response->getHeaderLine('Content-Type'), 'application/json') === 0) { - $content = json_decode($body, true); - if (JSON_ERROR_NONE === json_last_error()) { - return $content; - } - } - - return $body; - } - - /** - * Extract pagination URIs from Link header. - * - * @param ResponseInterface $response - * - * @return array|null - */ - public static function getPagination(ResponseInterface $response) - { - if (!$response->hasHeader('Link')) { - return null; - } - - $header = self::getHeader($response, 'Link'); - $pagination = array(); - foreach (explode(',', $header) as $link) { - preg_match('/<(.*)>; rel="(.*)"/i', trim($link, ','), $match); - - if (3 === count($match)) { - $pagination[$match[2]] = $match[1]; - } - } - - return $pagination; - } - - - /** - * Get the value for a single header. - * - * @param ResponseInterface $response - * @param string $name - * - * @return string|null - */ - private static function getHeader(ResponseInterface $response, $name) - { - $headers = $response->getHeader($name); - - return array_shift($headers); - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/ApiVersion.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/ApiVersion.php deleted file mode 100644 index 46b20e402284357dd3ee81eee9f76b1dfd854d6d..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/ApiVersion.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - - -namespace Gitlab\HttpClient\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; - -/** - * Prefix requests path with /api/v4/ if required. - * - * @author Fabien Bourigault <bourigaultfabien@gmail.com> - */ -class ApiVersion implements Plugin -{ - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - $uri = $request->getUri(); - - if (substr($uri->getPath(), 0, 8) !== '/api/v4/') { - $request = $request->withUri($uri->withPath('/api/v4/'.$uri->getPath())); - } - - return $next($request); - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/Authentication.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/Authentication.php deleted file mode 100644 index aac0acc4a2e0c5a3a3cb585398bafa8dc68f6c66..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/Authentication.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -namespace Gitlab\HttpClient\Plugin; - -use Gitlab\Client; -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; - -/** - * Add authentication to the request. - * - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - * @author Fabien Bourigault <bourigaultfabien@gmail.com> - */ -class Authentication implements Plugin -{ - /** - * @var string - */ - private $method; - - /** - * @var string - */ - private $token; - - /** - * @var string|null - */ - private $sudo; - - /** - * @param string $method - * @param string $token - * @param string|null $sudo - */ - public function __construct($method, $token, $sudo = null) - { - $this->method = $method; - $this->token = $token; - $this->sudo = $sudo; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - switch ($this->method) { - case Client::AUTH_HTTP_TOKEN: - $request = $request->withHeader('PRIVATE-TOKEN', $this->token); - if (!is_null($this->sudo)) { - $request = $request->withHeader('SUDO', $this->sudo); - } - break; - - case Client::AUTH_URL_TOKEN: - $uri = $request->getUri(); - $query = $uri->getQuery(); - - $parameters = [ - 'private_token' => $this->token, - ]; - - if (!is_null($this->sudo)) { - $parameters['sudo'] = $this->sudo; - } - - $query .= empty($query) ? '' : '&'; - $query .= utf8_encode(http_build_query($parameters, '', '&')); - - $uri = $uri->withQuery($query); - $request = $request->withUri($uri); - break; - - case Client::AUTH_OAUTH_TOKEN: - $request = $request->withHeader('Authorization', 'Bearer '.$this->token); - if (!is_null($this->sudo)) { - $request = $request->withHeader('SUDO', $this->sudo); - } - break; - } - - return $next($request); - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/GitlabExceptionThrower.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/GitlabExceptionThrower.php deleted file mode 100644 index bb61e31219f9650a90e8e52980c1e94d666c1bf3..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/GitlabExceptionThrower.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -namespace Gitlab\HttpClient\Plugin; - -use Gitlab\Exception\ErrorException; -use Gitlab\Exception\RuntimeException; -use Gitlab\HttpClient\Message\ResponseMediator; -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; - -/** - * A plugin to remember the last response. - * - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - * @author Fabien Bourigault <bourigaultfabien@gmail.com> - */ -class GitlabExceptionThrower implements Plugin -{ - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - return $next($request)->then(function (ResponseInterface $response) { - if ($response->getStatusCode() >= 400 && $response->getStatusCode() < 600) { - $content = ResponseMediator::getContent($response); - if (is_array($content) && isset($content['message'])) { - if (400 == $response->getStatusCode()) { - $message = $this->parseMessage($content['message']); - - throw new ErrorException($message, 400); - } - } - - $errorMessage = null; - if (isset($content['error'])) { - $errorMessage = $content['error']; - if (is_array($content['error'])) { - $errorMessage = implode("\n", $content['error']); - } - } elseif (isset($content['message'])) { - $errorMessage = $this->parseMessage($content['message']); - } else { - $errorMessage = $content; - } - - throw new RuntimeException($errorMessage, $response->getStatusCode()); - } - - return $response; - }); - } - - /** - * @param mixed $message - * - * @return string - */ - private function parseMessage($message) - { - $string = $message; - - if (is_array($message)) { - $format = '"%s" %s'; - $errors = array(); - - foreach ($message as $field => $messages) { - if (is_array($messages)) { - $messages = array_unique($messages); - foreach ($messages as $error) { - $errors[] = sprintf($format, $field, $error); - } - } elseif (is_integer($field)) { - $errors[] = $messages; - } else { - $errors[] = sprintf($format, $field, $messages); - } - } - - $string = implode(', ', $errors); - } - - return $string; - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/History.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/History.php deleted file mode 100644 index 8412356fdae09fea78832a5593bba3f3c187ddf9..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/HttpClient/Plugin/History.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -namespace Gitlab\HttpClient\Plugin; - -use Http\Client\Common\Plugin\Journal; -use Http\Client\Exception; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; - -/** - * A plugin to remember the last response. - * - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - */ -class History implements Journal -{ - /** - * @var ResponseInterface - */ - private $lastResponse; - - /** - * @return ResponseInterface|null - */ - public function getLastResponse() - { - return $this->lastResponse; - } - - /** - * {@inheritdoc} - */ - public function addSuccess(RequestInterface $request, ResponseInterface $response) - { - $this->lastResponse = $response; - } - - /** - * {@inheritdoc} - */ - public function addFailure(RequestInterface $request, Exception $exception) - { - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Branch.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Branch.php index 8c7ef36b415c8bd39fd42f397e8b0e545e3d545e..23afebcfea987bf9ca5d6fa44baf446761568ef2 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Branch.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Branch.php @@ -1,7 +1,7 @@ <?php namespace Gitlab\Model; -use Gitlab\Api\Projects; use Gitlab\Client; +use Gitlab\Api\AbstractApi as Api; /** * Class Branch @@ -57,7 +57,7 @@ class Branch extends AbstractModel */ public function show() { - $data = $this->client->repositories()->branch($this->project->id, $this->name); + $data = $this->api('repositories')->branch($this->project->id, $this->name); return static::fromArray($this->getClient(), $this->project, $data); } @@ -69,7 +69,7 @@ class Branch extends AbstractModel */ public function protect($devPush = false, $devMerge = false) { - $data = $this->client->repositories()->protectBranch($this->project->id, $this->name, $devPush, $devMerge); + $data = $this->api('repositories')->protectBranch($this->project->id, $this->name, $devPush, $devMerge); return static::fromArray($this->getClient(), $this->project, $data); } @@ -79,7 +79,7 @@ class Branch extends AbstractModel */ public function unprotect() { - $data = $this->client->repositories()->unprotectBranch($this->project->id, $this->name); + $data = $this->api('repositories')->unprotectBranch($this->project->id, $this->name); return static::fromArray($this->getClient(), $this->project, $data); } @@ -89,21 +89,19 @@ class Branch extends AbstractModel */ public function delete() { - $this->client->repositories()->deleteBranch($this->project->id, $this->name); + $this->api('repositories')->deleteBranch($this->project->id, $this->name); return true; } /** - * @param array $parameters - * - * @see Projects::commits for available parameters. - * + * @param int $page + * @param int $per_page * @return Commit[] */ - public function commits(array $parameters = []) + public function commits($page = 1, $per_page = Api::PER_PAGE) { - return $this->project->commits($parameters); + return $this->project->commits($page, $per_page, $this->name); } /** @@ -114,7 +112,7 @@ class Branch extends AbstractModel */ public function createFile($file_path, $content, $commit_message) { - $data = $this->client->repositories()->createFile($this->project->id, $file_path, $content, $this->name, $commit_message); + $data = $this->api('repositories')->createFile($this->project->id, $file_path, $content, $this->name, $commit_message); return File::fromArray($this->getClient(), $this->project, $data); } @@ -127,7 +125,7 @@ class Branch extends AbstractModel */ public function updateFile($file_path, $content, $commit_message) { - $data = $this->client->repositories()->updateFile($this->project->id, $file_path, $content, $this->name, $commit_message); + $data = $this->api('repositories')->updateFile($this->project->id, $file_path, $content, $this->name, $commit_message); return File::fromArray($this->getClient(), $this->project, $data); } @@ -139,7 +137,7 @@ class Branch extends AbstractModel */ public function deleteFile($file_path, $commit_message) { - $this->client->repositories()->deleteFile($this->project->id, $file_path, $this->name, $commit_message); + $this->api('repositories')->deleteFile($this->project->id, $file_path, $this->name, $commit_message); return true; } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Group.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Group.php index 48923f18240edd64503cb22c99068c15ee919842..38891d6c1957886c9f22f16f9847ac73b4351fc9 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Group.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Group.php @@ -52,7 +52,7 @@ class Group extends AbstractModel */ public static function create(Client $client, $name, $path) { - $data = $client->groups()->create($name, $path); + $data = $client->api('groups')->create($name, $path); return static::fromArray($client, $data); } @@ -72,7 +72,7 @@ class Group extends AbstractModel */ public function show() { - $data = $this->client->groups()->show($this->id); + $data = $this->api('groups')->show($this->id); return Group::fromArray($this->getClient(), $data); } @@ -83,7 +83,7 @@ class Group extends AbstractModel */ public function transfer($project_id) { - $data = $this->client->groups()->transfer($this->id, $project_id); + $data = $this->api('groups')->transfer($this->id, $project_id); return Group::fromArray($this->getClient(), $data); } @@ -93,7 +93,7 @@ class Group extends AbstractModel */ public function members() { - $data = $this->client->groups()->members($this->id); + $data = $this->api('groups')->members($this->id); $members = array(); foreach ($data as $member) { @@ -110,7 +110,7 @@ class Group extends AbstractModel */ public function addMember($user_id, $access_level) { - $data = $this->client->groups()->addMember($this->id, $user_id, $access_level); + $data = $this->api('groups')->addMember($this->id, $user_id, $access_level); return User::fromArray($this->getClient(), $data); } @@ -121,7 +121,7 @@ class Group extends AbstractModel */ public function removeMember($user_id) { - $this->client->groups()->removeMember($this->id, $user_id); + $this->api('groups')->removeMember($this->id, $user_id); return true; } @@ -131,8 +131,9 @@ class Group extends AbstractModel */ public function projects() { - $data = $this->client->groups()->projects($this->id); - return Group::fromArray($this->getClient(), $data); + $data = $this->api('groups')->projects($this->id); + + return Group::fromArray($this->getClient(),$data); } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Hook.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Hook.php index d276982e2065d96ad108324f26064669ae168b5f..15bda3992286825d86ce990aee0804b963ab908d 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Hook.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Hook.php @@ -39,7 +39,7 @@ class Hook extends AbstractModel */ public static function create(Client $client, $url) { - $data = $client->systemHooks()->create($url); + $data = $client->api('system_hooks')->create($url); return static::fromArray($client, $data); } @@ -59,7 +59,7 @@ class Hook extends AbstractModel */ public function test() { - $this->client->systemHooks()->test($this->id); + $this->api('system_hooks')->test($this->id); return true; } @@ -69,7 +69,7 @@ class Hook extends AbstractModel */ public function delete() { - $this->client->systemHooks()->remove($this->id); + $this->api('system_hooks')->remove($this->id); return true; } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Issue.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Issue.php index 5b4724ddd5c0a3dfe1647b5e1fbac7a713ed2d74..86c7e2adda52c211fabbd724fe239536041df565 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Issue.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Issue.php @@ -80,7 +80,7 @@ class Issue extends AbstractModel implements Noteable */ public function show() { - $data = $this->client->issues()->show($this->project->id, $this->iid); + $data = $this->api('issues')->show($this->project->id, $this->id); return static::fromArray($this->getClient(), $this->project, $data); } @@ -91,7 +91,7 @@ class Issue extends AbstractModel implements Noteable */ public function update(array $params) { - $data = $this->client->issues()->update($this->project->id, $this->iid, $params); + $data = $this->api('issues')->update($this->project->id, $this->id, $params); return static::fromArray($this->getClient(), $this->project, $data); } @@ -135,7 +135,7 @@ class Issue extends AbstractModel implements Noteable */ public function addComment($comment) { - $data = $this->client->issues()->addComment($this->project->id, $this->iid, array( + $data = $this->api('issues')->addComment($this->project->id, $this->id, array( 'body' => $comment )); @@ -148,7 +148,7 @@ class Issue extends AbstractModel implements Noteable public function showComments() { $notes = array(); - $data = $this->client->issues()->showComments($this->project->id, $this->iid); + $data = $this->api('issues')->showComments($this->project->id, $this->id); foreach ($data as $note) { $notes[] = Note::fromArray($this->getClient(), $this, $note); diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Job.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Job.php deleted file mode 100644 index 586e3a31185baf94ec1ef05b5edc5bf087446084..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Job.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php namespace Gitlab\Model; - -use Gitlab\Client; - -/** - * Class Commit - * - * @property-read Commit $commit - * @property-read int $id - * @property-read string $coverage - * @property-read string $created_at - * @property-read string $artifacts_file - * @property-read string $finished_at - * @property-read string $name - * @property-read Pipeline $pipeline - * @property-read string $ref - * @property-read string $runner - * @property-read string $stage - * @property-read string $started_at - * @property-read string $status - * @property-read string|bool $tag - * @property-read User $user - */ -class Job extends AbstractModel -{ - /** - * @var array - */ - protected static $properties = array( - 'id', - 'commit', - 'coverage', - 'created_at', - 'artifacts_file', - 'finished_at', - 'name', - 'pipeline', - 'ref', - 'runner', - 'stage', - 'started_at', - 'status', - 'tag', - 'user' - ); - - /** - * @param Client $client - * @param Project $project - * @param array $data - * @return Job - */ - public static function fromArray(Client $client, Project $project, array $data) - { - $job = new static($project, $data['id'], $client); - - if (isset($data['user'])) { - $data['user'] = User::fromArray($client, $data['user']); - } - - if (isset($data['commit'])) { - $data['commit'] = Commit::fromArray($client, $project, $data['commit']); - } - - if (isset($data['pipeline'])) { - $data['pipeline'] = Pipeline::fromArray($client, $project, $data['pipeline']); - } - - return $job->hydrate($data); - } - - /** - * @param Project $project - * @param int $id - * @param Client $client - */ - public function __construct(Project $project, $id = null, Client $client = null) - { - $this->setClient($client); - $this->setData('project', $project); - $this->setData('id', $id); - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/MergeRequest.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/MergeRequest.php index 03251f3b01dca2d412c1cb5b7fb0631196b14f92..686b47a7d296d0e36cc7f9283df46621c2e75c60 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/MergeRequest.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/MergeRequest.php @@ -90,14 +90,14 @@ class MergeRequest extends AbstractModel implements Noteable /** * @param Project $project - * @param int $iid + * @param int $id * @param Client $client */ - public function __construct(Project $project, $iid = null, Client $client = null) + public function __construct(Project $project, $id = null, Client $client = null) { $this->setClient($client); $this->setData('project', $project); - $this->setData('iid', $iid); + $this->setData('id', $id); } /** @@ -105,7 +105,7 @@ class MergeRequest extends AbstractModel implements Noteable */ public function show() { - $data = $this->client->mergeRequests()->show($this->project->id, $this->iid); + $data = $this->api('mr')->show($this->project->id, $this->id); return static::fromArray($this->getClient(), $this->project, $data); } @@ -116,7 +116,7 @@ class MergeRequest extends AbstractModel implements Noteable */ public function update(array $params) { - $data = $this->client->mergeRequests()->update($this->project->id, $this->iid, $params); + $data = $this->api('mr')->update($this->project->id, $this->id, $params); return static::fromArray($this->getClient(), $this->project, $data); } @@ -160,7 +160,7 @@ class MergeRequest extends AbstractModel implements Noteable */ public function merge($message = null) { - $data = $this->client->mergeRequests()->merge($this->project->id, $this->iid, array( + $data = $this->api('mr')->merge($this->project->id, $this->id, array( 'merge_commit_message' => $message )); @@ -183,7 +183,7 @@ class MergeRequest extends AbstractModel implements Noteable */ public function addComment($comment) { - $data = $this->client->mergeRequests()->addComment($this->project->id, $this->iid, $comment); + $data = $this->api('mr')->addComment($this->project->id, $this->id, $comment); return Note::fromArray($this->getClient(), $this, $data); } @@ -194,7 +194,7 @@ class MergeRequest extends AbstractModel implements Noteable public function showComments() { $notes = array(); - $data = $this->client->mergeRequests()->showComments($this->project->id, $this->iid); + $data = $this->api('mr')->showComments($this->project->id, $this->id); foreach ($data as $note) { $notes[] = Note::fromArray($this->getClient(), $this, $note); @@ -220,7 +220,7 @@ class MergeRequest extends AbstractModel implements Noteable */ public function changes() { - $data = $this->client->mergeRequests()->changes($this->project->id, $this->iid); + $data = $this->api('mr')->changes($this->project->id, $this->id); return static::fromArray($this->getClient(), $this->project, $data); } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Milestone.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Milestone.php index 8b07d38af8a51dd330abb9738ac442bea872ee30..c59afca38bf63f02c65335b55c5112d15e56ffd8 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Milestone.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Milestone.php @@ -11,7 +11,6 @@ use Gitlab\Client; * @property-read string $title * @property-read string $description * @property-read string $due_date - * @property-read string $start_date * @property-read string $state * @property-read bool $closed * @property-read string $updated_at @@ -31,7 +30,6 @@ class Milestone extends AbstractModel 'title', 'description', 'due_date', - 'start_date', 'state', 'closed', 'updated_at', @@ -68,7 +66,7 @@ class Milestone extends AbstractModel */ public function show() { - $data = $this->client->milestones()->show($this->project->id, $this->id); + $data = $this->api('milestones')->show($this->project->id, $this->id); return static::fromArray($this->getClient(), $this->project, $data); } @@ -79,7 +77,7 @@ class Milestone extends AbstractModel */ public function update(array $params) { - $data = $this->client->milestones()->update($this->project->id, $this->id, $params); + $data = $this->api('milestones')->update($this->project->id, $this->id, $params); return static::fromArray($this->getClient(), $this->project, $data); } @@ -105,7 +103,7 @@ class Milestone extends AbstractModel */ public function issues() { - $data = $this->client->milestones()->issues($this->project->id, $this->id); + $data = $this->api('milestones')->issues($this->project->id, $this->id); $issues = array(); foreach ($data as $issue) { diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Pipeline.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Pipeline.php deleted file mode 100644 index efeccbc9879f78fe2a50df6b51ba0987c6c1ed22..0000000000000000000000000000000000000000 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Pipeline.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php namespace Gitlab\Model; - -use Gitlab\Client; - -/** - * Class Commit - * - * @property-read int $id - * @property-read string $ref - * @property-read string $sha - * @property-read string $status - */ -class Pipeline extends AbstractModel -{ - /** - * @var array - */ - protected static $properties = array( - 'id', - 'ref', - 'sha', - 'status' - ); - - /** - * @param Client $client - * @param Project $project - * @param array $data - * @return Pipeline - */ - public static function fromArray(Client $client, Project $project, array $data) - { - $pipeline = new static($project, $data['id'], $client); - - return $pipeline->hydrate($data); - } - - /** - * @param Project $project - * @param int $id - * @param Client $client - */ - public function __construct(Project $project, $id = null, Client $client = null) - { - $this->setClient($client); - $this->setData('project', $project); - $this->setData('id', $id); - } -} diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Project.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Project.php index 3b62a9f7c262899687735fc1ec1fdef2b3d90d89..44fa9a7eed19bc91d715b68f57da4683008d53a7 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Project.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Project.php @@ -1,8 +1,8 @@ <?php namespace Gitlab\Model; -use Gitlab\Api\Projects; -use Gitlab\Api\Repositories; +use Gitlab\Api\MergeRequests; use Gitlab\Client; +use Gitlab\Api\AbstractApi as Api; /** * Class Project @@ -29,7 +29,6 @@ use Gitlab\Client; * @property-read int $greatest_access_level * @property-read string $last_activity_at * @property-read string $tag_list - * @property-read string $avatar_url * @property-read User $owner * @property-read ProjectNamespace $namespace */ @@ -62,8 +61,7 @@ class Project extends AbstractModel 'greatest_access_level', 'last_activity_at', 'snippets_enabled', - 'tag_list', - 'avatar_url' + 'tag_list' ); /** @@ -95,7 +93,7 @@ class Project extends AbstractModel */ public static function create(Client $client, $name, array $params = array()) { - $data = $client->projects()->create($name, $params); + $data = $client->api('projects')->create($name, $params); return static::fromArray($client, $data); } @@ -109,7 +107,7 @@ class Project extends AbstractModel */ public static function createForUser($user_id, Client $client, $name, array $params = array()) { - $data = $client->projects()->createForUser($user_id, $name, $params); + $data = $client->api('projects')->createForUser($user_id, $name, $params); return static::fromArray($client, $data); } @@ -128,7 +126,7 @@ class Project extends AbstractModel */ public function show() { - $data = $this->client->projects()->show($this->id); + $data = $this->api('projects')->show($this->id); return static::fromArray($this->getClient(), $data); } @@ -139,7 +137,7 @@ class Project extends AbstractModel */ public function update(array $params) { - $data = $this->client->projects()->update($this->id, $params); + $data = $this->api('projects')->update($this->id, $params); return static::fromArray($this->getClient(), $data); } @@ -149,7 +147,7 @@ class Project extends AbstractModel */ public function archive() { - $data = $this->client->projects()->archive($this->id); + $data = $this->api("projects")->archive($this->id); return static::fromArray($this->getClient(), $data); } @@ -159,7 +157,7 @@ class Project extends AbstractModel */ public function unarchive() { - $data = $this->client->projects()->unarchive($this->id); + $data = $this->api("projects")->unarchive($this->id); return static::fromArray($this->getClient(), $data); } @@ -169,7 +167,7 @@ class Project extends AbstractModel */ public function remove() { - $this->client->projects()->remove($this->id); + $this->api('projects')->remove($this->id); return true; } @@ -180,7 +178,7 @@ class Project extends AbstractModel */ public function members($username_query = null) { - $data = $this->client->projects()->members($this->id, $username_query); + $data = $this->api('projects')->members($this->id, $username_query); $members = array(); foreach ($data as $member) { @@ -196,7 +194,7 @@ class Project extends AbstractModel */ public function member($user_id) { - $data = $this->client->projects()->member($this->id, $user_id); + $data = $this->api('projects')->member($this->id, $user_id); return User::fromArray($this->getClient(), $data); } @@ -208,7 +206,7 @@ class Project extends AbstractModel */ public function addMember($user_id, $access_level) { - $data = $this->client->projects()->addMember($this->id, $user_id, $access_level); + $data = $this->api('projects')->addMember($this->id, $user_id, $access_level); return User::fromArray($this->getClient(), $data); } @@ -220,7 +218,7 @@ class Project extends AbstractModel */ public function saveMember($user_id, $access_level) { - $data = $this->client->projects()->saveMember($this->id, $user_id, $access_level); + $data = $this->api('projects')->saveMember($this->id, $user_id, $access_level); return User::fromArray($this->getClient(), $data); } @@ -231,21 +229,19 @@ class Project extends AbstractModel */ public function removeMember($user_id) { - $this->client->projects()->removeMember($this->id, $user_id); + $this->api('projects')->removeMember($this->id, $user_id); return true; } /** - * @param array $parameters - * - * @see Projects::hooks() for available parameters. - * + * @param int $page + * @param int $per_page * @return ProjectHook[] */ - public function hooks(array $parameters = []) + public function hooks($page = 1, $per_page = Api::PER_PAGE) { - $data = $this->client->projects()->hooks($this->id, $parameters); + $data = $this->api('projects')->hooks($this->id, $page, $per_page); $hooks = array(); foreach ($data as $hook) { @@ -273,7 +269,7 @@ class Project extends AbstractModel */ public function addHook($url, array $events = array()) { - $data = $this->client->projects()->addHook($this->id, $url, $events); + $data = $this->api('projects')->addHook($this->id, $url, $events); return ProjectHook::fromArray($this->getClient(), $this, $data); } @@ -304,9 +300,9 @@ class Project extends AbstractModel /** * @return Key[] */ - public function deployKeys() + public function keys() { - $data = $this->client->projects()->deployKeys($this->id); + $data = $this->api('projects')->keys($this->id); $keys = array(); foreach ($data as $key) { @@ -320,9 +316,9 @@ class Project extends AbstractModel * @param int $key_id * @return Key */ - public function deployKey($key_id) + public function key($key_id) { - $data = $this->client->projects()->deployKey($this->id, $key_id); + $data = $this->api('projects')->key($this->id, $key_id); return Key::fromArray($this->getClient(), $data); } @@ -330,12 +326,11 @@ class Project extends AbstractModel /** * @param string $title * @param string $key - * @param bool $canPush * @return Key */ - public function addDeployKey($title, $key, $canPush = false) + public function addKey($title, $key) { - $data = $this->client->projects()->addDeployKey($this->id, $title, $key, $canPush); + $data = $this->api('projects')->addKey($this->id, $title, $key); return Key::fromArray($this->getClient(), $data); } @@ -344,9 +339,20 @@ class Project extends AbstractModel * @param string $key_id * @return bool */ - public function deleteDeployKey($key_id) + public function removeKey($key_id) + { + $this->api('projects')->removeKey($this->id, $key_id); + + return true; + } + + /** + * @param string $key_id + * @return bool + */ + public function enableKey($key_id) { - $this->client->projects()->deleteDeployKey($this->id, $key_id); + $this->api('projects')->enableKey($this->id, $key_id); return true; } @@ -355,9 +361,9 @@ class Project extends AbstractModel * @param string $key_id * @return bool */ - public function enableDeployKey($key_id) + public function disableKey($key_id) { - $this->client->projects()->enableDeployKey($this->id, $key_id); + $this->api('projects')->disableKey($this->id, $key_id); return true; } @@ -369,7 +375,7 @@ class Project extends AbstractModel */ public function createBranch($name, $ref) { - $data = $this->client->repositories()->createBranch($this->id, $name, $ref); + $data = $this->api('repositories')->createBranch($this->id, $name, $ref); return Branch::fromArray($this->getClient(), $this, $data); } @@ -380,7 +386,7 @@ class Project extends AbstractModel */ public function deleteBranch($name) { - $this->client->repositories()->deleteBranch($this->id, $name); + $this->api('repositories')->deleteBranch($this->id, $name); return true; } @@ -390,7 +396,7 @@ class Project extends AbstractModel */ public function branches() { - $data = $this->client->repositories()->branches($this->id); + $data = $this->api('repo')->branches($this->id); $branches = array(); foreach ($data as $branch) { @@ -443,7 +449,7 @@ class Project extends AbstractModel */ public function tags() { - $data = $this->client->repositories()->tags($this->id); + $data = $this->api('repo')->tags($this->id); $tags = array(); foreach ($data as $tag) { @@ -454,15 +460,14 @@ class Project extends AbstractModel } /** - * @param array $parameters - * - * @see Repositories::commits() for available parameters. - * + * @param int $page + * @param int $per_page + * @param string $ref_name * @return Commit[] */ - public function commits(array $parameters = []) + public function commits($page = 0, $per_page = Api::PER_PAGE, $ref_name = null) { - $data = $this->client->repositories()->commits($this->id, $parameters); + $data = $this->api('repo')->commits($this->id, $page, $per_page, $ref_name); $commits = array(); foreach ($data as $commit) { @@ -478,22 +483,20 @@ class Project extends AbstractModel */ public function commit($sha) { - $data = $this->client->repositories()->commit($this->id, $sha); + $data = $this->api('repo')->commit($this->id, $sha); return Commit::fromArray($this->getClient(), $this, $data); } /** * @param string $ref - * @param array $parameters - * - * @see Repositories::commitComments() for available parameters. - * + * @param int $page + * @param int $per_page * @return Commit[] */ - public function commitComments($ref, array $parameters = []) + public function commitComments($ref, $page = 0, $per_page = Api::PER_PAGE) { - $data = $this->client->repositories()->commitComments($this->id, $ref, $parameters); + $data = $this->api('repo')->commitComments($this->id, $ref, $page, $per_page); $comments = array(); foreach ($data as $comment) { @@ -511,7 +514,7 @@ class Project extends AbstractModel */ public function createCommitComment($ref, $note, array $params = array()) { - $data = $this->client->repositories()->createCommitComment($this->id, $ref, $note, $params); + $data = $this->api('repo')->createCommitComment($this->id, $ref, $note, $params); return CommitNote::fromArray($this->getClient(), $data); } @@ -522,7 +525,7 @@ class Project extends AbstractModel */ public function diff($sha) { - return $this->client->repositories()->diff($this->id, $sha); + return $this->api('repo')->diff($this->id, $sha); } /** @@ -532,7 +535,7 @@ class Project extends AbstractModel */ public function compare($from, $to) { - $data = $this->client->repositories()->compare($this->id, $from, $to); + $data = $this->api('repo')->compare($this->id, $from, $to); return Comparison::fromArray($this->getClient(), $this, $data); } @@ -543,7 +546,7 @@ class Project extends AbstractModel */ public function tree(array $params = array()) { - $data = $this->client->repositories()->tree($this->id, $params); + $data = $this->api('repo')->tree($this->id, $params); $tree = array(); foreach ($data as $node) { @@ -560,7 +563,7 @@ class Project extends AbstractModel */ public function blob($sha, $filepath) { - return $this->client->repositories()->blob($this->id, $sha, $filepath); + return $this->api('repo')->blob($this->id, $sha, $filepath); } /** @@ -571,7 +574,7 @@ class Project extends AbstractModel */ public function getFile($sha, $filepath) { - return $this->client->repositories()->getFile($this->id, $filepath, $sha); + return $this->api('repo')->getFile($this->id, $filepath, $sha); } /** @@ -585,22 +588,7 @@ class Project extends AbstractModel */ public function createFile($file_path, $content, $branch_name, $commit_message, $author_email = null, $author_name = null) { - $parameters = [ - 'file_path' => $file_path, - 'branch' => $branch_name, - 'content' => $content, - 'commit_message' => $commit_message, - ]; - - if ($author_email !== null) { - $parameters['author_email'] = $author_email; - } - - if ($author_name !== null) { - $parameters['author_name'] = $author_name; - } - - $data = $this->client->repositoryFiles()->createFile($this->id, $parameters); + $data = $this->api('repo')->createFile($this->id, $file_path, $content, $branch_name, $commit_message, null, $author_email, $author_name); return File::fromArray($this->getClient(), $this, $data); } @@ -616,22 +604,7 @@ class Project extends AbstractModel */ public function updateFile($file_path, $content, $branch_name, $commit_message, $author_email = null, $author_name = null) { - $parameters = [ - 'file_path' => $file_path, - 'branch' => $branch_name, - 'content' => $content, - 'commit_message' => $commit_message, - ]; - - if ($author_email !== null) { - $parameters['author_email'] = $author_email; - } - - if ($author_name !== null) { - $parameters['author_name'] = $author_name; - } - - $data = $this->client->repositoryFiles()->updateFile($this->id, $parameters); + $data = $this->api('repo')->updateFile($this->id, $file_path, $content, $branch_name, $commit_message, null, $author_email, $author_name); return File::fromArray($this->getClient(), $this, $data); } @@ -646,35 +619,19 @@ class Project extends AbstractModel */ public function deleteFile($file_path, $branch_name, $commit_message, $author_email = null, $author_name = null) { - $parameters = [ - 'file_path' => $file_path, - 'branch' => $branch_name, - 'commit_message' => $commit_message, - ]; - - if ($author_email !== null) { - $parameters['author_email'] = $author_email; - } - - if ($author_name !== null) { - $parameters['author_name'] = $author_name; - } - - $this->client->repositoryFiles()->deleteFile($this->id, $parameters); + $this->api('repo')->deleteFile($this->id, $file_path, $branch_name, $commit_message, $author_email, $author_name); return true; } /** - * @param array $parameters - * - * @see Projects::events() for available parameters. - * + * @param int $page + * @param int $per_page * @return Event[] */ - public function events(array $parameters = []) + public function events($page = 1, $per_page = Api::PER_PAGE) { - $data = $this->client->projects()->events($this->id, $parameters); + $data = $this->api('projects')->events($this->id, $page, $per_page); $events = array(); foreach ($data as $event) { @@ -685,15 +642,14 @@ class Project extends AbstractModel } /** - * @param array $parameters - * - * @see MergeRequests::all() for available parameters. - * + * @param int $page + * @param int $per_page + * @param string $state * @return MergeRequest[] */ - public function mergeRequests(array $parameters = []) + public function mergeRequests($page = 1, $per_page = Api::PER_PAGE, $state = MergeRequests::STATE_ALL) { - $data = $this->client->mergeRequests()->all($this->id, $parameters); + $data = $this->api('mr')->$state($this->id, $page, $per_page); $mrs = array(); foreach ($data as $mr) { @@ -724,7 +680,7 @@ class Project extends AbstractModel */ public function createMergeRequest($source, $target, $title, $assignee = null, $description = null) { - $data = $this->client->mergeRequests()->create($this->id, $source, $target, $title, $assignee, null, $description); + $data = $this->api('mr')->create($this->id, $source, $target, $title, $assignee, null, $description); return MergeRequest::fromArray($this->getClient(), $this, $data); } @@ -775,15 +731,13 @@ class Project extends AbstractModel } /** - * @param array $parameters - * - * @see Issues::all() for available parameters. - * + * @param int $page + * @param int $per_page * @return Issue[] */ - public function issues(array $parameters = []) + public function issues($page = 1, $per_page = Api::PER_PAGE) { - $data = $this->client->issues()->all($this->id, $parameters); + $data = $this->api('issues')->all($this->id, $page, $per_page); $issues = array(); foreach ($data as $issue) { @@ -801,7 +755,7 @@ class Project extends AbstractModel public function createIssue($title, array $params = array()) { $params['title'] = $title; - $data = $this->client->issues()->create($this->id, $params); + $data = $this->api('issues')->create($this->id, $params); return Issue::fromArray($this->getClient(), $this, $data); } @@ -853,15 +807,13 @@ class Project extends AbstractModel } /** - * @param array $parameters - * - * @see Milestones::all() for available parameters. - * + * @param int $page + * @param int $per_page * @return Milestone[] */ - public function milestones(array $parameters = []) + public function milestones($page = 1, $per_page = Api::PER_PAGE) { - $data = $this->client->milestones()->all($this->id, $parameters); + $data = $this->api('milestones')->all($this->id, $page, $per_page); $milestones = array(); foreach ($data as $milestone) { @@ -879,7 +831,7 @@ class Project extends AbstractModel public function createMilestone($title, array $params = array()) { $params['title'] = $title; - $data = $this->client->milestones()->create($this->id, $params); + $data = $this->api('milestones')->create($this->id, $params); return Milestone::fromArray($this->getClient(), $this, $data); } @@ -923,7 +875,7 @@ class Project extends AbstractModel */ public function snippets() { - $data = $this->client->snippets()->all($this->id); + $data = $this->api('snippets')->all($this->id); $snippets = array(); foreach ($data as $snippet) { @@ -937,11 +889,12 @@ class Project extends AbstractModel * @param string $title * @param string $filename * @param string $code + * @param string $lifetime * @return Snippet */ - public function createSnippet($title, $filename, $code) + public function createSnippet($title, $filename, $code, $lifetime = null) { - $data = $this->client->snippets()->create($this->id, $title, $filename, $code); + $data = $this->api('snippets')->create($this->id, $title, $filename, $code, $lifetime); return Snippet::fromArray($this->getClient(), $this, $data); } @@ -959,7 +912,7 @@ class Project extends AbstractModel /** * @param int $id - * @return string + * @return Snippet */ public function snippetContent($id) { @@ -1008,7 +961,7 @@ class Project extends AbstractModel */ public function forkTo($id) { - $data = $this->client->projects()->createForkRelation($id, $this->id); + $data = $this->api('projects')->createForkRelation($id, $this->id); return Project::fromArray($this->getClient(), $data); } @@ -1028,7 +981,7 @@ class Project extends AbstractModel */ public function createForkRelation($id) { - $data = $this->client->projects()->createForkRelation($this->id, $id); + $data = $this->api('projects')->createForkRelation($this->id, $id); return Project::fromArray($this->getClient(), $data); } @@ -1038,7 +991,7 @@ class Project extends AbstractModel */ public function removeForkRelation() { - $this->client->projects()->removeForkRelation($this->id); + $this->api('projects')->removeForkRelation($this->id); return true; } @@ -1050,7 +1003,7 @@ class Project extends AbstractModel */ public function setService($service_name, array $params = array()) { - $this->client->projects()->setService($this->id, $service_name, $params); + $this->api('projects')->setService($this->id, $service_name, $params); return true; } @@ -1061,7 +1014,7 @@ class Project extends AbstractModel */ public function removeService($service_name) { - $this->client->projects()->removeService($this->id, $service_name); + $this->api('projects')->removeService($this->id, $service_name); return true; } @@ -1071,7 +1024,7 @@ class Project extends AbstractModel */ public function labels() { - $data = $this->client->projects()->labels($this->id); + $data = $this->api('projects')->labels($this->id); $labels = array(); foreach ($data as $label) { @@ -1088,7 +1041,7 @@ class Project extends AbstractModel */ public function addLabel($name, $color) { - $data = $this->client->projects()->addLabel($this->id, array( + $data = $this->api('projects')->addLabel($this->id, array( 'name' => $name, 'color' => $color )); @@ -1109,7 +1062,7 @@ class Project extends AbstractModel $params['name'] = $name; - $data = $this->client->projects()->updateLabel($this->id, $params); + $data = $this->api('projects')->updateLabel($this->id, $params); return Label::fromArray($this->getClient(), $this, $data); } @@ -1120,7 +1073,7 @@ class Project extends AbstractModel */ public function removeLabel($name) { - $this->client->projects()->removeLabel($this->id, $name); + $this->api('projects')->removeLabel($this->id, $name); return true; } @@ -1130,7 +1083,7 @@ class Project extends AbstractModel */ public function contributors() { - $data = $this->client->repositories()->contributors($this->id); + $data = $this->api('repo')->contributors($this->id); $contributors = array(); foreach ($data as $contributor) { @@ -1139,48 +1092,4 @@ class Project extends AbstractModel return $contributors; } - - /** - * @param array $scopes - * @return Job[] - */ - public function jobs(array $scopes = []) - { - $data = $this->client->jobs()->all($this->id, $scopes); - - $jobs = array(); - foreach ($data as $job) { - $jobs[] = Job::fromArray($this->getClient(), $this, $job); - } - - return $jobs; - } - - /** - * @param int $pipeline_id - * @param array $scopes - * @return Job[] - */ - public function pipelineJobs($pipeline_id, array $scopes = []) - { - $data = $this->client->jobs()->pipelineJobs($this->id, $pipeline_id, $scopes); - - $jobs = array(); - foreach ($data as $job) { - $jobs[] = Job::fromArray($this->getClient(), $this, $job); - } - - return $jobs; - } - - /** - * @param int $job_id - * @return Job - */ - public function job($job_id) - { - $data = $this->client->jobs()->show($this->id, $job_id); - - return Job::fromArray($this->getClient(), $this, $data); - } } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/ProjectHook.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/ProjectHook.php index 1789ca68bbce8edbf9e859aa6ec45a3b67c8cbcf..3da0a7c02ba9c5447b88748feb324082c39404b7 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/ProjectHook.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/ProjectHook.php @@ -11,9 +11,8 @@ use Gitlab\Client; * @property-read bool $push_events * @property-read bool $issues_events * @property-read bool $merge_requests_events - * @property-read bool $job_events + * @property-read bool $build_events * @property-read bool $tag_push_events - * @property-read bool $pipeline_events * @property-read string $created_at * @property-read Project $project */ @@ -30,9 +29,8 @@ class ProjectHook extends AbstractModel 'push_events', 'issues_events', 'merge_requests_events', - 'job_events', + 'build_events', 'tag_push_events', - 'pipeline_events', 'created_at' ); @@ -66,7 +64,7 @@ class ProjectHook extends AbstractModel */ public function show() { - $data = $this->client->projects()->hook($this->project->id, $this->id); + $data = $this->api('projects')->hook($this->project->id, $this->id); return static::fromArray($this->getClient(), $this->project, $data); } @@ -76,7 +74,7 @@ class ProjectHook extends AbstractModel */ public function delete() { - $this->client->projects()->removeHook($this->project->id, $this->id); + $this->api('projects')->removeHook($this->project->id, $this->id); return true; } @@ -95,7 +93,7 @@ class ProjectHook extends AbstractModel */ public function update(array $params) { - $data = $this->client->projects()->updateHook($this->project->id, $this->id, $params); + $data = $this->api('projects')->updateHook($this->project->id, $this->id, $params); return static::fromArray($this->getClient(), $this->project, $data); } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Session.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Session.php index 7cf4cfe79c42716fad7ec23728154a79dd778f76..f9b8177beff6844a93708abdb11ad6c50e947cfc 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Session.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Session.php @@ -51,7 +51,7 @@ class Session extends AbstractModel */ public function me() { - $data = $this->client->users()->user(); + $data = $this->api('users')->show(); return User::fromArray($this->getClient(), $data); } @@ -59,11 +59,11 @@ class Session extends AbstractModel /** * @param string $email * @param string $password - * @return Session + * @return $this */ public function login($email, $password) { - $data = $this->client->users()->session($email, $password); + $data = $this->api('users')->session($email, $password); return $this->hydrate($data); } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Snippet.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Snippet.php index 1f021bcb4f85b41e0c9bcdcf97db00d0d9eb8f8c..5d20e0dbf729a5201306703aad054b17b48f6fff 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Snippet.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/Snippet.php @@ -8,6 +8,7 @@ use Gitlab\Client; * @property-read int $id * @property-read string $title * @property-read string $file_name + * @property-read string $expires_at * @property-read string $updated_at * @property-read string $created_at * @property-read Project $project @@ -23,6 +24,7 @@ class Snippet extends AbstractModel 'title', 'file_name', 'author', + 'expires_at', 'updated_at', 'created_at', 'project' @@ -62,7 +64,7 @@ class Snippet extends AbstractModel */ public function show() { - $data = $this->client->snippets()->show($this->project->id, $this->id); + $data = $this->api('snippets')->show($this->project->id, $this->id); return static::fromArray($this->getClient(), $this->project, $data); } @@ -73,7 +75,7 @@ class Snippet extends AbstractModel */ public function update(array $params) { - $data = $this->client->snippets()->update($this->project->id, $this->id, $params); + $data = $this->api('snippets')->update($this->project->id, $this->id, $params); return static::fromArray($this->getClient(), $this->project, $data); } @@ -83,7 +85,7 @@ class Snippet extends AbstractModel */ public function content() { - return $this->client->snippets()->content($this->project->id, $this->id); + return $this->api('snippets')->content($this->project->id, $this->id); } /** @@ -91,7 +93,7 @@ class Snippet extends AbstractModel */ public function remove() { - $this->client->snippets()->remove($this->project->id, $this->id); + $this->api('snippets')->remove($this->project->id, $this->id); return true; } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/User.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/User.php index ef654756df4b5c5bd4b5f2448865a288fd103a32..5ffffc16e269a426e76a09df7d0b1b83e797b3e5 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/User.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/Model/User.php @@ -86,7 +86,7 @@ class User extends AbstractModel */ public static function create(Client $client, $email, $password, array $params = array()) { - $data = $client->users()->create($email, $password, $params); + $data = $client->api('users')->create($email, $password, $params); return static::fromArray($client, $data); } @@ -106,7 +106,7 @@ class User extends AbstractModel */ public function show() { - $data = $this->client->users()->show($this->id); + $data = $this->api('users')->show($this->id); return static::fromArray($this->getClient(), $data); } @@ -117,7 +117,7 @@ class User extends AbstractModel */ public function update(array $params) { - $data = $this->client->users()->update($this->id, $params); + $data = $this->api('users')->update($this->id, $params); return static::fromArray($this->getClient(), $data); } @@ -127,7 +127,7 @@ class User extends AbstractModel */ public function remove() { - $this->client->users()->remove($this->id); + $this->api('users')->remove($this->id); return true; } @@ -137,7 +137,7 @@ class User extends AbstractModel */ public function block() { - $this->client->users()->block($this->id); + $this->api('users')->block($this->id); return true; } @@ -147,7 +147,7 @@ class User extends AbstractModel */ public function unblock() { - $this->client->users()->unblock($this->id); + $this->api('users')->unblock($this->id); return true; } @@ -157,7 +157,7 @@ class User extends AbstractModel */ public function keys() { - $data = $this->client->users()->keys(); + $data = $this->api('users')->keys(); $keys = array(); foreach ($data as $key) { @@ -174,7 +174,7 @@ class User extends AbstractModel */ public function createKey($title, $key) { - $data = $this->client->users()->createKey($title, $key); + $data = $this->api('users')->createKey($title, $key); return Key::fromArray($this->getClient(), $data); } @@ -186,7 +186,7 @@ class User extends AbstractModel */ public function createKeyForUser($user_id, $title, $key) { - $data = $this->client->users()->createKeyForUser($user_id, $title, $key); + $data = $this->api('users')->createKeyForUser($user_id, $title, $key); return Key::fromArray($this->getClient(), $data); } @@ -197,7 +197,7 @@ class User extends AbstractModel */ public function removeKey($id) { - $this->client->users()->removeKey($id); + $this->api('users')->removeKey($id); return true; } diff --git a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/ResultPager.php b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/ResultPager.php index b436305b135c1d6adc8d963763b398d633c69037..3cfb44d13737f9036811cc86e583b9ca07670e4d 100644 --- a/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/ResultPager.php +++ b/vendor/m4tthumphrey/php-gitlab-api/lib/Gitlab/ResultPager.php @@ -1,7 +1,6 @@ <?php namespace Gitlab; use Gitlab\Api\ApiInterface; -use Gitlab\HttpClient\Message\ResponseMediator; /** * Pager class for supporting pagination in Gitlab classes @@ -34,7 +33,9 @@ class ResultPager implements ResultPagerInterface */ public function fetch(ApiInterface $api, $method, array $parameters = array()) { - return call_user_func_array(array($api, $method), $parameters); + $result = call_user_func_array(array($api, $method), $parameters); + + return $result; } /** @@ -43,6 +44,7 @@ class ResultPager implements ResultPagerInterface public function fetchAll(ApiInterface $api, $method, array $parameters = array()) { $result = call_user_func_array(array($api, $method), $parameters); + while ($this->hasNext()) { $result = array_merge($result, $this->fetchNext()); } @@ -103,17 +105,7 @@ class ResultPager implements ResultPagerInterface */ protected function has($key) { - $lastResponse = $this->client->getResponseHistory()->getLastResponse(); - if ($lastResponse == null) { - return false; - } - - $pagination = ResponseMediator::getPagination($lastResponse); - if ($pagination == null) { - return false; - } - - return isset($pagination[$key]); + return !empty($this->client->getHttpClient()->getLastResponse()->getPagination()) && isset($this->client->getHttpClient()->getLastResponse()->getPagination()[$key]); } /** @@ -121,12 +113,9 @@ class ResultPager implements ResultPagerInterface */ protected function get($key) { - if (!$this->has($key)) { - return []; + if ($this->has($key)) { + $result = $this->client->getHttpClient()->get(strtr($this->client->getHttpClient()->getLastResponse()->getPagination()[$key], array($this->client->getBaseUrl() => '')))->getContent(); + return $result; } - - $pagination = ResponseMediator::getPagination($this->client->getResponseHistory()->getLastResponse()); - - return ResponseMediator::getContent($this->client->getHttpClient()->get($pagination[$key])); } } diff --git a/vendor/php-http/client-common/CHANGELOG.md b/vendor/php-http/client-common/CHANGELOG.md deleted file mode 100644 index 3031720c6d59e8b3362a4eda3370af07f98f56d9..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/CHANGELOG.md +++ /dev/null @@ -1,137 +0,0 @@ -# Change Log - -## 1.7.0 - 2017-11-30 - -### Added - -- Symfony 4 support - -### Changed - -- Strict comparison in DecoderPlugin - -## 1.6.0 - 2017-10-16 - -### Added - -- Add HttpClientPool client to leverage load balancing and fallback mechanism [see the documentation](http://docs.php-http.org/en/latest/components/client-common.html) for more details. -- `PluginClientFactory` to create `PluginClient` instances. -- Added new option 'delay' for `RetryPlugin`. -- Added new option 'decider' for `RetryPlugin`. -- Supports more cookie date formats in the Cookie Plugin - -### Changed - -- The `RetryPlugin` does now wait between retries. To disable/change this feature you must write something like: - -```php -$plugin = new RetryPlugin(['delay' => function(RequestInterface $request, Exception $e, $retries) { - return 0; -}); -``` - -### Deprecated - -- The `debug_plugins` option for `PluginClient` is deprecated and will be removed in 2.0. Use the decorator design pattern instead like in [ProfilePlugin](https://github.com/php-http/HttplugBundle/blob/de33f9c14252f22093a5ec7d84f17535ab31a384/Collector/ProfilePlugin.php). - -## 1.5.0 - 2017-03-30 - -### Added - -- `QueryDefaultsPlugin` to add default query parameters. - -## 1.4.2 - 2017-03-18 - -### Deprecated - -- `DecoderPlugin` does not longer claim to support `compress` content encoding - -### Fixed - -- `CookiePlugin` allows main domain cookies to be sent/stored for subdomains -- `DecoderPlugin` uses the right `FilteredStream` to handle `deflate` content encoding - - -## 1.4.1 - 2017-02-20 - -### Fixed - -- Cast return value of `StreamInterface::getSize` to string in `ContentLengthPlugin` - - -## 1.4.0 - 2016-11-04 - -### Added - -- Add Path plugin -- Base URI plugin that combines Add Host and Add Path plugins - - -## 1.3.0 - 2016-10-16 - -### Changed - -- Fix Emulated Trait to use Http based promise which respect the HttpAsyncClient interface -- Require Httplug 1.1 where we use HTTP specific promises. -- RedirectPlugin: use the full URL instead of the URI to properly keep track of redirects -- Add AddPathPlugin for API URLs with base path -- Add BaseUriPlugin that combines AddHostPlugin and AddPathPlugin - - -## 1.2.1 - 2016-07-26 - -### Changed - -- AddHostPlugin also sets the port if specified - - -## 1.2.0 - 2016-07-14 - -### Added - -- Suggest separate plugins in composer.json -- Introduced `debug_plugins` option for `PluginClient` - - -## 1.1.0 - 2016-05-04 - -### Added - -- Add a flexible http client providing both contract, and only emulating what's necessary -- HTTP Client Router: route requests to underlying clients -- Plugin client and core plugins moved here from `php-http/plugins` - -### Deprecated - -- Extending client classes, they will be made final in version 2.0 - - -## 1.0.0 - 2016-01-27 - -### Changed - -- Remove useless interface in BatchException - - -## 0.2.0 - 2016-01-12 - -### Changed - -- Updated package files -- Updated HTTPlug to RC1 - - -## 0.1.1 - 2015-12-26 - -### Added - -- Emulated clients - - -## 0.1.0 - 2015-12-25 - -### Added - -- Batch client from utils -- Methods client from utils -- Emulators and decorators from client-tools diff --git a/vendor/php-http/client-common/LICENSE b/vendor/php-http/client-common/LICENSE deleted file mode 100644 index 4558d6f06306fce15add8bc10e29152bc4ad5355..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015-2016 PHP HTTP Team <team@php-http.org> - -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/php-http/client-common/README.md b/vendor/php-http/client-common/README.md deleted file mode 100644 index 017bfcec93b5f7d436bffaade7e051ec0570ccb1..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# HTTP Client Common - -[](https://github.com/php-http/client-common/releases) -[](LICENSE) -[](https://travis-ci.org/php-http/client-common) -[](https://scrutinizer-ci.com/g/php-http/client-common) -[](https://scrutinizer-ci.com/g/php-http/client-common) -[](https://packagist.org/packages/php-http/client-common) - -**Common HTTP Client implementations and tools for HTTPlug.** - - -## Install - -Via Composer - -``` bash -$ composer require php-http/client-common -``` - - -## Usage - -This package provides common tools for HTTP Clients: - -- BatchClient to handle sending requests in parallel -- A convenience client with HTTP method names as class methods -- Emulator, decorator layers for sync/async clients - - -## Documentation - -Please see the [official documentation](http://docs.php-http.org/en/latest/components/client-common.html). - - -## Testing - -``` bash -$ composer test -``` - - -## Contributing - -Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). - - -## Security - -If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). - - -## License - -The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/client-common/composer.json b/vendor/php-http/client-common/composer.json deleted file mode 100644 index fc5fc5fb4ea5e4927b72b29e406b5b47f3f691fa..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/composer.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "php-http/client-common", - "description": "Common HTTP Client implementations and tools for HTTPlug", - "license": "MIT", - "keywords": ["http", "client", "httplug", "common"], - "homepage": "http://httplug.io", - "authors": [ - { - "name": "Márk Sági-Kazár", - "email": "mark.sagikazar@gmail.com" - } - ], - "require": { - "php": "^5.4 || ^7.0", - "php-http/httplug": "^1.1", - "php-http/message-factory": "^1.0", - "php-http/message": "^1.6", - "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.4 || ^4.2", - "guzzlehttp/psr7": "^1.4" - }, - "suggest": { - "php-http/logger-plugin": "PSR-3 Logger plugin", - "php-http/cache-plugin": "PSR-6 Cache plugin", - "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" - }, - "autoload": { - "psr-4": { - "Http\\Client\\Common\\": "src/" - } - }, - "scripts": { - "test": "vendor/bin/phpspec run", - "test-ci": "vendor/bin/phpspec run -c phpspec.ci.yml" - }, - "extra": { - "branch-alias": { - "dev-master": "1.7-dev" - } - } -} diff --git a/vendor/php-http/client-common/src/BatchClient.php b/vendor/php-http/client-common/src/BatchClient.php deleted file mode 100644 index 2036355b604746ea942b0c69a95ba768723ae0e5..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/BatchClient.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\Exception; -use Http\Client\HttpClient; -use Http\Client\Common\Exception\BatchException; -use Psr\Http\Message\RequestInterface; - -/** - * BatchClient allow to sends multiple request and retrieve a Batch Result. - * - * This implementation simply loops over the requests and uses sendRequest with each of them. - * - * @author Joel Wurtz <jwurtz@jolicode.com> - */ -class BatchClient implements HttpClient -{ - /** - * @var HttpClient - */ - private $client; - - /** - * @param HttpClient $client - */ - public function __construct(HttpClient $client) - { - $this->client = $client; - } - - /** - * {@inheritdoc} - */ - public function sendRequest(RequestInterface $request) - { - return $this->client->sendRequest($request); - } - - /** - * Send several requests. - * - * You may not assume that the requests are executed in a particular order. If the order matters - * for your application, use sendRequest sequentially. - * - * @param RequestInterface[] The requests to send - * - * @return BatchResult Containing one result per request - * - * @throws BatchException If one or more requests fails. The exception gives access to the - * BatchResult with a map of request to result for success, request to - * exception for failures - */ - public function sendRequests(array $requests) - { - $batchResult = new BatchResult(); - - foreach ($requests as $request) { - try { - $response = $this->sendRequest($request); - $batchResult = $batchResult->addResponse($request, $response); - } catch (Exception $e) { - $batchResult = $batchResult->addException($request, $e); - } - } - - if ($batchResult->hasExceptions()) { - throw new BatchException($batchResult); - } - - return $batchResult; - } -} diff --git a/vendor/php-http/client-common/src/BatchResult.php b/vendor/php-http/client-common/src/BatchResult.php deleted file mode 100644 index 710611d6d00ff6b3069eff19a26f2daab6ec1e7e..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/BatchResult.php +++ /dev/null @@ -1,181 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\Exception; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; - -/** - * Responses and exceptions returned from parallel request execution. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -final class BatchResult -{ - /** - * @var \SplObjectStorage - */ - private $responses; - - /** - * @var \SplObjectStorage - */ - private $exceptions; - - public function __construct() - { - $this->responses = new \SplObjectStorage(); - $this->exceptions = new \SplObjectStorage(); - } - - /** - * Checks if there are any successful responses at all. - * - * @return bool - */ - public function hasResponses() - { - return $this->responses->count() > 0; - } - - /** - * Returns all successful responses. - * - * @return ResponseInterface[] - */ - public function getResponses() - { - $responses = []; - - foreach ($this->responses as $request) { - $responses[] = $this->responses[$request]; - } - - return $responses; - } - - /** - * Checks if there is a successful response for a request. - * - * @param RequestInterface $request - * - * @return bool - */ - public function isSuccessful(RequestInterface $request) - { - return $this->responses->contains($request); - } - - /** - * Returns the response for a successful request. - * - * @param RequestInterface $request - * - * @return ResponseInterface - * - * @throws \UnexpectedValueException If request was not part of the batch or failed - */ - public function getResponseFor(RequestInterface $request) - { - try { - return $this->responses[$request]; - } catch (\UnexpectedValueException $e) { - throw new \UnexpectedValueException('Request not found', $e->getCode(), $e); - } - } - - /** - * Adds a response in an immutable way. - * - * @param RequestInterface $request - * @param ResponseInterface $response - * - * @return BatchResult the new BatchResult with this request-response pair added to it - */ - public function addResponse(RequestInterface $request, ResponseInterface $response) - { - $new = clone $this; - $new->responses->attach($request, $response); - - return $new; - } - - /** - * Checks if there are any unsuccessful requests at all. - * - * @return bool - */ - public function hasExceptions() - { - return $this->exceptions->count() > 0; - } - - /** - * Returns all exceptions for the unsuccessful requests. - * - * @return Exception[] - */ - public function getExceptions() - { - $exceptions = []; - - foreach ($this->exceptions as $request) { - $exceptions[] = $this->exceptions[$request]; - } - - return $exceptions; - } - - /** - * Checks if there is an exception for a request, meaning the request failed. - * - * @param RequestInterface $request - * - * @return bool - */ - public function isFailed(RequestInterface $request) - { - return $this->exceptions->contains($request); - } - - /** - * Returns the exception for a failed request. - * - * @param RequestInterface $request - * - * @return Exception - * - * @throws \UnexpectedValueException If request was not part of the batch or was successful - */ - public function getExceptionFor(RequestInterface $request) - { - try { - return $this->exceptions[$request]; - } catch (\UnexpectedValueException $e) { - throw new \UnexpectedValueException('Request not found', $e->getCode(), $e); - } - } - - /** - * Adds an exception in an immutable way. - * - * @param RequestInterface $request - * @param Exception $exception - * - * @return BatchResult the new BatchResult with this request-exception pair added to it - */ - public function addException(RequestInterface $request, Exception $exception) - { - $new = clone $this; - $new->exceptions->attach($request, $exception); - - return $new; - } - - public function __clone() - { - $this->responses = clone $this->responses; - $this->exceptions = clone $this->exceptions; - } -} diff --git a/vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php b/vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php deleted file mode 100644 index 1b163167e6dfcfb23076e3a9ad4a19b96a86abfe..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/EmulatedHttpAsyncClient.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\HttpAsyncClient; -use Http\Client\HttpClient; - -/** - * Emulates an async HTTP client. - * - * This should be replaced by an anonymous class in PHP 7. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -class EmulatedHttpAsyncClient implements HttpClient, HttpAsyncClient -{ - use HttpAsyncClientEmulator; - use HttpClientDecorator; - - /** - * @param HttpClient $httpClient - */ - public function __construct(HttpClient $httpClient) - { - $this->httpClient = $httpClient; - } -} diff --git a/vendor/php-http/client-common/src/EmulatedHttpClient.php b/vendor/php-http/client-common/src/EmulatedHttpClient.php deleted file mode 100644 index 01046c83e4c29a0578e6132da47ce378e8e71698..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/EmulatedHttpClient.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\HttpAsyncClient; -use Http\Client\HttpClient; - -/** - * Emulates an HTTP client. - * - * This should be replaced by an anonymous class in PHP 7. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -class EmulatedHttpClient implements HttpClient, HttpAsyncClient -{ - use HttpAsyncClientDecorator; - use HttpClientEmulator; - - /** - * @param HttpAsyncClient $httpAsyncClient - */ - public function __construct(HttpAsyncClient $httpAsyncClient) - { - $this->httpAsyncClient = $httpAsyncClient; - } -} diff --git a/vendor/php-http/client-common/src/Exception/BatchException.php b/vendor/php-http/client-common/src/Exception/BatchException.php deleted file mode 100644 index 66a92719e4ae05be21567ce08d5ecb84c716e808..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Exception/BatchException.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace Http\Client\Common\Exception; - -use Http\Client\Exception\TransferException; -use Http\Client\Common\BatchResult; - -/** - * This exception is thrown when HttpClient::sendRequests led to at least one failure. - * - * It gives access to a BatchResult with the request-exception and request-response pairs. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -final class BatchException extends TransferException -{ - /** - * @var BatchResult - */ - private $result; - - /** - * @param BatchResult $result - */ - public function __construct(BatchResult $result) - { - $this->result = $result; - } - - /** - * Returns the BatchResult that contains all responses and exceptions. - * - * @return BatchResult - */ - public function getResult() - { - return $this->result; - } -} diff --git a/vendor/php-http/client-common/src/Exception/CircularRedirectionException.php b/vendor/php-http/client-common/src/Exception/CircularRedirectionException.php deleted file mode 100644 index 73ec521e17348e898ff895a172947e68bce93fce..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Exception/CircularRedirectionException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Http\Client\Common\Exception; - -use Http\Client\Exception\HttpException; - -/** - * Thrown when circular redirection is detected. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -class CircularRedirectionException extends HttpException -{ -} diff --git a/vendor/php-http/client-common/src/Exception/ClientErrorException.php b/vendor/php-http/client-common/src/Exception/ClientErrorException.php deleted file mode 100644 index b1f6cc855eba0e100f9701f6d7d66269984661e2..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Exception/ClientErrorException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Http\Client\Common\Exception; - -use Http\Client\Exception\HttpException; - -/** - * Thrown when there is a client error (4xx). - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -class ClientErrorException extends HttpException -{ -} diff --git a/vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php b/vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php deleted file mode 100644 index 5d33f9838360395298b9e8ca3ecfbc155f6b9b3f..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Exception/HttpClientNotFoundException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Http\Client\Common\Exception; - -use Http\Client\Exception\TransferException; - -/** - * Thrown when a http client cannot be chosen in a pool. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -class HttpClientNotFoundException extends TransferException -{ -} diff --git a/vendor/php-http/client-common/src/Exception/LoopException.php b/vendor/php-http/client-common/src/Exception/LoopException.php deleted file mode 100644 index e834124df607bbe10f381cb432598e668771ca7e..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Exception/LoopException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Http\Client\Common\Exception; - -use Http\Client\Exception\RequestException; - -/** - * Thrown when the Plugin Client detects an endless loop. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -class LoopException extends RequestException -{ -} diff --git a/vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php b/vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php deleted file mode 100644 index ae514cd738c64fa063284a5823e31e06124bdc45..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Exception/MultipleRedirectionException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Http\Client\Common\Exception; - -use Http\Client\Exception\HttpException; - -/** - * Redirect location cannot be chosen. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -class MultipleRedirectionException extends HttpException -{ -} diff --git a/vendor/php-http/client-common/src/Exception/ServerErrorException.php b/vendor/php-http/client-common/src/Exception/ServerErrorException.php deleted file mode 100644 index 665d72418b0b71403da4f8e8e6ce48c37bf38022..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Exception/ServerErrorException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -namespace Http\Client\Common\Exception; - -use Http\Client\Exception\HttpException; - -/** - * Thrown when there is a server error (5xx). - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -class ServerErrorException extends HttpException -{ -} diff --git a/vendor/php-http/client-common/src/FlexibleHttpClient.php b/vendor/php-http/client-common/src/FlexibleHttpClient.php deleted file mode 100644 index 58f88132d26f185881bf3bbf6e0b1f45b19842e7..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/FlexibleHttpClient.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\HttpAsyncClient; -use Http\Client\HttpClient; - -/** - * A flexible http client, which implements both interface and will emulate - * one contract, the other, or none at all depending on the injected client contract. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class FlexibleHttpClient implements HttpClient, HttpAsyncClient -{ - use HttpClientDecorator; - use HttpAsyncClientDecorator; - - /** - * @param HttpClient|HttpAsyncClient $client - */ - public function __construct($client) - { - if (!($client instanceof HttpClient) && !($client instanceof HttpAsyncClient)) { - throw new \LogicException('Client must be an instance of Http\\Client\\HttpClient or Http\\Client\\HttpAsyncClient'); - } - - $this->httpClient = $client; - $this->httpAsyncClient = $client; - - if (!($this->httpClient instanceof HttpClient)) { - $this->httpClient = new EmulatedHttpClient($this->httpClient); - } - - if (!($this->httpAsyncClient instanceof HttpAsyncClient)) { - $this->httpAsyncClient = new EmulatedHttpAsyncClient($this->httpAsyncClient); - } - } -} diff --git a/vendor/php-http/client-common/src/HttpAsyncClientDecorator.php b/vendor/php-http/client-common/src/HttpAsyncClientDecorator.php deleted file mode 100644 index 6eb576cdb154bb59098cece31e8e0508aad5bdc6..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpAsyncClientDecorator.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\HttpAsyncClient; -use Psr\Http\Message\RequestInterface; - -/** - * Decorates an HTTP Async Client. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -trait HttpAsyncClientDecorator -{ - /** - * @var HttpAsyncClient - */ - protected $httpAsyncClient; - - /** - * {@inheritdoc} - * - * @see HttpAsyncClient::sendAsyncRequest - */ - public function sendAsyncRequest(RequestInterface $request) - { - return $this->httpAsyncClient->sendAsyncRequest($request); - } -} diff --git a/vendor/php-http/client-common/src/HttpAsyncClientEmulator.php b/vendor/php-http/client-common/src/HttpAsyncClientEmulator.php deleted file mode 100644 index c0ba354f87c401d2e70c13cefcceb00e153d018f..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpAsyncClientEmulator.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\Exception; -use Http\Client\Promise; -use Psr\Http\Message\RequestInterface; - -/** - * Emulates an HTTP Async Client in an HTTP Client. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -trait HttpAsyncClientEmulator -{ - /** - * {@inheritdoc} - * - * @see HttpClient::sendRequest - */ - abstract public function sendRequest(RequestInterface $request); - - /** - * {@inheritdoc} - * - * @see HttpAsyncClient::sendAsyncRequest - */ - public function sendAsyncRequest(RequestInterface $request) - { - try { - return new Promise\HttpFulfilledPromise($this->sendRequest($request)); - } catch (Exception $e) { - return new Promise\HttpRejectedPromise($e); - } - } -} diff --git a/vendor/php-http/client-common/src/HttpClientDecorator.php b/vendor/php-http/client-common/src/HttpClientDecorator.php deleted file mode 100644 index a33d5efd79eb717d8c55f237c48068672d715fde..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpClientDecorator.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\HttpClient; -use Psr\Http\Message\RequestInterface; - -/** - * Decorates an HTTP Client. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -trait HttpClientDecorator -{ - /** - * @var HttpClient - */ - protected $httpClient; - - /** - * {@inheritdoc} - * - * @see HttpClient::sendRequest - */ - public function sendRequest(RequestInterface $request) - { - return $this->httpClient->sendRequest($request); - } -} diff --git a/vendor/php-http/client-common/src/HttpClientEmulator.php b/vendor/php-http/client-common/src/HttpClientEmulator.php deleted file mode 100644 index dbec1aba330324dde3cb758ad79cb8f6cedb091f..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpClientEmulator.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Psr\Http\Message\RequestInterface; - -/** - * Emulates an HTTP Client in an HTTP Async Client. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -trait HttpClientEmulator -{ - /** - * {@inheritdoc} - * - * @see HttpClient::sendRequest - */ - public function sendRequest(RequestInterface $request) - { - $promise = $this->sendAsyncRequest($request); - - return $promise->wait(); - } - - /** - * {@inheritdoc} - * - * @see HttpAsyncClient::sendAsyncRequest - */ - abstract public function sendAsyncRequest(RequestInterface $request); -} diff --git a/vendor/php-http/client-common/src/HttpClientPool.php b/vendor/php-http/client-common/src/HttpClientPool.php deleted file mode 100644 index 7ac292ca138fe31b4830268607e451bc6adfd5a4..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpClientPool.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\Common\Exception\HttpClientNotFoundException; -use Http\Client\HttpAsyncClient; -use Http\Client\HttpClient; -use Psr\Http\Message\RequestInterface; - -/** - * A http client pool allows to send requests on a pool of different http client using a specific strategy (least used, - * round robin, ...). - */ -abstract class HttpClientPool implements HttpAsyncClient, HttpClient -{ - /** - * @var HttpClientPoolItem[] - */ - protected $clientPool = []; - - /** - * Add a client to the pool. - * - * @param HttpClient|HttpAsyncClient|HttpClientPoolItem $client - */ - public function addHttpClient($client) - { - if (!$client instanceof HttpClientPoolItem) { - $client = new HttpClientPoolItem($client); - } - - $this->clientPool[] = $client; - } - - /** - * Return an http client given a specific strategy. - * - * @throws HttpClientNotFoundException When no http client has been found into the pool - * - * @return HttpClientPoolItem Return a http client that can do both sync or async - */ - abstract protected function chooseHttpClient(); - - /** - * {@inheritdoc} - */ - public function sendAsyncRequest(RequestInterface $request) - { - return $this->chooseHttpClient()->sendAsyncRequest($request); - } - - /** - * {@inheritdoc} - */ - public function sendRequest(RequestInterface $request) - { - return $this->chooseHttpClient()->sendRequest($request); - } -} diff --git a/vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php b/vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php deleted file mode 100644 index 6299cceb60fafb9f70e89ea0323f2ba0d38f7647..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpClientPool/LeastUsedClientPool.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -namespace Http\Client\Common\HttpClientPool; - -use Http\Client\Common\Exception\HttpClientNotFoundException; -use Http\Client\Common\HttpClientPool; -use Http\Client\Common\HttpClientPoolItem; - -/** - * LeastUsedClientPool will choose the client with the less current request in the pool. - * - * This strategy is only useful when doing async request - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class LeastUsedClientPool extends HttpClientPool -{ - /** - * {@inheritdoc} - */ - protected function chooseHttpClient() - { - $clientPool = array_filter($this->clientPool, function (HttpClientPoolItem $clientPoolItem) { - return !$clientPoolItem->isDisabled(); - }); - - if (0 === count($clientPool)) { - throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool'); - } - - usort($clientPool, function (HttpClientPoolItem $clientA, HttpClientPoolItem $clientB) { - if ($clientA->getSendingRequestCount() === $clientB->getSendingRequestCount()) { - return 0; - } - - if ($clientA->getSendingRequestCount() < $clientB->getSendingRequestCount()) { - return -1; - } - - return 1; - }); - - return reset($clientPool); - } -} diff --git a/vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php b/vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php deleted file mode 100644 index 3255f865df369dfb2a6d388d28a3705390048274..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpClientPool/RandomClientPool.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -namespace Http\Client\Common\HttpClientPool; - -use Http\Client\Common\Exception\HttpClientNotFoundException; -use Http\Client\Common\HttpClientPool; -use Http\Client\Common\HttpClientPoolItem; - -/** - * RoundRobinClientPool will choose the next client in the pool. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class RandomClientPool extends HttpClientPool -{ - /** - * {@inheritdoc} - */ - protected function chooseHttpClient() - { - $clientPool = array_filter($this->clientPool, function (HttpClientPoolItem $clientPoolItem) { - return !$clientPoolItem->isDisabled(); - }); - - if (0 === count($clientPool)) { - throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool'); - } - - return $clientPool[array_rand($clientPool)]; - } -} diff --git a/vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php b/vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php deleted file mode 100644 index 8d8e40a013b036621ae0a9ef6729e7812bc04f3f..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpClientPool/RoundRobinClientPool.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -namespace Http\Client\Common\HttpClientPool; - -use Http\Client\Common\Exception\HttpClientNotFoundException; -use Http\Client\Common\HttpClientPool; - -/** - * RoundRobinClientPool will choose the next client in the pool. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class RoundRobinClientPool extends HttpClientPool -{ - /** - * {@inheritdoc} - */ - protected function chooseHttpClient() - { - $last = current($this->clientPool); - - do { - $client = next($this->clientPool); - - if (false === $client) { - $client = reset($this->clientPool); - - if (false === $client) { - throw new HttpClientNotFoundException('Cannot choose a http client as there is no one present in the pool'); - } - } - - // Case when there is only one and the last one has been disabled - if ($last === $client && $client->isDisabled()) { - throw new HttpClientNotFoundException('Cannot choose a http client as there is no one enabled in the pool'); - } - } while ($client->isDisabled()); - - return $client; - } -} diff --git a/vendor/php-http/client-common/src/HttpClientPoolItem.php b/vendor/php-http/client-common/src/HttpClientPoolItem.php deleted file mode 100644 index 09cd6ddf1c96f4bea9817b25c2d1544497dcc617..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpClientPoolItem.php +++ /dev/null @@ -1,178 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\HttpAsyncClient; -use Http\Client\HttpClient; -use Psr\Http\Message\RequestInterface; -use Http\Client\Exception; - -/** - * A HttpClientPoolItem represent a HttpClient inside a Pool. - * - * It is disabled when a request failed and can be reenable after a certain number of seconds - * It also keep tracks of the current number of request the client is currently sending (only usable for async method) - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -class HttpClientPoolItem implements HttpClient, HttpAsyncClient -{ - /** - * @var int Number of request this client is currently sending - */ - private $sendingRequestCount = 0; - - /** - * @var \DateTime|null Time when this client has been disabled or null if enable - */ - private $disabledAt; - - /** - * @var int|null Number of seconds after this client is reenable, by default null: never reenable this client - */ - private $reenableAfter; - - /** - * @var FlexibleHttpClient A http client responding to async and sync request - */ - private $client; - - /** - * @param HttpClient|HttpAsyncClient $client - * @param null|int $reenableAfter Number of seconds after this client is reenable - */ - public function __construct($client, $reenableAfter = null) - { - $this->client = new FlexibleHttpClient($client); - $this->reenableAfter = $reenableAfter; - } - - /** - * {@inheritdoc} - */ - public function sendRequest(RequestInterface $request) - { - if ($this->isDisabled()) { - throw new Exception\RequestException('Cannot send the request as this client has been disabled', $request); - } - - try { - $this->incrementRequestCount(); - $response = $this->client->sendRequest($request); - $this->decrementRequestCount(); - } catch (Exception $e) { - $this->disable(); - $this->decrementRequestCount(); - - throw $e; - } - - return $response; - } - - /** - * {@inheritdoc} - */ - public function sendAsyncRequest(RequestInterface $request) - { - if ($this->isDisabled()) { - throw new Exception\RequestException('Cannot send the request as this client has been disabled', $request); - } - - $this->incrementRequestCount(); - - return $this->client->sendAsyncRequest($request)->then(function ($response) { - $this->decrementRequestCount(); - - return $response; - }, function ($exception) { - $this->disable(); - $this->decrementRequestCount(); - - throw $exception; - }); - } - - /** - * Whether this client is disabled or not. - * - * Will also reactivate this client if possible - * - * @internal - * - * @return bool - */ - public function isDisabled() - { - $disabledAt = $this->getDisabledAt(); - - if (null !== $this->reenableAfter && null !== $disabledAt) { - // Reenable after a certain time - $now = new \DateTime(); - - if (($now->getTimestamp() - $disabledAt->getTimestamp()) >= $this->reenableAfter) { - $this->enable(); - - return false; - } - - return true; - } - - return null !== $disabledAt; - } - - /** - * Get current number of request that is send by the underlying http client. - * - * @internal - * - * @return int - */ - public function getSendingRequestCount() - { - return $this->sendingRequestCount; - } - - /** - * Return when this client has been disabled or null if it's enabled. - * - * @return \DateTime|null - */ - private function getDisabledAt() - { - return $this->disabledAt; - } - - /** - * Increment the request count. - */ - private function incrementRequestCount() - { - ++$this->sendingRequestCount; - } - - /** - * Decrement the request count. - */ - private function decrementRequestCount() - { - --$this->sendingRequestCount; - } - - /** - * Enable the current client. - */ - private function enable() - { - $this->disabledAt = null; - } - - /** - * Disable the current client. - */ - private function disable() - { - $this->disabledAt = new \DateTime('now'); - } -} diff --git a/vendor/php-http/client-common/src/HttpClientRouter.php b/vendor/php-http/client-common/src/HttpClientRouter.php deleted file mode 100644 index 9f721336a172a5ab3f75fe70899a9081503f4618..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpClientRouter.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\Exception\RequestException; -use Http\Client\HttpAsyncClient; -use Http\Client\HttpClient; -use Http\Message\RequestMatcher; -use Psr\Http\Message\RequestInterface; - -/** - * Route a request to a specific client in the stack based using a RequestMatcher. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class HttpClientRouter implements HttpClient, HttpAsyncClient -{ - /** - * @var array - */ - private $clients = []; - - /** - * {@inheritdoc} - */ - public function sendRequest(RequestInterface $request) - { - $client = $this->chooseHttpClient($request); - - return $client->sendRequest($request); - } - - /** - * {@inheritdoc} - */ - public function sendAsyncRequest(RequestInterface $request) - { - $client = $this->chooseHttpClient($request); - - return $client->sendAsyncRequest($request); - } - - /** - * Add a client to the router. - * - * @param HttpClient|HttpAsyncClient $client - * @param RequestMatcher $requestMatcher - */ - public function addClient($client, RequestMatcher $requestMatcher) - { - $this->clients[] = [ - 'matcher' => $requestMatcher, - 'client' => new FlexibleHttpClient($client), - ]; - } - - /** - * Choose an HTTP client given a specific request. - * - * @param RequestInterface $request - * - * @return HttpClient|HttpAsyncClient - */ - protected function chooseHttpClient(RequestInterface $request) - { - foreach ($this->clients as $client) { - if ($client['matcher']->matches($request)) { - return $client['client']; - } - } - - throw new RequestException('No client found for the specified request', $request); - } -} diff --git a/vendor/php-http/client-common/src/HttpMethodsClient.php b/vendor/php-http/client-common/src/HttpMethodsClient.php deleted file mode 100644 index 58804fc243f89c9a3a78d16fa0d3200c66c020d6..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/HttpMethodsClient.php +++ /dev/null @@ -1,205 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\Exception; -use Http\Client\HttpClient; -use Http\Message\RequestFactory; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\StreamInterface; -use Psr\Http\Message\UriInterface; - -/** - * Convenience HTTP client that integrates the MessageFactory in order to send - * requests in the following form:. - * - * $client - * ->get('/foo') - * ->post('/bar') - * ; - * - * The client also exposes the sendRequest methods of the wrapped HttpClient. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - * @author David Buchmann <mail@davidbu.ch> - */ -class HttpMethodsClient implements HttpClient -{ - /** - * @var HttpClient - */ - private $httpClient; - - /** - * @var RequestFactory - */ - private $requestFactory; - - /** - * @param HttpClient $httpClient The client to send requests with - * @param RequestFactory $requestFactory The message factory to create requests - */ - public function __construct(HttpClient $httpClient, RequestFactory $requestFactory) - { - $this->httpClient = $httpClient; - $this->requestFactory = $requestFactory; - } - - /** - * Sends a GET request. - * - * @param string|UriInterface $uri - * @param array $headers - * - * @throws Exception - * - * @return ResponseInterface - */ - public function get($uri, array $headers = []) - { - return $this->send('GET', $uri, $headers, null); - } - - /** - * Sends an HEAD request. - * - * @param string|UriInterface $uri - * @param array $headers - * - * @throws Exception - * - * @return ResponseInterface - */ - public function head($uri, array $headers = []) - { - return $this->send('HEAD', $uri, $headers, null); - } - - /** - * Sends a TRACE request. - * - * @param string|UriInterface $uri - * @param array $headers - * - * @throws Exception - * - * @return ResponseInterface - */ - public function trace($uri, array $headers = []) - { - return $this->send('TRACE', $uri, $headers, null); - } - - /** - * Sends a POST request. - * - * @param string|UriInterface $uri - * @param array $headers - * @param string|StreamInterface|null $body - * - * @throws Exception - * - * @return ResponseInterface - */ - public function post($uri, array $headers = [], $body = null) - { - return $this->send('POST', $uri, $headers, $body); - } - - /** - * Sends a PUT request. - * - * @param string|UriInterface $uri - * @param array $headers - * @param string|StreamInterface|null $body - * - * @throws Exception - * - * @return ResponseInterface - */ - public function put($uri, array $headers = [], $body = null) - { - return $this->send('PUT', $uri, $headers, $body); - } - - /** - * Sends a PATCH request. - * - * @param string|UriInterface $uri - * @param array $headers - * @param string|StreamInterface|null $body - * - * @throws Exception - * - * @return ResponseInterface - */ - public function patch($uri, array $headers = [], $body = null) - { - return $this->send('PATCH', $uri, $headers, $body); - } - - /** - * Sends a DELETE request. - * - * @param string|UriInterface $uri - * @param array $headers - * @param string|StreamInterface|null $body - * - * @throws Exception - * - * @return ResponseInterface - */ - public function delete($uri, array $headers = [], $body = null) - { - return $this->send('DELETE', $uri, $headers, $body); - } - - /** - * Sends an OPTIONS request. - * - * @param string|UriInterface $uri - * @param array $headers - * @param string|StreamInterface|null $body - * - * @throws Exception - * - * @return ResponseInterface - */ - public function options($uri, array $headers = [], $body = null) - { - return $this->send('OPTIONS', $uri, $headers, $body); - } - - /** - * Sends a request with any HTTP method. - * - * @param string $method HTTP method to use - * @param string|UriInterface $uri - * @param array $headers - * @param string|StreamInterface|null $body - * - * @throws Exception - * - * @return ResponseInterface - */ - public function send($method, $uri, array $headers = [], $body = null) - { - return $this->sendRequest($this->requestFactory->createRequest( - $method, - $uri, - $headers, - $body - )); - } - - /** - * Forward to the underlying HttpClient. - * - * {@inheritdoc} - */ - public function sendRequest(RequestInterface $request) - { - return $this->httpClient->sendRequest($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin.php b/vendor/php-http/client-common/src/Plugin.php deleted file mode 100644 index 89a2a622d46c69f9a7ffb47042c4667e46ef556f..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Promise\Promise; -use Psr\Http\Message\RequestInterface; - -/** - * A plugin is a middleware to transform the request and/or the response. - * - * The plugin can: - * - break the chain and return a response - * - dispatch the request to the next middleware - * - restart the request - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -interface Plugin -{ - /** - * Handle the request and return the response coming from the next callable. - * - * @see http://docs.php-http.org/en/latest/plugins/build-your-own.html - * - * @param RequestInterface $request - * @param callable $next Next middleware in the chain, the request is passed as the first argument - * @param callable $first First middleware in the chain, used to to restart a request - * - * @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception (The same as HttpAsyncClient). - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first); -} diff --git a/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php b/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php deleted file mode 100644 index 29ab8ae84097e9c6ad748d0acba3db2f3911a8b4..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/AddHostPlugin.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\UriInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; - -/** - * Add schema, host and port to a request. Can be set to overwrite the schema and host if desired. - * - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - */ -final class AddHostPlugin implements Plugin -{ - /** - * @var UriInterface - */ - private $host; - - /** - * @var bool - */ - private $replace; - - /** - * @param UriInterface $host - * @param array $config { - * - * @var bool $replace True will replace all hosts, false will only add host when none is specified. - * } - */ - public function __construct(UriInterface $host, array $config = []) - { - if ('' === $host->getHost()) { - throw new \LogicException('Host can not be empty'); - } - - $this->host = $host; - - $resolver = new OptionsResolver(); - $this->configureOptions($resolver); - $options = $resolver->resolve($config); - - $this->replace = $options['replace']; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - if ($this->replace || '' === $request->getUri()->getHost()) { - $uri = $request->getUri() - ->withHost($this->host->getHost()) - ->withScheme($this->host->getScheme()) - ->withPort($this->host->getPort()) - ; - - $request = $request->withUri($uri); - } - - return $next($request); - } - - /** - * @param OptionsResolver $resolver - */ - private function configureOptions(OptionsResolver $resolver) - { - $resolver->setDefaults([ - 'replace' => false, - ]); - $resolver->setAllowedTypes('replace', 'bool'); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php b/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php deleted file mode 100644 index e24d61a4e42a89c60e4ed07c54c93e31b949533d..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/AddPathPlugin.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\UriInterface; - -/** - * Prepend a base path to the request URI. Useful for base API URLs like http://domain.com/api. - * - * @author Sullivan Senechal <soullivaneuh@gmail.com> - */ -final class AddPathPlugin implements Plugin -{ - /** - * @var UriInterface - */ - private $uri; - - /** - * @param UriInterface $uri - */ - public function __construct(UriInterface $uri) - { - if ('' === $uri->getPath()) { - throw new \LogicException('URI path cannot be empty'); - } - - if ('/' === substr($uri->getPath(), -1)) { - throw new \LogicException('URI path cannot end with a slash.'); - } - - $this->uri = $uri; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - $request = $request->withUri($request->getUri() - ->withPath($this->uri->getPath().$request->getUri()->getPath()) - ); - - return $next($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php b/vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php deleted file mode 100644 index 194712fcde024fa81991162084fa041c6fae2827..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/AuthenticationPlugin.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Http\Message\Authentication; -use Psr\Http\Message\RequestInterface; - -/** - * Send an authenticated request. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class AuthenticationPlugin implements Plugin -{ - /** - * @var Authentication An authentication system - */ - private $authentication; - - /** - * @param Authentication $authentication - */ - public function __construct(Authentication $authentication) - { - $this->authentication = $authentication; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - $request = $this->authentication->authenticate($request); - - return $next($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php b/vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php deleted file mode 100644 index 2c2a7752cf466b2a8061dd1093970c59687317b3..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/BaseUriPlugin.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\UriInterface; - -/** - * Combines the AddHostPlugin and AddPathPlugin. - * - * @author Sullivan Senechal <soullivaneuh@gmail.com> - */ -final class BaseUriPlugin implements Plugin -{ - /** - * @var AddHostPlugin - */ - private $addHostPlugin; - - /** - * @var AddPathPlugin|null - */ - private $addPathPlugin = null; - - /** - * @param UriInterface $uri Has to contain a host name and cans have a path. - * @param array $hostConfig Config for AddHostPlugin. @see AddHostPlugin::configureOptions - */ - public function __construct(UriInterface $uri, array $hostConfig = []) - { - $this->addHostPlugin = new AddHostPlugin($uri, $hostConfig); - - if (rtrim($uri->getPath(), '/')) { - $this->addPathPlugin = new AddPathPlugin($uri); - } - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - $addHostNext = function (RequestInterface $request) use ($next, $first) { - return $this->addHostPlugin->handleRequest($request, $next, $first); - }; - - if ($this->addPathPlugin) { - return $this->addPathPlugin->handleRequest($request, $addHostNext, $first); - } - - return $addHostNext($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php b/vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php deleted file mode 100644 index 0f7aafaeda3197f4571dabd6996b22e2f4e26eec..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/ContentLengthPlugin.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Http\Message\Encoding\ChunkStream; -use Psr\Http\Message\RequestInterface; - -/** - * Allow to set the correct content length header on the request or to transfer it as a chunk if not possible. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class ContentLengthPlugin implements Plugin -{ - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - if (!$request->hasHeader('Content-Length')) { - $stream = $request->getBody(); - - // Cannot determine the size so we use a chunk stream - if (null === $stream->getSize()) { - $stream = new ChunkStream($stream); - $request = $request->withBody($stream); - $request = $request->withAddedHeader('Transfer-Encoding', 'chunked'); - } else { - $request = $request->withHeader('Content-Length', (string) $stream->getSize()); - } - } - - return $next($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php b/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php deleted file mode 100644 index 8ef1d62b34b0dd36cbf21769fda7b4d8de37088b..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/ContentTypePlugin.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\StreamInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; - -/** - * Allow to set the correct content type header on the request automatically only if it is not set. - * - * @author Karim Pinchon <karim.pinchon@gmail.com> - */ -final class ContentTypePlugin implements Plugin -{ - /** - * Allow to disable the content type detection when stream is too large (as it can consume a lot of resource). - * - * @var bool - * - * true skip the content type detection - * false detect the content type (default value) - */ - protected $skipDetection; - - /** - * Determine the size stream limit for which the detection as to be skipped (default to 16Mb). - * - * @var int - */ - protected $sizeLimit; - - /** - * @param array $config { - * - * @var bool $skip_detection True skip detection if stream size is bigger than $size_limit. - * @var int $size_limit size stream limit for which the detection as to be skipped. - * } - */ - public function __construct(array $config = []) - { - $resolver = new OptionsResolver(); - $resolver->setDefaults([ - 'skip_detection' => false, - 'size_limit' => 16000000, - ]); - $resolver->setAllowedTypes('skip_detection', 'bool'); - $resolver->setAllowedTypes('size_limit', 'int'); - - $options = $resolver->resolve($config); - - $this->skipDetection = $options['skip_detection']; - $this->sizeLimit = $options['size_limit']; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - if (!$request->hasHeader('Content-Type')) { - $stream = $request->getBody(); - $streamSize = $stream->getSize(); - - if (!$stream->isSeekable()) { - return $next($request); - } - - if (0 === $streamSize) { - return $next($request); - } - - if ($this->skipDetection && (null === $streamSize || $streamSize >= $this->sizeLimit)) { - return $next($request); - } - - if ($this->isJson($stream)) { - $request = $request->withHeader('Content-Type', 'application/json'); - - return $next($request); - } - - if ($this->isXml($stream)) { - $request = $request->withHeader('Content-Type', 'application/xml'); - - return $next($request); - } - } - - return $next($request); - } - - /** - * @param $stream StreamInterface - * - * @return bool - */ - private function isJson($stream) - { - $stream->rewind(); - - json_decode($stream->getContents()); - - return JSON_ERROR_NONE === json_last_error(); - } - - /** - * @param $stream StreamInterface - * - * @return \SimpleXMLElement|false - */ - private function isXml($stream) - { - $stream->rewind(); - - $previousValue = libxml_use_internal_errors(true); - $isXml = simplexml_load_string($stream->getContents()); - libxml_use_internal_errors($previousValue); - - return $isXml; - } -} diff --git a/vendor/php-http/client-common/src/Plugin/CookiePlugin.php b/vendor/php-http/client-common/src/Plugin/CookiePlugin.php deleted file mode 100644 index 59ee90da19d21ea442596a95fa427c630bc41874..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/CookiePlugin.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Http\Client\Exception\TransferException; -use Http\Message\Cookie; -use Http\Message\CookieJar; -use Http\Message\CookieUtil; -use Http\Message\Exception\UnexpectedValueException; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; - -/** - * Handle request cookies. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class CookiePlugin implements Plugin -{ - /** - * Cookie storage. - * - * @var CookieJar - */ - private $cookieJar; - - /** - * @param CookieJar $cookieJar - */ - public function __construct(CookieJar $cookieJar) - { - $this->cookieJar = $cookieJar; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - foreach ($this->cookieJar->getCookies() as $cookie) { - if ($cookie->isExpired()) { - continue; - } - - if (!$cookie->matchDomain($request->getUri()->getHost())) { - continue; - } - - if (!$cookie->matchPath($request->getUri()->getPath())) { - continue; - } - - if ($cookie->isSecure() && ('https' !== $request->getUri()->getScheme())) { - continue; - } - - $request = $request->withAddedHeader('Cookie', sprintf('%s=%s', $cookie->getName(), $cookie->getValue())); - } - - return $next($request)->then(function (ResponseInterface $response) use ($request) { - if ($response->hasHeader('Set-Cookie')) { - $setCookies = $response->getHeader('Set-Cookie'); - - foreach ($setCookies as $setCookie) { - $cookie = $this->createCookie($request, $setCookie); - - // Cookie invalid do not use it - if (null === $cookie) { - continue; - } - - // Restrict setting cookie from another domain - if (!preg_match("/\.{$cookie->getDomain()}$/", '.'.$request->getUri()->getHost())) { - continue; - } - - $this->cookieJar->addCookie($cookie); - } - } - - return $response; - }); - } - - /** - * Creates a cookie from a string. - * - * @param RequestInterface $request - * @param $setCookie - * - * @return Cookie|null - * - * @throws TransferException - */ - private function createCookie(RequestInterface $request, $setCookie) - { - $parts = array_map('trim', explode(';', $setCookie)); - - if (empty($parts) || !strpos($parts[0], '=')) { - return; - } - - list($name, $cookieValue) = $this->createValueKey(array_shift($parts)); - - $maxAge = null; - $expires = null; - $domain = $request->getUri()->getHost(); - $path = $request->getUri()->getPath(); - $secure = false; - $httpOnly = false; - - // Add the cookie pieces into the parsed data array - foreach ($parts as $part) { - list($key, $value) = $this->createValueKey($part); - - switch (strtolower($key)) { - case 'expires': - try { - $expires = CookieUtil::parseDate($value); - } catch (UnexpectedValueException $e) { - throw new TransferException( - sprintf( - 'Cookie header `%s` expires value `%s` could not be converted to date', - $name, - $value - ), - null, - $e - ); - } - - break; - - case 'max-age': - $maxAge = (int) $value; - - break; - - case 'domain': - $domain = $value; - - break; - - case 'path': - $path = $value; - - break; - - case 'secure': - $secure = true; - - break; - - case 'httponly': - $httpOnly = true; - - break; - } - } - - return new Cookie($name, $cookieValue, $maxAge, $domain, $path, $secure, $httpOnly, $expires); - } - - /** - * Separates key/value pair from cookie. - * - * @param $part - * - * @return array - */ - private function createValueKey($part) - { - $parts = explode('=', $part, 2); - $key = trim($parts[0]); - $value = isset($parts[1]) ? trim($parts[1]) : true; - - return [$key, $value]; - } -} diff --git a/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php b/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php deleted file mode 100644 index b661b613ac72a6235f272bdcfb8a5660a95a24e0..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/DecoderPlugin.php +++ /dev/null @@ -1,140 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Http\Message\Encoding; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\StreamInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; - -/** - * Allow to decode response body with a chunk, deflate, compress or gzip encoding. - * - * If zlib is not installed, only chunked encoding can be handled. - * - * If Content-Encoding is not disabled, the plugin will add an Accept-Encoding header for the encoding methods it supports. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class DecoderPlugin implements Plugin -{ - /** - * @var bool Whether this plugin decode stream with value in the Content-Encoding header (default to true). - * - * If set to false only the Transfer-Encoding header will be used - */ - private $useContentEncoding; - - /** - * @param array $config { - * - * @var bool $use_content_encoding Whether this plugin should look at the Content-Encoding header first or only at the Transfer-Encoding (defaults to true). - * } - */ - public function __construct(array $config = []) - { - $resolver = new OptionsResolver(); - $resolver->setDefaults([ - 'use_content_encoding' => true, - ]); - $resolver->setAllowedTypes('use_content_encoding', 'bool'); - $options = $resolver->resolve($config); - - $this->useContentEncoding = $options['use_content_encoding']; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - $encodings = extension_loaded('zlib') ? ['gzip', 'deflate'] : ['identity']; - - if ($this->useContentEncoding) { - $request = $request->withHeader('Accept-Encoding', $encodings); - } - $encodings[] = 'chunked'; - $request = $request->withHeader('TE', $encodings); - - return $next($request)->then(function (ResponseInterface $response) { - return $this->decodeResponse($response); - }); - } - - /** - * Decode a response body given its Transfer-Encoding or Content-Encoding value. - * - * @param ResponseInterface $response Response to decode - * - * @return ResponseInterface New response decoded - */ - private function decodeResponse(ResponseInterface $response) - { - $response = $this->decodeOnEncodingHeader('Transfer-Encoding', $response); - - if ($this->useContentEncoding) { - $response = $this->decodeOnEncodingHeader('Content-Encoding', $response); - } - - return $response; - } - - /** - * Decode a response on a specific header (content encoding or transfer encoding mainly). - * - * @param string $headerName Name of the header - * @param ResponseInterface $response Response - * - * @return ResponseInterface A new instance of the response decoded - */ - private function decodeOnEncodingHeader($headerName, ResponseInterface $response) - { - if ($response->hasHeader($headerName)) { - $encodings = $response->getHeader($headerName); - $newEncodings = []; - - while ($encoding = array_pop($encodings)) { - $stream = $this->decorateStream($encoding, $response->getBody()); - - if (false === $stream) { - array_unshift($newEncodings, $encoding); - - continue; - } - - $response = $response->withBody($stream); - } - - $response = $response->withHeader($headerName, $newEncodings); - } - - return $response; - } - - /** - * Decorate a stream given an encoding. - * - * @param string $encoding - * @param StreamInterface $stream - * - * @return StreamInterface|false A new stream interface or false if encoding is not supported - */ - private function decorateStream($encoding, StreamInterface $stream) - { - if ('chunked' === strtolower($encoding)) { - return new Encoding\DechunkStream($stream); - } - - if ('deflate' === strtolower($encoding)) { - return new Encoding\DecompressStream($stream); - } - - if ('gzip' === strtolower($encoding)) { - return new Encoding\GzipDecodeStream($stream); - } - - return false; - } -} diff --git a/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php b/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php deleted file mode 100644 index f09d3b161a8883947e2ba6458a46a20c676ba38f..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/ErrorPlugin.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Exception\ClientErrorException; -use Http\Client\Common\Exception\ServerErrorException; -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; - -/** - * Throw exception when the response of a request is not acceptable. - * - * Status codes 400-499 lead to a ClientErrorException, status 500-599 to a ServerErrorException. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class ErrorPlugin implements Plugin -{ - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - $promise = $next($request); - - return $promise->then(function (ResponseInterface $response) use ($request) { - return $this->transformResponseToException($request, $response); - }); - } - - /** - * Transform response to an error if possible. - * - * @param RequestInterface $request Request of the call - * @param ResponseInterface $response Response of the call - * - * @throws ClientErrorException If response status code is a 4xx - * @throws ServerErrorException If response status code is a 5xx - * - * @return ResponseInterface If status code is not in 4xx or 5xx return response - */ - protected function transformResponseToException(RequestInterface $request, ResponseInterface $response) - { - if ($response->getStatusCode() >= 400 && $response->getStatusCode() < 500) { - throw new ClientErrorException($response->getReasonPhrase(), $request, $response); - } - - if ($response->getStatusCode() >= 500 && $response->getStatusCode() < 600) { - throw new ServerErrorException($response->getReasonPhrase(), $request, $response); - } - - return $response; - } -} diff --git a/vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php b/vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php deleted file mode 100644 index 26fd813458564a612d2730ec0735a9ca3930b362..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/HeaderAppendPlugin.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; - -/** - * Append headers to the request. - * - * If the header already exists the value will be appended to the current value. - * - * This only makes sense for headers that can have multiple values like 'Forwarded' - * - * @see https://en.wikipedia.org/wiki/List_of_HTTP_header_fields - * - * @author Soufiane Ghzal <sghzal@gmail.com> - */ -final class HeaderAppendPlugin implements Plugin -{ - /** - * @var array - */ - private $headers = []; - - /** - * @param array $headers Hashmap of header name to header value - */ - public function __construct(array $headers) - { - $this->headers = $headers; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - foreach ($this->headers as $header => $headerValue) { - $request = $request->withAddedHeader($header, $headerValue); - } - - return $next($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php b/vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php deleted file mode 100644 index 6dfc1115a06a099d641b90aa2eb1e9357f2d5d71..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/HeaderDefaultsPlugin.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; - -/** - * Set header to default value if it does not exist. - * - * If a given header already exists the value wont be replaced and the request wont be changed. - * - * @author Soufiane Ghzal <sghzal@gmail.com> - */ -final class HeaderDefaultsPlugin implements Plugin -{ - /** - * @var array - */ - private $headers = []; - - /** - * @param array $headers Hashmap of header name to header value - */ - public function __construct(array $headers) - { - $this->headers = $headers; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - foreach ($this->headers as $header => $headerValue) { - if (!$request->hasHeader($header)) { - $request = $request->withHeader($header, $headerValue); - } - } - - return $next($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php b/vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php deleted file mode 100644 index fc9c19d1aadabf34c1287a9ed97b78f78ebbbc74..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/HeaderRemovePlugin.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; - -/** - * Removes headers from the request. - * - * @author Soufiane Ghzal <sghzal@gmail.com> - */ -final class HeaderRemovePlugin implements Plugin -{ - /** - * @var array - */ - private $headers = []; - - /** - * @param array $headers List of header names to remove from the request - */ - public function __construct(array $headers) - { - $this->headers = $headers; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - foreach ($this->headers as $header) { - if ($request->hasHeader($header)) { - $request = $request->withoutHeader($header); - } - } - - return $next($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php b/vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php deleted file mode 100644 index 75f11d40aaae9c7ded7edf960b1dcc99deae9bd8..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/HeaderSetPlugin.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; - -/** - * Set headers on the request. - * - * If the header does not exist it wil be set, if the header already exists it will be replaced. - * - * @author Soufiane Ghzal <sghzal@gmail.com> - */ -final class HeaderSetPlugin implements Plugin -{ - /** - * @var array - */ - private $headers = []; - - /** - * @param array $headers Hashmap of header name to header value - */ - public function __construct(array $headers) - { - $this->headers = $headers; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - foreach ($this->headers as $header => $headerValue) { - $request = $request->withHeader($header, $headerValue); - } - - return $next($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/HistoryPlugin.php b/vendor/php-http/client-common/src/Plugin/HistoryPlugin.php deleted file mode 100644 index 5abddbd84128d6a95617ed2410d3b6817736a884..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/HistoryPlugin.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Http\Client\Exception; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; - -/** - * Record HTTP calls. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class HistoryPlugin implements Plugin -{ - /** - * Journal use to store request / responses / exception. - * - * @var Journal - */ - private $journal; - - /** - * @param Journal $journal - */ - public function __construct(Journal $journal) - { - $this->journal = $journal; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - $journal = $this->journal; - - return $next($request)->then(function (ResponseInterface $response) use ($request, $journal) { - $journal->addSuccess($request, $response); - - return $response; - }, function (Exception $exception) use ($request, $journal) { - $journal->addFailure($request, $exception); - - throw $exception; - }); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/Journal.php b/vendor/php-http/client-common/src/Plugin/Journal.php deleted file mode 100644 index 15f309569fb9842a58ed0c13feb27374f26de40f..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/Journal.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Exception; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; - -/** - * Records history of HTTP calls. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -interface Journal -{ - /** - * Record a successful call. - * - * @param RequestInterface $request Request use to make the call - * @param ResponseInterface $response Response returned by the call - */ - public function addSuccess(RequestInterface $request, ResponseInterface $response); - - /** - * Record a failed call. - * - * @param RequestInterface $request Request use to make the call - * @param Exception $exception Exception returned by the call - */ - public function addFailure(RequestInterface $request, Exception $exception); -} diff --git a/vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php b/vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php deleted file mode 100644 index 6c1e32cd307fefe0960c80bf1e6ce57dab518d34..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/QueryDefaultsPlugin.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Psr\Http\Message\RequestInterface; - -/** - * Set query to default value if it does not exist. - * - * If a given query parameter already exists the value wont be replaced and the request wont be changed. - * - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - */ -final class QueryDefaultsPlugin implements Plugin -{ - /** - * @var array - */ - private $queryParams = []; - - /** - * @param array $queryParams Hashmap of query name to query value. Names and values must not be url encoded as - * this plugin will encode them - */ - public function __construct(array $queryParams) - { - $this->queryParams = $queryParams; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - foreach ($this->queryParams as $name => $value) { - $uri = $request->getUri(); - $array = []; - parse_str($uri->getQuery(), $array); - - // If query value is not found - if (!isset($array[$name])) { - $array[$name] = $value; - - // Create a new request with the new URI with the added query param - $request = $request->withUri( - $uri->withQuery(http_build_query($array)) - ); - } - } - - return $next($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php b/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php deleted file mode 100644 index d2f442edb8fe95cc9676ef0295e64e2427df9748..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/RedirectPlugin.php +++ /dev/null @@ -1,270 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Exception\CircularRedirectionException; -use Http\Client\Common\Exception\MultipleRedirectionException; -use Http\Client\Common\Plugin; -use Http\Client\Exception\HttpException; -use Psr\Http\Message\MessageInterface; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\UriInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; - -/** - * Follow redirections. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -class RedirectPlugin implements Plugin -{ - /** - * Rule on how to redirect, change method for the new request. - * - * @var array - */ - protected $redirectCodes = [ - 300 => [ - 'switch' => [ - 'unless' => ['GET', 'HEAD'], - 'to' => 'GET', - ], - 'multiple' => true, - 'permanent' => false, - ], - 301 => [ - 'switch' => [ - 'unless' => ['GET', 'HEAD'], - 'to' => 'GET', - ], - 'multiple' => false, - 'permanent' => true, - ], - 302 => [ - 'switch' => [ - 'unless' => ['GET', 'HEAD'], - 'to' => 'GET', - ], - 'multiple' => false, - 'permanent' => false, - ], - 303 => [ - 'switch' => [ - 'unless' => ['GET', 'HEAD'], - 'to' => 'GET', - ], - 'multiple' => false, - 'permanent' => false, - ], - 307 => [ - 'switch' => false, - 'multiple' => false, - 'permanent' => false, - ], - 308 => [ - 'switch' => false, - 'multiple' => false, - 'permanent' => true, - ], - ]; - - /** - * Determine how header should be preserved from old request. - * - * @var bool|array - * - * true will keep all previous headers (default value) - * false will ditch all previous headers - * string[] will keep only headers with the specified names - */ - protected $preserveHeader; - - /** - * Store all previous redirect from 301 / 308 status code. - * - * @var array - */ - protected $redirectStorage = []; - - /** - * Whether the location header must be directly used for a multiple redirection status code (300). - * - * @var bool - */ - protected $useDefaultForMultiple; - - /** - * @var array - */ - protected $circularDetection = []; - - /** - * @param array $config { - * - * @var bool|string[] $preserve_header True keeps all headers, false remove all of them, an array is interpreted as a list of header names to keep - * @var bool $use_default_for_multiple Whether the location header must be directly used for a multiple redirection status code (300). - * } - */ - public function __construct(array $config = []) - { - $resolver = new OptionsResolver(); - $resolver->setDefaults([ - 'preserve_header' => true, - 'use_default_for_multiple' => true, - ]); - $resolver->setAllowedTypes('preserve_header', ['bool', 'array']); - $resolver->setAllowedTypes('use_default_for_multiple', 'bool'); - $resolver->setNormalizer('preserve_header', function (OptionsResolver $resolver, $value) { - if (is_bool($value) && false === $value) { - return []; - } - - return $value; - }); - $options = $resolver->resolve($config); - - $this->preserveHeader = $options['preserve_header']; - $this->useDefaultForMultiple = $options['use_default_for_multiple']; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - // Check in storage - if (array_key_exists((string) $request->getUri(), $this->redirectStorage)) { - $uri = $this->redirectStorage[(string) $request->getUri()]['uri']; - $statusCode = $this->redirectStorage[(string) $request->getUri()]['status']; - $redirectRequest = $this->buildRedirectRequest($request, $uri, $statusCode); - - return $first($redirectRequest); - } - - return $next($request)->then(function (ResponseInterface $response) use ($request, $first) { - $statusCode = $response->getStatusCode(); - - if (!array_key_exists($statusCode, $this->redirectCodes)) { - return $response; - } - - $uri = $this->createUri($response, $request); - $redirectRequest = $this->buildRedirectRequest($request, $uri, $statusCode); - $chainIdentifier = spl_object_hash((object) $first); - - if (!array_key_exists($chainIdentifier, $this->circularDetection)) { - $this->circularDetection[$chainIdentifier] = []; - } - - $this->circularDetection[$chainIdentifier][] = (string) $request->getUri(); - - if (in_array((string) $redirectRequest->getUri(), $this->circularDetection[$chainIdentifier])) { - throw new CircularRedirectionException('Circular redirection detected', $request, $response); - } - - if ($this->redirectCodes[$statusCode]['permanent']) { - $this->redirectStorage[(string) $request->getUri()] = [ - 'uri' => $uri, - 'status' => $statusCode, - ]; - } - - // Call redirect request in synchrone - $redirectPromise = $first($redirectRequest); - - return $redirectPromise->wait(); - }); - } - - /** - * Builds the redirect request. - * - * @param RequestInterface $request Original request - * @param UriInterface $uri New uri - * @param int $statusCode Status code from the redirect response - * - * @return MessageInterface|RequestInterface - */ - protected function buildRedirectRequest(RequestInterface $request, UriInterface $uri, $statusCode) - { - $request = $request->withUri($uri); - - if (false !== $this->redirectCodes[$statusCode]['switch'] && !in_array($request->getMethod(), $this->redirectCodes[$statusCode]['switch']['unless'])) { - $request = $request->withMethod($this->redirectCodes[$statusCode]['switch']['to']); - } - - if (is_array($this->preserveHeader)) { - $headers = array_keys($request->getHeaders()); - - foreach ($headers as $name) { - if (!in_array($name, $this->preserveHeader)) { - $request = $request->withoutHeader($name); - } - } - } - - return $request; - } - - /** - * Creates a new Uri from the old request and the location header. - * - * @param ResponseInterface $response The redirect response - * @param RequestInterface $request The original request - * - * @throws HttpException If location header is not usable (missing or incorrect) - * @throws MultipleRedirectionException If a 300 status code is received and default location cannot be resolved (doesn't use the location header or not present) - * - * @return UriInterface - */ - private function createUri(ResponseInterface $response, RequestInterface $request) - { - if ($this->redirectCodes[$response->getStatusCode()]['multiple'] && (!$this->useDefaultForMultiple || !$response->hasHeader('Location'))) { - throw new MultipleRedirectionException('Cannot choose a redirection', $request, $response); - } - - if (!$response->hasHeader('Location')) { - throw new HttpException('Redirect status code, but no location header present in the response', $request, $response); - } - - $location = $response->getHeaderLine('Location'); - $parsedLocation = parse_url($location); - - if (false === $parsedLocation) { - throw new HttpException(sprintf('Location %s could not be parsed', $location), $request, $response); - } - - $uri = $request->getUri(); - - if (array_key_exists('scheme', $parsedLocation)) { - $uri = $uri->withScheme($parsedLocation['scheme']); - } - - if (array_key_exists('host', $parsedLocation)) { - $uri = $uri->withHost($parsedLocation['host']); - } - - if (array_key_exists('port', $parsedLocation)) { - $uri = $uri->withPort($parsedLocation['port']); - } - - if (array_key_exists('path', $parsedLocation)) { - $uri = $uri->withPath($parsedLocation['path']); - } - - if (array_key_exists('query', $parsedLocation)) { - $uri = $uri->withQuery($parsedLocation['query']); - } else { - $uri = $uri->withQuery(''); - } - - if (array_key_exists('fragment', $parsedLocation)) { - $uri = $uri->withFragment($parsedLocation['fragment']); - } else { - $uri = $uri->withFragment(''); - } - - return $uri; - } -} diff --git a/vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php b/vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php deleted file mode 100644 index 5f72b02d8ac6973ba659ab9d4bf1f7f1eaf97eba..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/RequestMatcherPlugin.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Http\Message\RequestMatcher; -use Psr\Http\Message\RequestInterface; - -/** - * Apply a delegated plugin based on a request match. - * - * @author Márk Sági-Kazár <mark.sagikazar@gmail.com> - */ -final class RequestMatcherPlugin implements Plugin -{ - /** - * @var RequestMatcher - */ - private $requestMatcher; - - /** - * @var Plugin - */ - private $delegatedPlugin; - - /** - * @param RequestMatcher $requestMatcher - * @param Plugin $delegatedPlugin - */ - public function __construct(RequestMatcher $requestMatcher, Plugin $delegatedPlugin) - { - $this->requestMatcher = $requestMatcher; - $this->delegatedPlugin = $delegatedPlugin; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - if ($this->requestMatcher->matches($request)) { - return $this->delegatedPlugin->handleRequest($request, $next, $first); - } - - return $next($request); - } -} diff --git a/vendor/php-http/client-common/src/Plugin/RetryPlugin.php b/vendor/php-http/client-common/src/Plugin/RetryPlugin.php deleted file mode 100644 index 8446246e673c4cab2cb3685f894a18220b14f385..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/Plugin/RetryPlugin.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php - -namespace Http\Client\Common\Plugin; - -use Http\Client\Common\Plugin; -use Http\Client\Exception; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; - -/** - * Retry the request if an exception is thrown. - * - * By default will retry only one time. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class RetryPlugin implements Plugin -{ - /** - * Number of retry before sending an exception. - * - * @var int - */ - private $retry; - - /** - * @var callable - */ - private $delay; - - /** - * @var callable - */ - private $decider; - - /** - * Store the retry counter for each request. - * - * @var array - */ - private $retryStorage = []; - - /** - * @param array $config { - * - * @var int $retries Number of retries to attempt if an exception occurs before letting the exception bubble up. - * @var callable $decider A callback that gets a request and an exception to decide after a failure whether the request should be retried. - * @var callable $delay A callback that gets a request, an exception and the number of retries and returns how many microseconds we should wait before trying again. - * } - */ - public function __construct(array $config = []) - { - $resolver = new OptionsResolver(); - $resolver->setDefaults([ - 'retries' => 1, - 'decider' => function (RequestInterface $request, Exception $e) { - return true; - }, - 'delay' => __CLASS__.'::defaultDelay', - ]); - $resolver->setAllowedTypes('retries', 'int'); - $resolver->setAllowedTypes('decider', 'callable'); - $resolver->setAllowedTypes('delay', 'callable'); - $options = $resolver->resolve($config); - - $this->retry = $options['retries']; - $this->decider = $options['decider']; - $this->delay = $options['delay']; - } - - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) - { - $chainIdentifier = spl_object_hash((object) $first); - - return $next($request)->then(function (ResponseInterface $response) use ($request, $chainIdentifier) { - if (array_key_exists($chainIdentifier, $this->retryStorage)) { - unset($this->retryStorage[$chainIdentifier]); - } - - return $response; - }, function (Exception $exception) use ($request, $next, $first, $chainIdentifier) { - if (!array_key_exists($chainIdentifier, $this->retryStorage)) { - $this->retryStorage[$chainIdentifier] = 0; - } - - if ($this->retryStorage[$chainIdentifier] >= $this->retry) { - unset($this->retryStorage[$chainIdentifier]); - - throw $exception; - } - - if (!call_user_func($this->decider, $request, $exception)) { - throw $exception; - } - - $time = call_user_func($this->delay, $request, $exception, $this->retryStorage[$chainIdentifier]); - usleep($time); - - // Retry in synchrone - ++$this->retryStorage[$chainIdentifier]; - $promise = $this->handleRequest($request, $next, $first); - - return $promise->wait(); - }); - } - - /** - * @param RequestInterface $request - * @param Exception $e - * @param int $retries The number of retries we made before. First time this get called it will be 0. - * - * @return int - */ - public static function defaultDelay(RequestInterface $request, Exception $e, $retries) - { - return pow(2, $retries) * 500000; - } -} diff --git a/vendor/php-http/client-common/src/PluginClient.php b/vendor/php-http/client-common/src/PluginClient.php deleted file mode 100644 index 93aea8f2fda0c2ead27a5de67006a43a7a0c51d5..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/PluginClient.php +++ /dev/null @@ -1,179 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\Common\Exception\LoopException; -use Http\Client\Exception as HttplugException; -use Http\Client\HttpAsyncClient; -use Http\Client\HttpClient; -use Http\Client\Promise\HttpFulfilledPromise; -use Http\Client\Promise\HttpRejectedPromise; -use Psr\Http\Message\RequestInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; - -/** - * The client managing plugins and providing a decorator around HTTP Clients. - * - * @author Joel Wurtz <joel.wurtz@gmail.com> - */ -final class PluginClient implements HttpClient, HttpAsyncClient -{ - /** - * An HTTP async client. - * - * @var HttpAsyncClient - */ - private $client; - - /** - * The plugin chain. - * - * @var Plugin[] - */ - private $plugins; - - /** - * A list of options. - * - * @var array - */ - private $options; - - /** - * @param HttpClient|HttpAsyncClient $client - * @param Plugin[] $plugins - * @param array $options { - * - * @var int $max_restarts - * @var Plugin[] $debug_plugins an array of plugins that are injected between each normal plugin - * } - * - * @throws \RuntimeException if client is not an instance of HttpClient or HttpAsyncClient - */ - public function __construct($client, array $plugins = [], array $options = []) - { - if ($client instanceof HttpAsyncClient) { - $this->client = $client; - } elseif ($client instanceof HttpClient) { - $this->client = new EmulatedHttpAsyncClient($client); - } else { - throw new \RuntimeException('Client must be an instance of Http\\Client\\HttpClient or Http\\Client\\HttpAsyncClient'); - } - - $this->plugins = $plugins; - $this->options = $this->configure($options); - } - - /** - * {@inheritdoc} - */ - public function sendRequest(RequestInterface $request) - { - // If we don't have an http client, use the async call - if (!($this->client instanceof HttpClient)) { - return $this->sendAsyncRequest($request)->wait(); - } - - // Else we want to use the synchronous call of the underlying client, and not the async one in the case - // we have both an async and sync call - $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) { - try { - return new HttpFulfilledPromise($this->client->sendRequest($request)); - } catch (HttplugException $exception) { - return new HttpRejectedPromise($exception); - } - }); - - return $pluginChain($request)->wait(); - } - - /** - * {@inheritdoc} - */ - public function sendAsyncRequest(RequestInterface $request) - { - $pluginChain = $this->createPluginChain($this->plugins, function (RequestInterface $request) { - return $this->client->sendAsyncRequest($request); - }); - - return $pluginChain($request); - } - - /** - * Configure the plugin client. - * - * @param array $options - * - * @return array - */ - private function configure(array $options = []) - { - if (isset($options['debug_plugins'])) { - @trigger_error('The "debug_plugins" option is deprecated since 1.5 and will be removed in 2.0.', E_USER_DEPRECATED); - } - - $resolver = new OptionsResolver(); - $resolver->setDefaults([ - 'max_restarts' => 10, - 'debug_plugins' => [], - ]); - - $resolver - ->setAllowedTypes('debug_plugins', 'array') - ->setAllowedValues('debug_plugins', function (array $plugins) { - foreach ($plugins as $plugin) { - // Make sure each object passed with the `debug_plugins` is an instance of Plugin. - if (!$plugin instanceof Plugin) { - return false; - } - } - - return true; - }); - - return $resolver->resolve($options); - } - - /** - * Create the plugin chain. - * - * @param Plugin[] $pluginList A list of plugins - * @param callable $clientCallable Callable making the HTTP call - * - * @return callable - */ - private function createPluginChain($pluginList, callable $clientCallable) - { - $firstCallable = $lastCallable = $clientCallable; - - /* - * Inject debug plugins between each plugin. - */ - $pluginListWithDebug = $this->options['debug_plugins']; - foreach ($pluginList as $plugin) { - $pluginListWithDebug[] = $plugin; - $pluginListWithDebug = array_merge($pluginListWithDebug, $this->options['debug_plugins']); - } - - while ($plugin = array_pop($pluginListWithDebug)) { - $lastCallable = function (RequestInterface $request) use ($plugin, $lastCallable, &$firstCallable) { - return $plugin->handleRequest($request, $lastCallable, $firstCallable); - }; - - $firstCallable = $lastCallable; - } - - $firstCalls = 0; - $firstCallable = function (RequestInterface $request) use ($lastCallable, &$firstCalls) { - if ($firstCalls > $this->options['max_restarts']) { - throw new LoopException('Too many restarts in plugin client', $request); - } - - ++$firstCalls; - - return $lastCallable($request); - }; - - return $firstCallable; - } -} diff --git a/vendor/php-http/client-common/src/PluginClientFactory.php b/vendor/php-http/client-common/src/PluginClientFactory.php deleted file mode 100644 index bd4c08f9a62530a792022e7830a0ecd681e7c828..0000000000000000000000000000000000000000 --- a/vendor/php-http/client-common/src/PluginClientFactory.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -namespace Http\Client\Common; - -use Http\Client\HttpAsyncClient; -use Http\Client\HttpClient; - -/** - * Factory to create PluginClient instances. Using this factory instead of calling PluginClient constructor will enable - * the Symfony profiling without any configuration. - * - * @author Fabien Bourigault <bourigaultfabien@gmail.com> - */ -final class PluginClientFactory -{ - /** - * @var callable - */ - private static $factory; - - /** - * Set the factory to use. - * The callable to provide must have the same arguments and return type as PluginClientFactory::createClient. - * This is used by the HTTPlugBundle to provide a better Symfony integration. - * Unlike the createClient method, this one is static to allow zero configuration profiling by hooking into early - * application execution. - * - * @internal - * - * @param callable $factory - */ - public static function setFactory(callable $factory) - { - static::$factory = $factory; - } - - /** - * @param HttpClient|HttpAsyncClient $client - * @param Plugin[] $plugins - * @param array $options { - * - * @var string $client_name to give client a name which may be used when displaying client information like in - * the HTTPlugBundle profiler. - * } - * - * @see PluginClient constructor for PluginClient specific $options. - * - * @return PluginClient - */ - public function createClient($client, array $plugins = [], array $options = []) - { - if (static::$factory) { - $factory = static::$factory; - - return $factory($client, $plugins, $options); - } - - unset($options['client_name']); - - return new PluginClient($client, $plugins, $options); - } -} diff --git a/vendor/php-http/message/CHANGELOG.md b/vendor/php-http/message/CHANGELOG.md index 76763499376d0bbe1c500888fde98211f468054b..48319fd0b0bfcc63c1befcb4124a7b7c7b3074a5 100644 --- a/vendor/php-http/message/CHANGELOG.md +++ b/vendor/php-http/message/CHANGELOG.md @@ -1,7 +1,44 @@ # Change Log -## 1.6.0 - 2017-07-05 +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + +## Unreleased + +## [1.7.2] - 2018-10-30 + +### Fixed + +- FilteredStream uses `@trigger_error` instead of throwing exceptions to not + break careless users. You still need to fix your stream code to respect + `isSeekable`. Seeking does not work as expected, and we will add exceptions + in version 2. + +## [1.7.1] - 2018-10-29 + +### Fixed + +- FilteredStream is not actually seekable + + +## [1.7.0] - 2018-08-15 + +### Fixed + +- Fix CurlCommandFormatter for binary request payloads +- Fix QueryParam authentication to assemble proper URL regardless of PHP `arg_separator.output` directive +- Do not pass `null` parameters to `Clue\StreamFilter\fun` + +### Changed + +- Dropped tests on HHVM + + +## [1.6.0] - 2017-07-05 ### Added @@ -9,9 +46,10 @@ ### Fixed -- Fix curl command of CurlFormatter when there is an user-agent header +- Fix curl command of CurlFormatter when there is an user-agent header -## 1.5.0 - 2017-02-14 + +## [1.5.0] - 2017-02-14 ### Added @@ -22,7 +60,7 @@ ### Fixed - FilteredStream::getSize returns null because the contents size is unknown. -- Stream factories does not rewinds streams. The previous behavior was not coherent between factories and inputs. +- Stream factories does not rewinds streams. The previous behavior was not coherent between factories and inputs. ### Deprecated @@ -30,14 +68,14 @@ - FilteredStream::getWriteFilter We did not implement writing to the streams at all. And if we do, the filter is an internal information and should not be used by consuming code. -## 1.4.1 - 2016-12-16 +## [1.4.1] - 2016-12-16 ### Fixed - Cookie::matchPath Cookie with root path (`/`) will not match sub path (e.g. `/cookie`). -## 1.4.0 - 2016-10-20 +## [1.4.0] - 2016-10-20 ### Added @@ -46,7 +84,7 @@ - cUrlFormatter to be able to redo the request with a cURL command -## 1.3.1 - 2016-07-15 +## [1.3.1] - 2016-07-15 ### Fixed @@ -55,7 +93,7 @@ - FullHttpMessageFormatter rewinds streams after they are read -## 1.3.0 - 2016-07-14 +## [1.3.0] - 2016-07-14 ### Added @@ -66,7 +104,7 @@ - #41: Response builder broke header value -## 1.2.0 - 2016-03-29 +## [1.2.0] - 2016-03-29 ### Added @@ -86,7 +124,7 @@ - Matching authenitcation method, use RequestConditional instead -## 1.1.0 - 2016-02-25 +## [1.1.0] - 2016-02-25 ### Added @@ -99,10 +137,10 @@ - Fix casting string on a FilteredStream not filtering the output -## 1.0.0 - 2016-01-27 +## [1.0.0] - 2016-01-27 -## 0.2.0 - 2015-12-29 +## [0.2.0] - 2015-12-29 ### Added @@ -111,7 +149,7 @@ - [Apigen](http://www.apigen.org/) configuration -## 0.1.2 - 2015-12-26 +## [0.1.2] - 2015-12-26 ### Added @@ -122,7 +160,7 @@ - Chunk filter namespace in Dechunk stream -## 0.1.1 - 2015-12-25 +## [0.1.1] - 2015-12-25 ### Added @@ -137,3 +175,20 @@ - Encoding - Message decorator - Message factory (Guzzle, Diactoros) + + +[Unreleased]: https://github.com/php-http/message/compare/v1.7.1...HEAD +[1.7.1]: https://github.com/php-http/message/compare/1.7.0...v1.7.1 +[1.7.0]: https://github.com/php-http/message/compare/1.6.0...1.7.0 +[1.6.0]: https://github.com/php-http/message/compare/1.5.0...1.6.0 +[1.5.0]: https://github.com/php-http/message/compare/v1.4.1...1.5.0 +[1.4.1]: https://github.com/php-http/message/compare/v1.4.0...v1.4.1 +[1.4.0]: https://github.com/php-http/message/compare/v1.3.1...v1.4.0 +[1.3.1]: https://github.com/php-http/message/compare/v1.3.0...v1.3.1 +[1.3.0]: https://github.com/php-http/message/compare/v1.2.0...v1.3.0 +[1.2.0]: https://github.com/php-http/message/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/php-http/message/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/php-http/message/compare/0.2.0...v1.0.0 +[0.2.0]: https://github.com/php-http/message/compare/v0.1.2...0.2.0 +[0.1.2]: https://github.com/php-http/message/compare/v0.1.1...v0.1.2 +[0.1.1]: https://github.com/php-http/message/compare/v0.1.0...v0.1.1 diff --git a/vendor/php-http/message/README.md b/vendor/php-http/message/README.md index 338b4157e347c4e4325837e04249950da5512d0a..f6f6e1973e396074b6a5cfbedb8d2591cdfbade6 100644 --- a/vendor/php-http/message/README.md +++ b/vendor/php-http/message/README.md @@ -47,7 +47,7 @@ $ composer test Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html). -## Cretids +## Credits Thanks to [Cuzzle](https://github.com/namshi/cuzzle) for inpiration for the `CurlCommandFormatter`. diff --git a/vendor/php-http/message/composer.json b/vendor/php-http/message/composer.json index 6fbc5dbc55e88d94937da34c4344570e3c9bbcc5..3a9b3ed4341d4c139c572a2caa642334e4c8a12f 100644 --- a/vendor/php-http/message/composer.json +++ b/vendor/php-http/message/composer.json @@ -11,10 +11,10 @@ } ], "require": { - "php": ">=5.4", + "php": "^5.4 || ^7.0", "psr/http-message": "^1.0", "php-http/message-factory": "^1.0.2", - "clue/stream-filter": "^1.3" + "clue/stream-filter": "^1.4" }, "provide": { "php-http/message-factory-implementation": "1.0" diff --git a/vendor/php-http/message/src/Authentication/QueryParam.php b/vendor/php-http/message/src/Authentication/QueryParam.php index 14b58ff14964c92573ab44cb42331edd06709a4b..650cac72728d6557fc01f0bfc5956556890049e1 100644 --- a/vendor/php-http/message/src/Authentication/QueryParam.php +++ b/vendor/php-http/message/src/Authentication/QueryParam.php @@ -41,7 +41,7 @@ final class QueryParam implements Authentication $params = array_merge($params, $this->params); - $query = http_build_query($params); + $query = http_build_query($params, null, '&'); $uri = $uri->withQuery($query); diff --git a/vendor/php-http/message/src/Builder/ResponseBuilder.php b/vendor/php-http/message/src/Builder/ResponseBuilder.php index e6933a0cdee6a279e907720959a108771cdc0c86..de2e882864028fe733fe6110d2924297ee611731 100644 --- a/vendor/php-http/message/src/Builder/ResponseBuilder.php +++ b/vendor/php-http/message/src/Builder/ResponseBuilder.php @@ -104,7 +104,7 @@ class ResponseBuilder public function setStatus($statusLine) { $parts = explode(' ', $statusLine, 3); - if (count($parts) < 2 || strpos(strtolower($parts[0]), 'http/') !== 0) { + if (count($parts) < 2 || 0 !== strpos(strtolower($parts[0]), 'http/')) { throw new \InvalidArgumentException( sprintf('"%s" is not a valid HTTP status line', $statusLine) ); @@ -130,7 +130,7 @@ class ResponseBuilder public function addHeader($headerLine) { $parts = explode(':', $headerLine, 2); - if (count($parts) !== 2) { + if (2 !== count($parts)) { throw new \InvalidArgumentException( sprintf('"%s" is not a valid HTTP header line', $headerLine) ); diff --git a/vendor/php-http/message/src/Cookie.php b/vendor/php-http/message/src/Cookie.php index 5f61b90656c313568049ed9b52c62bdaa326c2da..98ac57c091d0bab08e9061099d95b7b835331c00 100644 --- a/vendor/php-http/message/src/Cookie.php +++ b/vendor/php-http/message/src/Cookie.php @@ -56,7 +56,7 @@ final class Cookie /** * @param string $name * @param string|null $value - * @param int $maxAge + * @param int|null $maxAge * @param string|null $domain * @param string|null $path * @param bool $secure @@ -295,7 +295,7 @@ final class Cookie public function matchDomain($domain) { // Domain is not set or exact match - if (!$this->hasDomain() || strcasecmp($domain, $this->domain) === 0) { + if (!$this->hasDomain() || 0 === strcasecmp($domain, $this->domain)) { return true; } @@ -343,7 +343,7 @@ final class Cookie */ public function matchPath($path) { - return $this->path === $path || (strpos($path, rtrim($this->path, '/').'/') === 0); + return $this->path === $path || (0 === strpos($path, rtrim($this->path, '/').'/')); } /** @@ -405,7 +405,7 @@ final class Cookie * * @return bool */ - public function match(Cookie $cookie) + public function match(self $cookie) { return $this->name === $cookie->name && $this->domain === $cookie->domain and $this->path === $cookie->path; } @@ -517,7 +517,7 @@ final class Cookie { $path = rtrim($path, '/'); - if (empty($path) or substr($path, 0, 1) !== '/') { + if (empty($path) or '/' !== substr($path, 0, 1)) { $path = '/'; } diff --git a/vendor/php-http/message/src/Encoding/CompressStream.php b/vendor/php-http/message/src/Encoding/CompressStream.php index d1013dc1325c19ebadfa30d5922de5a03c1585b1..eeec6e037a4d8d66c684d4cc9d1c82eb213fb03f 100644 --- a/vendor/php-http/message/src/Encoding/CompressStream.php +++ b/vendor/php-http/message/src/Encoding/CompressStream.php @@ -2,6 +2,7 @@ namespace Http\Message\Encoding; +use Clue\StreamFilter as Filter; use Psr\Http\Message\StreamInterface; /** @@ -21,7 +22,10 @@ class CompressStream extends FilteredStream throw new \RuntimeException('The zlib extension must be enabled to use this stream'); } - parent::__construct($stream, ['window' => 15, 'level' => $level], ['window' => 15]); + parent::__construct($stream, ['window' => 15, 'level' => $level]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 15]); } /** diff --git a/vendor/php-http/message/src/Encoding/DecompressStream.php b/vendor/php-http/message/src/Encoding/DecompressStream.php index 4e3a723e96ea2fedd718f92516ab146e8dfd0419..9a950ea9eff464d1309cc691cd241dfc7bf217af 100644 --- a/vendor/php-http/message/src/Encoding/DecompressStream.php +++ b/vendor/php-http/message/src/Encoding/DecompressStream.php @@ -2,6 +2,7 @@ namespace Http\Message\Encoding; +use Clue\StreamFilter as Filter; use Psr\Http\Message\StreamInterface; /** @@ -21,7 +22,10 @@ class DecompressStream extends FilteredStream throw new \RuntimeException('The zlib extension must be enabled to use this stream'); } - parent::__construct($stream, ['window' => 15], ['window' => 15, 'level' => $level]); + parent::__construct($stream, ['window' => 15]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 15, 'level' => $level]); } /** diff --git a/vendor/php-http/message/src/Encoding/DeflateStream.php b/vendor/php-http/message/src/Encoding/DeflateStream.php index 1d7344bac227f43d5d2278f9f3ef9dd494f1b217..f7ce8e2d11a98d8bc01f60c4878e935ae3445495 100644 --- a/vendor/php-http/message/src/Encoding/DeflateStream.php +++ b/vendor/php-http/message/src/Encoding/DeflateStream.php @@ -2,6 +2,7 @@ namespace Http\Message\Encoding; +use Clue\StreamFilter as Filter; use Psr\Http\Message\StreamInterface; /** @@ -17,7 +18,10 @@ class DeflateStream extends FilteredStream */ public function __construct(StreamInterface $stream, $level = -1) { - parent::__construct($stream, ['window' => -15, 'level' => $level], ['window' => -15]); + parent::__construct($stream, ['window' => -15, 'level' => $level]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => -15]); } /** diff --git a/vendor/php-http/message/src/Encoding/FilteredStream.php b/vendor/php-http/message/src/Encoding/FilteredStream.php index a32554b7a345415459efdc3c1f5855e833d5bc6c..7e5713e8d143b474070041777f3a1e1e0c31e80f 100644 --- a/vendor/php-http/message/src/Encoding/FilteredStream.php +++ b/vendor/php-http/message/src/Encoding/FilteredStream.php @@ -15,7 +15,10 @@ abstract class FilteredStream implements StreamInterface { const BUFFER_SIZE = 8192; - use StreamDecorator; + use StreamDecorator { + rewind as private doRewind; + seek as private doSeek; + } /** * @var callable @@ -57,11 +60,18 @@ abstract class FilteredStream implements StreamInterface */ public function __construct(StreamInterface $stream, $readFilterOptions = null, $writeFilterOptions = null) { - $this->readFilterCallback = Filter\fun($this->readFilter(), $readFilterOptions); - $this->writeFilterCallback = Filter\fun($this->writeFilter(), $writeFilterOptions); + if (null !== $readFilterOptions) { + $this->readFilterCallback = Filter\fun($this->readFilter(), $readFilterOptions); + } else { + $this->readFilterCallback = Filter\fun($this->readFilter()); + } if (null !== $writeFilterOptions) { + $this->writeFilterCallback = Filter\fun($this->writeFilter(), $writeFilterOptions); + @trigger_error('The $writeFilterOptions argument is deprecated since version 1.5 and will be removed in 2.0.', E_USER_DEPRECATED); + } else { + $this->writeFilterCallback = Filter\fun($this->writeFilter()); } $this->stream = $stream; @@ -98,7 +108,7 @@ abstract class FilteredStream implements StreamInterface */ public function eof() { - return $this->stream->eof() && $this->buffer === ''; + return $this->stream->eof() && '' === $this->buffer; } /** @@ -128,7 +138,7 @@ abstract class FilteredStream implements StreamInterface while (!$this->eof()) { $buf = $this->read(self::BUFFER_SIZE); // Using a loose equality here to match on '' and false. - if ($buf == null) { + if (null == $buf) { break; } @@ -139,11 +149,11 @@ abstract class FilteredStream implements StreamInterface } /** - * {@inheritdoc} + * Always returns null because we can't tell the size of a stream when we filter. */ public function getSize() { - return; + return null; } /** @@ -154,6 +164,34 @@ abstract class FilteredStream implements StreamInterface return $this->getContents(); } + /** + * Filtered streams are not seekable. + * + * We would need to buffer and process everything to allow seeking. + */ + public function isSeekable() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function rewind() + { + @trigger_error('Filtered streams are not seekable. This method will start raising an exception in the next major version', E_USER_DEPRECATED); + $this->doRewind(); + } + + /** + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + @trigger_error('Filtered streams are not seekable. This method will start raising an exception in the next major version', E_USER_DEPRECATED); + $this->doSeek($offset, $whence); + } + /** * Returns the read filter name. * diff --git a/vendor/php-http/message/src/Encoding/GzipDecodeStream.php b/vendor/php-http/message/src/Encoding/GzipDecodeStream.php index 4f958edc965f4facd24ae93633be568e34f082a7..19a2b8f097063bdbe3c1dee9dd13470a7e07ab3d 100644 --- a/vendor/php-http/message/src/Encoding/GzipDecodeStream.php +++ b/vendor/php-http/message/src/Encoding/GzipDecodeStream.php @@ -2,6 +2,7 @@ namespace Http\Message\Encoding; +use Clue\StreamFilter as Filter; use Psr\Http\Message\StreamInterface; /** @@ -21,7 +22,10 @@ class GzipDecodeStream extends FilteredStream throw new \RuntimeException('The zlib extension must be enabled to use this stream'); } - parent::__construct($stream, ['window' => 31], ['window' => 31, 'level' => $level]); + parent::__construct($stream, ['window' => 31]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 31, 'level' => $level]); } /** diff --git a/vendor/php-http/message/src/Encoding/GzipEncodeStream.php b/vendor/php-http/message/src/Encoding/GzipEncodeStream.php index 1066eec07c34d4053be68a2080e004d2fe971e54..8555d4ae18bc5b429ae444ae203d76d02dacc4b2 100644 --- a/vendor/php-http/message/src/Encoding/GzipEncodeStream.php +++ b/vendor/php-http/message/src/Encoding/GzipEncodeStream.php @@ -2,6 +2,7 @@ namespace Http\Message\Encoding; +use Clue\StreamFilter as Filter; use Psr\Http\Message\StreamInterface; /** @@ -21,7 +22,10 @@ class GzipEncodeStream extends FilteredStream throw new \RuntimeException('The zlib extension must be enabled to use this stream'); } - parent::__construct($stream, ['window' => 31, 'level' => $level], ['window' => 31]); + parent::__construct($stream, ['window' => 31, 'level' => $level]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => 31]); } /** diff --git a/vendor/php-http/message/src/Encoding/InflateStream.php b/vendor/php-http/message/src/Encoding/InflateStream.php index 70702304f26a77777da16aa6da4a605d5e306300..863b73defbd01eede2f38aa8bbd39b0b10a3eb87 100644 --- a/vendor/php-http/message/src/Encoding/InflateStream.php +++ b/vendor/php-http/message/src/Encoding/InflateStream.php @@ -2,6 +2,7 @@ namespace Http\Message\Encoding; +use Clue\StreamFilter as Filter; use Psr\Http\Message\StreamInterface; /** @@ -21,7 +22,10 @@ class InflateStream extends FilteredStream throw new \RuntimeException('The zlib extension must be enabled to use this stream'); } - parent::__construct($stream, ['window' => -15], ['window' => -15, 'level' => $level]); + parent::__construct($stream, ['window' => -15]); + + // @deprecated will be removed in 2.0 + $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => -15, 'level' => $level]); } /** diff --git a/vendor/php-http/message/src/Formatter/CurlCommandFormatter.php b/vendor/php-http/message/src/Formatter/CurlCommandFormatter.php index a0fe7e5fcb6ba043a914b547bb7d4af35a1b9471..80602508f49f2ef15f48d8d262d6c9cec54d2101 100644 --- a/vendor/php-http/message/src/Formatter/CurlCommandFormatter.php +++ b/vendor/php-http/message/src/Formatter/CurlCommandFormatter.php @@ -19,9 +19,9 @@ class CurlCommandFormatter implements Formatter public function formatRequest(RequestInterface $request) { $command = sprintf('curl %s', escapeshellarg((string) $request->getUri()->withFragment(''))); - if ($request->getProtocolVersion() === '1.0') { + if ('1.0' === $request->getProtocolVersion()) { $command .= ' --http1.0'; - } elseif ($request->getProtocolVersion() === '2.0') { + } elseif ('2.0' === $request->getProtocolVersion()) { $command .= ' --http2'; } @@ -36,11 +36,21 @@ class CurlCommandFormatter implements Formatter $body = $request->getBody(); if ($body->getSize() > 0) { - if (!$body->isSeekable()) { - return 'Cant format Request as cUrl command if body stream is not seekable.'; + if ($body->isSeekable()) { + $data = $body->__toString(); + $body->rewind(); + if (preg_match('/[\x00-\x1F\x7F]/', $data)) { + $data = '[binary stream omitted]'; + } + } else { + $data = '[non-seekable stream omitted]'; } - $command .= sprintf(' --data %s', escapeshellarg($body->__toString())); - $body->rewind(); + $escapedData = @escapeshellarg($data); + if (empty($escapedData)) { + $escapedData = 'We couldn\'t not escape the data properly'; + } + + $command .= sprintf(' --data %s', $escapedData); } return $command; @@ -69,6 +79,7 @@ class CurlCommandFormatter implements Formatter if ('user-agent' === strtolower($name)) { $command .= sprintf(' -A %s', escapeshellarg($values[0])); + continue; } diff --git a/vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php b/vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php index 3fa10295feca1930bb61f0b0062c210f8848839c..1918c597b0cf25940b95e337c7075d45b0c1cd14 100644 --- a/vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php +++ b/vendor/php-http/message/src/Formatter/FullHttpMessageFormatter.php @@ -78,7 +78,7 @@ class FullHttpMessageFormatter implements Formatter private function addBody(MessageInterface $request, $message) { $stream = $request->getBody(); - if (!$stream->isSeekable() || $this->maxBodyLength === 0) { + if (!$stream->isSeekable() || 0 === $this->maxBodyLength) { // Do not read the stream $message .= "\n"; } else { diff --git a/vendor/php-http/multipart-stream-builder/CHANGELOG.md b/vendor/php-http/multipart-stream-builder/CHANGELOG.md deleted file mode 100644 index 1f0ee3d7f32e2bc04227bb2988081ba0fbd2af08..0000000000000000000000000000000000000000 --- a/vendor/php-http/multipart-stream-builder/CHANGELOG.md +++ /dev/null @@ -1,60 +0,0 @@ -# Change Log - -## 1.0.0 - 2017-05-21 - -No changes from 0.2.0. - -## 0.2.0 - 2017-02-20 - -You may do a BC update to version 0.2.0 if you are sure that you are not adding -multiple resources with the same name to the Builder. - -### Fixed - -- Make sure one can add resources with same name without overwrite. - -## 0.1.6 - 2017-02-16 - -### Fixed - -- Performance improvements by avoid using `uniqid()`. - -## 0.1.5 - 2017-02-14 - -### Fixed - -- Support for non-readable streams. This fix was needed because flaws in Guzzle, Zend and Slims implementations of PSR-7. - -## 0.1.4 - 2016-12-31 - -### Added - -- Added support for resetting the builder - -## 0.1.3 - 2016-12-22 - -### Added - -- Added `CustomMimetypeHelper` to allow you to configure custom mimetypes. - -### Changed - -- Using regular expression instead of `basename($filename)` because basename is depending on locale. - -## 0.1.2 - 2016-08-31 - -### Added - -- Support for Outlook msg files. - -## 0.1.1 - 2016-08-10 - -### Added - -- Support for Apple passbook. - -## 0.1.0 - 2016-07-19 - -### Added - -- Initial release diff --git a/vendor/php-http/multipart-stream-builder/LICENSE b/vendor/php-http/multipart-stream-builder/LICENSE deleted file mode 100644 index 8e2c4a0b85c31bf132105920cc90ba371025eb8a..0000000000000000000000000000000000000000 --- a/vendor/php-http/multipart-stream-builder/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015 PHP HTTP Team <team@php-http.org> - -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/php-http/multipart-stream-builder/README.md b/vendor/php-http/multipart-stream-builder/README.md deleted file mode 100644 index 10ad0588b4b7e9a43e9eaced1ecda28c7b4cf372..0000000000000000000000000000000000000000 --- a/vendor/php-http/multipart-stream-builder/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# PSR-7 Multipart Stream Builder - -[](https://github.com/php-http/multipart-stream-builder/releases) -[](https://travis-ci.org/php-http/multipart-stream-builder) -[](https://scrutinizer-ci.com/g/php-http/multipart-stream-builder) -[](https://scrutinizer-ci.com/g/php-http/multipart-stream-builder) -[](https://packagist.org/packages/php-http/multipart-stream-builder) - -**A builder for Multipart PSR-7 Streams. The builder create streams independenly form any PSR-7 implementation.** - - -## Install - -Via Composer - -``` bash -$ composer require php-http/multipart-stream-builder -``` - -## Documentation - -Please see the [official documentation](http://php-http.readthedocs.org/en/latest/components/multipart-stream-builder.html). - - -## Contributing - -Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details. - - -## Security - -If you discover any security related issues, please contact us at [security@php-http.org](mailto:security@php-http.org). - - -## License - -The MIT License (MIT). Please see [License File](LICENSE) for more information. diff --git a/vendor/php-http/multipart-stream-builder/appveyor.yml b/vendor/php-http/multipart-stream-builder/appveyor.yml deleted file mode 100644 index 8d7af73f722812a369260d79a9078c2b01a02393..0000000000000000000000000000000000000000 --- a/vendor/php-http/multipart-stream-builder/appveyor.yml +++ /dev/null @@ -1,39 +0,0 @@ -build: false -platform: - - x86 - - x64 - -clone_folder: c:\projects\php-http\multipart-stream-builder - -cache: - - c:\tools\php -> appveyor.yml - -init: - - SET PATH=c:\php;%PATH% - - SET COMPOSER_NO_INTERACTION=1 - - SET PHP=1 - - -install: - - IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php) - - cd c:\php - - IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-7.0.0-nts-Win32-VC14-x86.zip - - IF %PHP%==1 7z x php-7.0.0-nts-Win32-VC14-x86.zip -y >nul - - IF %PHP%==1 del /Q *.zip - - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat - - IF %PHP%==1 copy /Y php.ini-development php.ini - - IF %PHP%==1 echo max_execution_time=1200 >> php.ini - - IF %PHP%==1 echo date.timezone="UTC" >> php.ini - - IF %PHP%==1 echo extension_dir=ext >> php.ini - - IF %PHP%==1 echo extension=php_openssl.dll >> php.ini - - IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini - - IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini - - appveyor DownloadFile https://getcomposer.org/composer.phar - - cd c:\projects\php-http\multipart-stream-builder - - mkdir %APPDATA%\Composer - - composer update --prefer-dist --no-progress --ansi - -test_script: - - cd c:\projects\php-http\multipart-stream-builder - - vendor\bin\phpunit.bat --verbose - diff --git a/vendor/php-http/multipart-stream-builder/composer.json b/vendor/php-http/multipart-stream-builder/composer.json deleted file mode 100644 index 1ada3605c54bd13ede3523d86fd9ac8a4cb31fbd..0000000000000000000000000000000000000000 --- a/vendor/php-http/multipart-stream-builder/composer.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "php-http/multipart-stream-builder", - "description": "A builder class that help you create a multipart stream", - "license": "MIT", - "keywords": ["http", "factory", "message", "stream", "multipart stream"], - "homepage": "http://php-http.org", - "authors": [ - { - "name": "Tobias Nyholm", - "email": "tobias.nyholm@gmail.com" - } - ], - "require": { - "php": "^5.5 || ^7.0", - "psr/http-message": "^1.0", - "php-http/message-factory": "^1.0.2", - "php-http/discovery": "^1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.4", - "php-http/message": "^1.5", - "zendframework/zend-diactoros": "^1.3.5" - }, - "autoload": { - "psr-4": { - "Http\\Message\\MultipartStream\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "tests\\Http\\Message\\MultipartStream\\": "tests/" - } - }, - "scripts": { - "test": "vendor/bin/phpunit", - "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml" - }, - "extra": { - "branch-alias": { - "dev-master": "0.3-dev" - } - } -} diff --git a/vendor/php-http/multipart-stream-builder/src/ApacheMimetypeHelper.php b/vendor/php-http/multipart-stream-builder/src/ApacheMimetypeHelper.php deleted file mode 100644 index 6e4ca660246f5fdc929ca455e3e30b1ddc6c639b..0000000000000000000000000000000000000000 --- a/vendor/php-http/multipart-stream-builder/src/ApacheMimetypeHelper.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php - -namespace Http\Message\MultipartStream; - -/** - * This class helps to find the proper mime types. The source of this file is taken - * from Guzzle. - * - * @author Michael Dowling and contributors to guzzlehttp/psr7 - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - */ -class ApacheMimetypeHelper implements MimetypeHelper -{ - /** - * {@inheritdoc} - * - * @see http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types - */ - public function getMimetypeFromFilename($filename) - { - return $this->getMimetypeFromExtension(pathinfo($filename, PATHINFO_EXTENSION)); - } - - /** - * {@inheritdoc} - * - * @see http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types - */ - public function getMimetypeFromExtension($extension) - { - static $mimetypes = [ - '7z' => 'application/x-7z-compressed', - 'aac' => 'audio/x-aac', - 'ai' => 'application/postscript', - 'aif' => 'audio/x-aiff', - 'asc' => 'text/plain', - 'asf' => 'video/x-ms-asf', - 'atom' => 'application/atom+xml', - 'avi' => 'video/x-msvideo', - 'bmp' => 'image/bmp', - 'bz2' => 'application/x-bzip2', - 'cer' => 'application/pkix-cert', - 'crl' => 'application/pkix-crl', - 'crt' => 'application/x-x509-ca-cert', - 'css' => 'text/css', - 'csv' => 'text/csv', - 'cu' => 'application/cu-seeme', - 'deb' => 'application/x-debian-package', - 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dvi' => 'application/x-dvi', - 'eot' => 'application/vnd.ms-fontobject', - 'eps' => 'application/postscript', - 'epub' => 'application/epub+zip', - 'etx' => 'text/x-setext', - 'flac' => 'audio/flac', - 'flv' => 'video/x-flv', - 'gif' => 'image/gif', - 'gz' => 'application/gzip', - 'htm' => 'text/html', - 'html' => 'text/html', - 'ico' => 'image/x-icon', - 'ics' => 'text/calendar', - 'ini' => 'text/plain', - 'iso' => 'application/x-iso9660-image', - 'jar' => 'application/java-archive', - 'jpe' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'js' => 'text/javascript', - 'json' => 'application/json', - 'latex' => 'application/x-latex', - 'log' => 'text/plain', - 'm4a' => 'audio/mp4', - 'm4v' => 'video/mp4', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mov' => 'video/quicktime', - 'mp3' => 'audio/mpeg', - 'mp4' => 'video/mp4', - 'mp4a' => 'audio/mp4', - 'mp4v' => 'video/mp4', - 'mpe' => 'video/mpeg', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpg4' => 'video/mp4', - 'oga' => 'audio/ogg', - 'ogg' => 'audio/ogg', - 'ogv' => 'video/ogg', - 'ogx' => 'application/ogg', - 'pbm' => 'image/x-portable-bitmap', - 'pdf' => 'application/pdf', - 'pgm' => 'image/x-portable-graymap', - 'png' => 'image/png', - 'pnm' => 'image/x-portable-anymap', - 'ppm' => 'image/x-portable-pixmap', - 'ppt' => 'application/vnd.ms-powerpoint', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'ps' => 'application/postscript', - 'qt' => 'video/quicktime', - 'rar' => 'application/x-rar-compressed', - 'ras' => 'image/x-cmu-raster', - 'rss' => 'application/rss+xml', - 'rtf' => 'application/rtf', - 'sgm' => 'text/sgml', - 'sgml' => 'text/sgml', - 'svg' => 'image/svg+xml', - 'swf' => 'application/x-shockwave-flash', - 'tar' => 'application/x-tar', - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff', - 'torrent' => 'application/x-bittorrent', - 'ttf' => 'application/x-font-ttf', - 'txt' => 'text/plain', - 'wav' => 'audio/x-wav', - 'webm' => 'video/webm', - 'wma' => 'audio/x-ms-wma', - 'wmv' => 'video/x-ms-wmv', - 'woff' => 'application/x-font-woff', - 'wsdl' => 'application/wsdl+xml', - 'xbm' => 'image/x-xbitmap', - 'xls' => 'application/vnd.ms-excel', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xml' => 'application/xml', - 'xpm' => 'image/x-xpixmap', - 'xwd' => 'image/x-xwindowdump', - 'yaml' => 'text/yaml', - 'yml' => 'text/yaml', - 'zip' => 'application/zip', - - // Non-Apache standard - 'pkpass' => 'application/vnd.apple.pkpass', - 'msg' => 'application/vnd.ms-outlook', - ]; - - $extension = strtolower($extension); - - return isset($mimetypes[$extension]) - ? $mimetypes[$extension] - : null; - } -} diff --git a/vendor/php-http/multipart-stream-builder/src/CustomMimetypeHelper.php b/vendor/php-http/multipart-stream-builder/src/CustomMimetypeHelper.php deleted file mode 100644 index 9f3f0d9211e563aeabcb59b6e34912de7ae1779e..0000000000000000000000000000000000000000 --- a/vendor/php-http/multipart-stream-builder/src/CustomMimetypeHelper.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Http\Message\MultipartStream; - -/** - * Let you add your own mimetypes. The mimetype lookup will fallback on the ApacheMimeTypeHelper. - * - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - */ -class CustomMimetypeHelper extends ApacheMimetypeHelper -{ - /** - * @var array - */ - private $mimetypes = []; - - /** - * @param array $mimetypes should be of type extension => mimetype - */ - public function __construct(array $mimetypes = []) - { - $this->mimetypes = $mimetypes; - } - - /** - * @param string $extension - * @param string $mimetype - * - * @return $this - */ - public function addMimetype($extension, $mimetype) - { - $this->mimetypes[$extension] = $mimetype; - - return $this; - } - - /** - * {@inheritdoc} - * - * Check if we have any defined mimetypes and of not fallback to ApacheMimetypeHelper - */ - public function getMimetypeFromExtension($extension) - { - $extension = strtolower($extension); - - return isset($this->mimetypes[$extension]) - ? $this->mimetypes[$extension] - : parent::getMimetypeFromExtension($extension); - } -} diff --git a/vendor/php-http/multipart-stream-builder/src/MimetypeHelper.php b/vendor/php-http/multipart-stream-builder/src/MimetypeHelper.php deleted file mode 100644 index fa7cf18003720731c5391e572537fb42795802e4..0000000000000000000000000000000000000000 --- a/vendor/php-http/multipart-stream-builder/src/MimetypeHelper.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -namespace Http\Message\MultipartStream; - -/** - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - */ -interface MimetypeHelper -{ - /** - * Determines the mimetype of a file by looking at its extension. - * - * @param string $filename - * - * @return null|string - */ - public function getMimetypeFromFilename($filename); - - /** - * Maps a file extensions to a mimetype. - * - * @param string $extension The file extension - * - * @return string|null - */ - public function getMimetypeFromExtension($extension); -} diff --git a/vendor/php-http/multipart-stream-builder/src/MultipartStreamBuilder.php b/vendor/php-http/multipart-stream-builder/src/MultipartStreamBuilder.php deleted file mode 100644 index 3421d73487438866f3d037abfd041244927f8b50..0000000000000000000000000000000000000000 --- a/vendor/php-http/multipart-stream-builder/src/MultipartStreamBuilder.php +++ /dev/null @@ -1,278 +0,0 @@ -<?php - -namespace Http\Message\MultipartStream; - -use Http\Discovery\StreamFactoryDiscovery; -use Http\Message\StreamFactory; -use Psr\Http\Message\StreamInterface; - -/** - * Build your own Multipart stream. A Multipart stream is a collection of streams separated with a $bounary. This - * class helps you to create a Multipart stream with stream implementations from any PSR7 library. - * - * @author Michael Dowling and contributors to guzzlehttp/psr7 - * @author Tobias Nyholm <tobias.nyholm@gmail.com> - */ -class MultipartStreamBuilder -{ - /** - * @var StreamFactory - */ - private $streamFactory; - - /** - * @var MimetypeHelper - */ - private $mimetypeHelper; - - /** - * @var string - */ - private $boundary; - - /** - * @var array Element where each Element is an array with keys ['contents', 'headers', 'filename'] - */ - private $data = []; - - /** - * @param StreamFactory|null $streamFactory - */ - public function __construct(StreamFactory $streamFactory = null) - { - $this->streamFactory = $streamFactory ?: StreamFactoryDiscovery::find(); - } - - /** - * Add a resource to the Multipart Stream. - * - * @param string $name the formpost name - * @param string|resource|StreamInterface $resource - * @param array $options { - * - * @var array $headers additional headers ['header-name' => 'header-value'] - * @var string $filename - * } - * - * @return MultipartStreamBuilder - */ - public function addResource($name, $resource, array $options = []) - { - $stream = $this->streamFactory->createStream($resource); - - // validate options['headers'] exists - if (!isset($options['headers'])) { - $options['headers'] = []; - } - - // Try to add filename if it is missing - if (empty($options['filename'])) { - $options['filename'] = null; - $uri = $stream->getMetadata('uri'); - if (substr($uri, 0, 6) !== 'php://') { - $options['filename'] = $uri; - } - } - - $this->prepareHeaders($name, $stream, $options['filename'], $options['headers']); - $this->data[] = ['contents' => $stream, 'headers' => $options['headers'], 'filename' => $options['filename']]; - - return $this; - } - - /** - * Build the stream. - * - * @return StreamInterface - */ - public function build() - { - $streams = ''; - foreach ($this->data as $data) { - // Add start and headers - $streams .= "--{$this->getBoundary()}\r\n". - $this->getHeaders($data['headers'])."\r\n"; - - // Convert the stream to string - /* @var $contentStream StreamInterface */ - $contentStream = $data['contents']; - if ($contentStream->isSeekable()) { - $streams .= $contentStream->__toString(); - } else { - $streams .= $contentStream->getContents(); - } - - $streams .= "\r\n"; - } - - // Append end - $streams .= "--{$this->getBoundary()}--\r\n"; - - return $this->streamFactory->createStream($streams); - } - - /** - * Add extra headers if they are missing. - * - * @param string $name - * @param StreamInterface $stream - * @param string $filename - * @param array &$headers - */ - private function prepareHeaders($name, StreamInterface $stream, $filename, array &$headers) - { - $hasFilename = $filename === '0' || $filename; - - // Set a default content-disposition header if one was not provided - if (!$this->hasHeader($headers, 'content-disposition')) { - $headers['Content-Disposition'] = sprintf('form-data; name="%s"', $name); - if ($hasFilename) { - $headers['Content-Disposition'] .= sprintf('; filename="%s"', $this->basename($filename)); - } - } - - // Set a default content-length header if one was not provided - if (!$this->hasHeader($headers, 'content-length')) { - if ($length = $stream->getSize()) { - $headers['Content-Length'] = (string) $length; - } - } - - // Set a default Content-Type if one was not provided - if (!$this->hasHeader($headers, 'content-type') && $hasFilename) { - if ($type = $this->getMimetypeHelper()->getMimetypeFromFilename($filename)) { - $headers['Content-Type'] = $type; - } - } - } - - /** - * Get the headers formatted for the HTTP message. - * - * @param array $headers - * - * @return string - */ - private function getHeaders(array $headers) - { - $str = ''; - foreach ($headers as $key => $value) { - $str .= sprintf("%s: %s\r\n", $key, $value); - } - - return $str; - } - - /** - * Check if header exist. - * - * @param array $headers - * @param string $key case insensitive - * - * @return bool - */ - private function hasHeader(array $headers, $key) - { - $lowercaseHeader = strtolower($key); - foreach ($headers as $k => $v) { - if (strtolower($k) === $lowercaseHeader) { - return true; - } - } - - return false; - } - - /** - * Get the boundary that separates the streams. - * - * @return string - */ - public function getBoundary() - { - if ($this->boundary === null) { - $this->boundary = uniqid('', true); - } - - return $this->boundary; - } - - /** - * @param string $boundary - * - * @return MultipartStreamBuilder - */ - public function setBoundary($boundary) - { - $this->boundary = $boundary; - - return $this; - } - - /** - * @return MimetypeHelper - */ - private function getMimetypeHelper() - { - if ($this->mimetypeHelper === null) { - $this->mimetypeHelper = new ApacheMimetypeHelper(); - } - - return $this->mimetypeHelper; - } - - /** - * If you have custom file extension you may overwrite the default MimetypeHelper with your own. - * - * @param MimetypeHelper $mimetypeHelper - * - * @return MultipartStreamBuilder - */ - public function setMimetypeHelper(MimetypeHelper $mimetypeHelper) - { - $this->mimetypeHelper = $mimetypeHelper; - - return $this; - } - - /** - * Reset and clear all stored data. This allows you to use builder for a subsequent request. - * - * @return MultipartStreamBuilder - */ - public function reset() - { - $this->data = []; - $this->boundary = null; - - return $this; - } - - /** - * Gets the filename from a given path. - * - * PHP's basename() does not properly support streams or filenames beginning with a non-US-ASCII character. - * - * @author Drupal 8.2 - * - * @param string $path - * - * @return string - */ - private function basename($path) - { - $separators = '/'; - if (DIRECTORY_SEPARATOR != '/') { - // For Windows OS add special separator. - $separators .= DIRECTORY_SEPARATOR; - } - - // Remove right-most slashes when $path points to directory. - $path = rtrim($path, $separators); - - // Returns the trailing part of the $path starting after one of the directory separators. - $filename = preg_match('@[^'.preg_quote($separators, '@').']+$@', $path, $matches) ? $matches[0] : ''; - - return $filename; - } -} diff --git a/vendor/respect/validation/CHANGELOG.md b/vendor/respect/validation/CHANGELOG.md index 941c175275c29be86ef6e6bd5559517e356dee85..6354b8158eac4e33b02d8d349d077abbdd5f9f4e 100644 --- a/vendor/respect/validation/CHANGELOG.md +++ b/vendor/respect/validation/CHANGELOG.md @@ -101,8 +101,6 @@ All notable changes of the Respect\Validation releases are documented in this fi *** See also: +- [README](README.md) - [Contributing](CONTRIBUTING.md) -- [Feature Guide](docs/README.md) -- [Installation](docs/INSTALL.md) - [License](LICENSE.md) -- [Validators](docs/VALIDATORS.md) diff --git a/vendor/respect/validation/CONTRIBUTING.md b/vendor/respect/validation/CONTRIBUTING.md index ca3b13191dd70e6315f37aa1d38741daf1129921..e36bf0f8adb2678f79e7b511a661af2a7918ddce 100644 --- a/vendor/respect/validation/CONTRIBUTING.md +++ b/vendor/respect/validation/CONTRIBUTING.md @@ -179,8 +179,8 @@ As we already said, none of them are required but you will help us a lot. ## Documentation Our docs at http://respect.github.io/Validation are generated from our Markdown -files using [Couscous][]. Add your brand new rule there and everything will be -updated as soon as possible. +files using [Read the Docs][]. Add your brand new rule there and everything will +be updated automatically. ## Running Tests @@ -234,15 +234,13 @@ $ vendor/bin/php-cs-fixer fix *** See also: -- [Feature Guide](docs/README.md) -- [Installation](docs/INSTALL.md) +- [README](README.md) - [License](LICENSE.md) -- [Validators](docs/VALIDATORS.md) - [Changelog](CHANGELOG.md) [ArrayType]: https://github.com/Respect/Validation/commit/f08a1fa -[Couscous]: http://couscous.io/ "Couscous" +[Read the Docs]: https://readthedocs.org/ "Read the Docs" [data provider]: https://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers "PHPUnit Data Providers" [open an issue]: http://github.com/Respect/Validation/issues [php-cs-fixer]: https://github.com/FriendsOfPHP/PHP-CS-Fixer "PHP Coding Standard Fixer" diff --git a/vendor/respect/validation/LICENSE.md b/vendor/respect/validation/LICENSE.md index fc1d6e8bd414a62d5705663169534cf9638d0d30..615cfd2e8da8797393e71c88b153b4372c533a1a 100644 --- a/vendor/respect/validation/LICENSE.md +++ b/vendor/respect/validation/LICENSE.md @@ -32,8 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *** See also: +- [README](README.md) - [Contributing](CONTRIBUTING.md) -- [Feature Guide](docs/README.md) -- [Installation](docs/INSTALL.md) -- [Validators](docs/VALIDATORS.md) - [Changelog](CHANGELOG.md) diff --git a/vendor/respect/validation/README.md b/vendor/respect/validation/README.md index dbf83e7f0cfe5775106b5b9d144c718cec82d5b6..6e026234f7e57b6e036a141fa768fa991f74b6d7 100644 --- a/vendor/respect/validation/README.md +++ b/vendor/respect/validation/README.md @@ -10,16 +10,18 @@ [The most awesome validation engine ever created for PHP.](http://bit.ly/1a1oeQv) - Complex rules made simple: `v::numeric()->positive()->between(1, 255)->validate($input)`. -- [Granularity control](docs/README.md#validation-methods) for advanced reporting. +- Granularity control for advanced reporting. - More than 100 (fully tested) validators. -- [A concrete API](docs/CONCRETE_API.md) for non fluent usage. +- A concrete API for non fluent usage. - Works on PHP 5.4+ or HHVM 3.3+ +## Documentation + +Documentation can be found in https://respect-validation.readthedocs.io +and also in the [docs/](docs/index.md) folder. + ## Table of contents - [Contributing](CONTRIBUTING.md) -- [Feature Guide](docs/README.md) -- [Installation](docs/INSTALL.md) - [License](LICENSE.md) -- [Validators](docs/VALIDATORS.md) - [Changelog](CHANGELOG.md) diff --git a/vendor/respect/validation/composer.json b/vendor/respect/validation/composer.json index 85e2b2dd4a3be109ae539c2e6e80fc0df0dffe84..398dafe4d94711662e32d6c1779c0972c9733cc8 100644 --- a/vendor/respect/validation/composer.json +++ b/vendor/respect/validation/composer.json @@ -4,7 +4,7 @@ "keywords": ["respect", "validation", "validator"], "type": "library", "homepage": "http://respect.github.io/Validation/", - "license": "BSD Style", + "license": "BSD-3-Clause", "authors": [ { "name": "Respect/Validation Contributors", @@ -16,7 +16,7 @@ "symfony/polyfill-mbstring": "^1.2" }, "require-dev": { - "egulias/email-validator": "~1.2", + "egulias/email-validator": "~1.2 || ~2.1", "mikey179/vfsStream": "^1.5", "phpunit/phpunit": "~4.0", "symfony/validator": "~2.6.9", diff --git a/vendor/respect/validation/docs/Age.md b/vendor/respect/validation/docs/Age.md deleted file mode 100644 index 740d7279b676e08c6062a1fdae87bc675fc6bbbc..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Age.md +++ /dev/null @@ -1,46 +0,0 @@ -# Age - -- `v::age(int $minAge)` -- `v::age(int $minAge, int $maxAge)` -- `v::age(null, int $maxAge)` - -Validates ranges of years. - -The validated values can be any date value; internally they will be transformed -into [DateTime](http://php.net/manual/en/class.datetime.php) objects according -to the defined locale settings. - -The examples below validate if the given dates are lower or equal to 18 years ago: -```php -v::age(18)->validate('17 years ago'); // false -v::age(18)->validate('18 years ago'); // true -v::age(18)->validate('19 years ago'); // true -v::age(18)->validate('1970-01-01'); // true -v::age(18)->validate('today'); // false -``` - -The examples below validate if the given dates are between 10 and 50 years ago: -```php -v::age(10, 50)->validate('9 years ago'); // false -v::age(10, 50)->validate('10 years ago'); // true -v::age(10, 50)->validate('30 years ago'); // true -v::age(10, 50)->validate('50 years ago'); // true -v::age(10, 50)->validate('51 years ago'); // false -``` - -The examples below validate if the given dates are greater than or equal to 70 years ago: -```php -v::age(null, 70)->validate('today'); // true -v::age(null, 70)->validate('70 years ago'); // true -v::age(null, 70)->validate('71 years ago'); // false -``` - -Message template for this validator includes `{{minAge}}` and `{{maxAge}}`. - -*** -See also: - - * [Between](Between.md) - * [Date](Date.md) - * [Max](Max.md) - * [Min](Min.md) diff --git a/vendor/respect/validation/docs/AllOf.md b/vendor/respect/validation/docs/AllOf.md deleted file mode 100644 index 7bd2ecf0203be63de28fd5a27c59f0eb7dbe8ddc..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/AllOf.md +++ /dev/null @@ -1,30 +0,0 @@ -# AllOf - -- `v::allOf(v $v1, v $v2, v $v3...)` - -Will validate if all inner validators validates. - -```php -v::allOf( - v::intVal(), - v::positive() -)->validate(15); // true -``` - -This is similar to the chain (which is an allOf already), but -its syntax allows you to set custom names for every node: - -```php -v::allOf( - v::intVal()->setName('Account Number'), - v::positive()->setName('Higher Than Zero') -)->setName('Positive integer') - ->validate(15); // true -``` - -*** -See also: - - * [OneOf](OneOf.md) - * [NoneOf](NoneOf.md) - * [When](When.md) diff --git a/vendor/respect/validation/docs/Alnum.md b/vendor/respect/validation/docs/Alnum.md deleted file mode 100644 index 184c1e2cfb64c88fc4ee5340077c6a22e8a3710c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Alnum.md +++ /dev/null @@ -1,44 +0,0 @@ -# Alnum - -- `v::alnum()` -- `v::alnum(string $additionalChars)` - -Validates alphanumeric characters from a-Z and 0-9. - -```php -v::alnum()->validate('foo 123'); // true -v::alnum()->validate('number 100%'); // false -v::alnum('%')->validate('number 100%'); // true -``` - -Because this rule allows whitespaces by default, you can separate additional -characters with a whitespace: - -```php -v::alnum('- ! :')->validate('foo :- 123 !'); // true -``` - -This validator allows whitespace, if you want to -remove them add `->noWhitespace()` to the chain: - -```php -v::alnum()->noWhitespace()->validate('foo 123'); // false -``` - -You can restrict case using the `->lowercase()` and -`->uppercase()` validators: - -```php -v::alnum()->uppercase()->validate('aaa'); // false -``` - -Message template for this validator includes `{{additionalChars}}` as -the string of extra chars passed as the parameter. - -*** -See also: - - * [Alpha](Alpha.md) - * [Digit](Digit.md) - * [Consonant](Consonant.md) - * [Vowel](Vowel.md) diff --git a/vendor/respect/validation/docs/Alpha.md b/vendor/respect/validation/docs/Alpha.md deleted file mode 100644 index 44f4dc3714c3ebfd64c46a9da17bfa8a91c091f4..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Alpha.md +++ /dev/null @@ -1,14 +0,0 @@ -# Alpha - -- `v::alpha()` -- `v::alpha(string $additionalChars)` - -This is similar to `v::alnum()`, but it doesn't allow numbers. - -*** -See also: - - * [Alnum](Alnum.md) - * [Digit](Digit.md) - * [Consonant](Consonant.md) - * [Vowel](Vowel.md) diff --git a/vendor/respect/validation/docs/AlwaysInvalid.md b/vendor/respect/validation/docs/AlwaysInvalid.md deleted file mode 100644 index 34b364deb352ea110706b05ade042e04f0ee079f..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/AlwaysInvalid.md +++ /dev/null @@ -1,14 +0,0 @@ -# AlwaysInvalid - -- `v::alwaysInvalid()` - -Always return false. - -```php -v::alwaysInvalid()->validate($whatever); // false -``` - -*** -See also: - - * [AlwaysValid](AlwaysValid.md) diff --git a/vendor/respect/validation/docs/AlwaysValid.md b/vendor/respect/validation/docs/AlwaysValid.md deleted file mode 100644 index 6a020bb420dfde6d6fe61722c7a15bbccd39a0bd..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/AlwaysValid.md +++ /dev/null @@ -1,14 +0,0 @@ -# AlwaysValid - -- `v::alwaysValid()` - -Always returns true. - -```php -v::alwaysValid()->validate($whatever); // true -``` - -*** -See also: - - * [AlwaysInvalid](AlwaysInvalid.md) diff --git a/vendor/respect/validation/docs/ArrayType.md b/vendor/respect/validation/docs/ArrayType.md deleted file mode 100644 index ed72eb393ccccd6ccfdb443b8c9c94891a5d7fa9..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/ArrayType.md +++ /dev/null @@ -1,27 +0,0 @@ -# ArrayType - -- `v::arrayType()` - -Validates whether the type of an input is array. - -```php -v::arrayType()->validate([]); // true -v::arrayType()->validate([1, 2, 3]); // true -v::arrayType()->validate(new ArrayObject()); // false -``` - -*** -See also: - - * [ArrayVal](ArrayVal.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [Countable](Countable.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [IterableType](IterableType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/ArrayVal.md b/vendor/respect/validation/docs/ArrayVal.md deleted file mode 100644 index ec9eaf066a3b42a0ea67dd7351b818bf828f0cd6..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/ArrayVal.md +++ /dev/null @@ -1,22 +0,0 @@ -# ArrayVal - -- `v::arrayVal()` - -Validates if the input is an array or if the input can be used as an array -(instance of `ArrayAccess`). - -```php -v::arrayVal()->validate([]); // true -v::arrayVal()->validate(new ArrayObject); // true -``` - -*** -See also: - - * [ArrayType](ArrayType.md) - * [Countable](Countable.md) - * [Each](Each.md) - * [IterableType](IterableType.md) - * [Key](Key.md) - * [KeySet](KeySet.md) - * [KeyValue](KeyValue.md) diff --git a/vendor/respect/validation/docs/Attribute.md b/vendor/respect/validation/docs/Attribute.md deleted file mode 100644 index e48b6b664bb2c58027149a4870bacf6468659b4a..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Attribute.md +++ /dev/null @@ -1,33 +0,0 @@ -# Attribute - -- `v::attribute(string $name)` -- `v::attribute(string $name, v $validator)` -- `v::attribute(string $name, v $validator, boolean $mandatory = true)` - -Validates an object attribute. - -```php -$obj = new stdClass; -$obj->foo = 'bar'; - -v::attribute('foo')->validate($obj); // true -``` - -You can also validate the attribute itself: - -```php -v::attribute('foo', v::equals('bar'))->validate($obj); // true -``` - -Third parameter makes the attribute presence optional: - -```php -v::attribute('lorem', v::stringType(), false)->validate($obj); // true -``` - -The name of this validator is automatically set to the attribute name. - -*** -See also: - - * [Key](Key.md) diff --git a/vendor/respect/validation/docs/Bank.md b/vendor/respect/validation/docs/Bank.md deleted file mode 100644 index 028d71985d50b871bffeb9a9889c0cd8d81b27f2..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Bank.md +++ /dev/null @@ -1,20 +0,0 @@ -# Bank - -- `v::bank(string $countryCode)` - -Validates a bank. - -```php -v::bank("de")->validate("70169464"); // true -v::bank("de")->validate("12345"); // false -``` - -These country codes are supported: - - * "de" (Germany) - You must add `"malkusch/bav": "~1.0"` to your `require` property on composer.json file. - -*** -See also: - - * [BankAccount](BankAccount.md) - * [Bic](Bic.md) diff --git a/vendor/respect/validation/docs/BankAccount.md b/vendor/respect/validation/docs/BankAccount.md deleted file mode 100644 index f9d319d7f82c2ba7d6d681ab7f33ed43df3abfa4..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/BankAccount.md +++ /dev/null @@ -1,20 +0,0 @@ -# BankAccount - -- `v::bankAccount(string $countryCode, string $bank)` - -Validates a bank account for a given bank. - -```php -v::bankAccount("de", "70169464")->validate("1112"); // true -v::bankAccount("de", "70169464")->validate("1234"); // false -``` - -These country codes are supported: - - * "de" (Germany) - You must add `"malkusch/bav": "~1.0"` to your `require` property on composer.json file. - -*** -See also: - - * [Bank](Bank.md) - * [Bic](Bic.md) diff --git a/vendor/respect/validation/docs/Between.md b/vendor/respect/validation/docs/Between.md deleted file mode 100644 index 5c0204afc9aed1fb1834d82d0050cb274b060152..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Between.md +++ /dev/null @@ -1,44 +0,0 @@ -# Between - -- `v::between(mixed $start, mixed $end)` -- `v::between(mixed $start, mixed $end, boolean $inclusive = true)` - -Validates ranges. Most simple example: - -```php -v::intVal()->between(10, 20)->validate(15); // true -``` - -The type as the first validator in a chain is a good practice, -since between accepts many types: - -```php -v::stringType()->between('a', 'f')->validate('c'); // true -``` - -Also very powerful with dates: - -```php -v::date()->between('2009-01-01', '2013-01-01')->validate('2010-01-01'); // true -``` - -Date ranges accept strtotime values: - -```php -v::date()->between('yesterday', 'tomorrow')->validate('now'); // true -``` - -A third parameter may be passed to validate the passed values inclusive: - -```php -v::date()->between(10, 20, true)->validate(20); // true -``` - -Message template for this validator includes `{{minValue}}` and `{{maxValue}}`. - -*** -See also: - - * [Length](Length.md) - * [Min](Min.md) - * [Max](Max.md) diff --git a/vendor/respect/validation/docs/Bic.md b/vendor/respect/validation/docs/Bic.md deleted file mode 100644 index 82c67e8810a5caaadcd36cf798b35969935b1567..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Bic.md +++ /dev/null @@ -1,20 +0,0 @@ -# Bic - -- `v::bic(string $countryCode)` - -Validates a BIC (Bank Identifier Code) for a given country. - -```php -v::bic("de")->validate("VZVDDED1XXX"); // true -v::bic("de")->validate("VZVDDED1"); // true -``` - -Theses country codes are supported: - - * "de" (Germany) - You must add `"malkusch/bav": "~1.0"` to your `require` property on composer.json file. - -*** -See also: - - * [Bank](Bank.md) - * [BankAccount](BankAccount.md) diff --git a/vendor/respect/validation/docs/BoolType.md b/vendor/respect/validation/docs/BoolType.md deleted file mode 100644 index 979562189815b5d858b03e316120796971063de5..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/BoolType.md +++ /dev/null @@ -1,27 +0,0 @@ -# BoolType - -- `v::boolType()` - -Validates if the input is a boolean value: - -```php -v::boolType()->validate(true); // true -v::boolType()->validate(false); // true -``` - -*** -See also: - - * [ArrayType](ArrayType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [FloatVal](FloatVal.md) - * [IntType](IntType.md) - * [No](No.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [TrueVal](TrueVal.md) - * [Type](Type.md) - * [Yes](Yes.md) diff --git a/vendor/respect/validation/docs/BoolVal.md b/vendor/respect/validation/docs/BoolVal.md deleted file mode 100644 index 26bf9a6d0d137efdb9707647190daf17041886ba..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/BoolVal.md +++ /dev/null @@ -1,31 +0,0 @@ -# BoolVal - -- `v::boolVal()` - -Validates if the input results in a boolean value: - -```php -v::boolVal()->validate('on'); // true -v::boolVal()->validate('off'); // true -v::boolVal()->validate('yes'); // true -v::boolVal()->validate('no'); // true -v::boolVal()->validate(1); // true -v::boolVal()->validate(0); // true -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [FloatVal](FloatVal.md) - * [IntType](IntType.md) - * [No](No.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [TrueVal](TrueVal.md) - * [Type](Type.md) - * [Yes](Yes.md) diff --git a/vendor/respect/validation/docs/Bsn.md b/vendor/respect/validation/docs/Bsn.md deleted file mode 100644 index e67f55e70d22aeddfe110578ff0cd57ff05fb2e3..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Bsn.md +++ /dev/null @@ -1,16 +0,0 @@ -# Bsn - -- `v::bsn()` - -Validates a Dutch citizen service number ([BSN](https://nl.wikipedia.org/wiki/Burgerservicenummer)). - -```php -v::bsn()->validate('612890053'); // true -``` - -*** -See also: - - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) diff --git a/vendor/respect/validation/docs/CONCRETE_API.md b/vendor/respect/validation/docs/CONCRETE_API.md deleted file mode 100644 index 735b6283d558ed32516a61b8ef6e5c87a2ee75da..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/CONCRETE_API.md +++ /dev/null @@ -1,77 +0,0 @@ -# Concrete API - -There are many micro-frameworks that rely on magic methods. We don't. In this -document we're gonna explore the Respect\Validation API without fluent interfaces -or magic methods. We'll use a traditional dependency injection approach. - -```php -use Respect\Validation\Validator as v; - -$usernameValidator = v::alnum()->noWhitespace()->length(1,15); -$usernameValidator->validate('alganet'); // true -``` - -If you `var_dump($usernameValidator)`, you'll see a composite of objects with -`Respect\Validation\Rules\Alnum`, `Respect\Validation\Rules\NoWhitespace` and -`Respect\Validation\Rules\Length`. There is a specific object for each rule, and -the chain only builds the structure. You can build it by yourself: - -```php -use Respect\Validation\Rules; - -$usernameValidator = new Rules\AllOf( - new Rules\Alnum(), - new Rules\NoWhitespace(), - new Rules\Length(1, 15) -); -$usernameValidator->validate('alganet'); // true -``` - -This is still a very lean API. You can use it in any dependency injection -container or test it in the way you want. Nesting is still possible: - -```php -use Respect\Validation\Rules; - -$usernameValidator = new Rules\AllOf( - new Rules\Alnum(), - new Rules\NoWhitespace(), - new Rules\Length(1, 15) -); -$userValidator = new Rules\Key('name', $usernameValidator); -$userValidator->validate(['name' => 'alganet']); // true -``` - -## How It Works? - -The Respect\Validation chain is an -[internal DSL](http://martinfowler.com/bliki/InternalDslStyle.html). -It acts in the creational realm of objects (where Abstract Factories and Builders -live), and it's only job is to make rule construction terse and fluent. - -## FAQ - -> Is `v` in `v::something` a class name? - -No! The class is `Respect\Validation\Validator`, we suggest `v` as a very short alias. - -> Is `v::something()` a static call? - -Yes. Just like the default `DateTime::createFromFormat()` or -`Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration()`. It builds -something complex and returns for you. - -> I really don't like static calls, can I avoid it? - -Yes. Just use `$validator = new Validator();` each time you want a new validator, -and continue from there. - -> Do you have a static method for each rule? - -No. We use `__callStatic()`. - -> Magic methods are slow! Why do you use them? - -They're optional. If you use the `new` interface, they won't be called. - -(still, do some benchmarks, you'd be surprised with our implementation). diff --git a/vendor/respect/validation/docs/Call.md b/vendor/respect/validation/docs/Call.md deleted file mode 100644 index f56b0a8e5e73b80188026d98206c916ae0fe8969..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Call.md +++ /dev/null @@ -1,51 +0,0 @@ -# Call - -- `v::call(callable $callback)` - -This is a very low level validator. It calls a function, method or closure -for the input and then validates it. Consider the following variable: - -```php -$url = 'http://www.google.com/search?q=respect.github.com' -``` - -To validate every part of this URL we could use the native `parse_url` -function to break its parts: - -```php -$parts = parse_url($url); -``` - -This function returns an array containing `scheme`, `host`, `path` and `query`. -We can validate them this way: - -```php -v::arrayVal()->key('scheme', v::startsWith('http')) - ->key('host', v::domain()) - ->key('path', v::stringType()) - ->key('query', v::notEmpty()); -``` - -Using `v::call()` you can do this in a single chain: - -```php -v::call( - 'parse_url', - v::arrayVal()->key('scheme', v::startsWith('http')) - ->key('host', v::domain()) - ->key('path', v::stringType()) - ->key('query', v::notEmpty()) -)->validate($url); -``` - -It is possible to call methods and closures as the first parameter: - -```php -v::call([$myObj, 'methodName'], v::intVal())->validate($myInput); -v::call(function($input) {}, v::intVal())->validate($myInput); -``` - -*** -See also: - - * [Callback](Callback.md) diff --git a/vendor/respect/validation/docs/CallableType.md b/vendor/respect/validation/docs/CallableType.md deleted file mode 100644 index 7f24dca7b0dfcbb4ae4591061d75f75793d35709..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/CallableType.md +++ /dev/null @@ -1,25 +0,0 @@ -# CallableType - -- `v::callableType()` - -Validates if the input is a callable value. - -```php -v::callableType()->validate(function () {}); // true -v::callableType()->validate('trim'); // true -v::callableType()->validate([new ObjectType, 'methodName']); // true -``` - -*** -See also: - - * [ArrayType](ArrayType.md) - * [BoolType](BoolType.md) - * [Callback](Callback.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/Callback.md b/vendor/respect/validation/docs/Callback.md deleted file mode 100644 index d5ec6b86c62bea13d0b8b1e999129775b67e20e2..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Callback.md +++ /dev/null @@ -1,21 +0,0 @@ -# Callback - -- `v::callback(callable $callback)` - -This is a wildcard validator, it uses a function name, method or closure -to validate something: - -```php -v::callback('is_int')->validate(10); // true -``` - -(Please note that this is a sample, the `v::intVal()` validator is much better). - -As in `v::call()`, you can pass a method or closure to it. - -*** -See also: - - * [Call](Call.md) - * [CallableType](CallableType.md) - * [FilterVar](FilterVar.md) diff --git a/vendor/respect/validation/docs/Charset.md b/vendor/respect/validation/docs/Charset.md deleted file mode 100644 index 43d889bdc687c4221eb82510f6fada2b39db8048..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Charset.md +++ /dev/null @@ -1,19 +0,0 @@ -# Charset - -- `v::charset(mixed $charset)` - -Validates if a string is in a specific charset. - -```php -v::charset('ASCII')->validate('açúcar'); // false -v::charset('ASCII')->validate('sugar'); //true -v::charset(['ISO-8859-1', 'EUC-JP'])->validate('日本国'); // true -``` - -The array format is a logic OR, not AND. - -*** -See also: - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) diff --git a/vendor/respect/validation/docs/Cnh.md b/vendor/respect/validation/docs/Cnh.md deleted file mode 100644 index 6815929a3910d537c8e5131828dd68fd176d9d29..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Cnh.md +++ /dev/null @@ -1,15 +0,0 @@ -# Cnh - -- `v::cnh()` - -Validates a Brazillian driver's license. - -```php -v::cnh()->validate('02650306461'); // true -``` - -*** -See also: - - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) diff --git a/vendor/respect/validation/docs/Cnpj.md b/vendor/respect/validation/docs/Cnpj.md deleted file mode 100644 index 846d391762c2523cc527c61829c227ea3909f502..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Cnpj.md +++ /dev/null @@ -1,12 +0,0 @@ -# Cnpj - -- `v::cnpj()` - -Validates the Brazillian CNPJ number. Ignores non-digit chars, so -use `->digit()` if needed. - -*** -See also: - - * [Cpf](Cpf.md) - * [Cnh](Cnh.md) diff --git a/vendor/respect/validation/docs/Cntrl.md b/vendor/respect/validation/docs/Cntrl.md deleted file mode 100644 index 7a6552aa8e0529dcbc08cd4017f9bd65434a1dc2..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Cntrl.md +++ /dev/null @@ -1,17 +0,0 @@ -# Cntrl - -- `v::cntrl()` -- `v::cntrl(string $additionalChars)` - -This is similar to `v::alnum()`, but only accepts control characters: - -```php -v::cntrl()->validate("\n\r\t"); // true -``` - -*** -See also: - - * [Alnum](Alnum.md) - * [Prnt](Prnt.md) - * [Space](Space.md) diff --git a/vendor/respect/validation/docs/Consonant.md b/vendor/respect/validation/docs/Consonant.md deleted file mode 100644 index fac1fe53319d7ba5afe0f39aef44f4116a1b6c71..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Consonant.md +++ /dev/null @@ -1,18 +0,0 @@ -# Consonant - -- `v::consonant()` -- `v::consonant(string $additionalChars)` - -Similar to `v::alnum()`. Validates strings that contain only consonants: - -```php -v::consonant()->validate('xkcd'); // true -``` - -*** -See also: - - * [Alnum](Alnum.md) - * [Digit](Digit.md) - * [Alpha](Alpha.md) - * [Vowel](Vowel.md) diff --git a/vendor/respect/validation/docs/Contains.md b/vendor/respect/validation/docs/Contains.md deleted file mode 100644 index 6036494fe43cbbb06015a2e7edcc9fd4871d6d00..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Contains.md +++ /dev/null @@ -1,28 +0,0 @@ -# Contains - -- `v::contains(mixed $value)` -- `v::contains(mixed $value, boolean $identical = false)` - -For strings: - -```php -v::contains('ipsum')->validate('lorem ipsum'); // true -``` - -For arrays: - -```php -v::contains('ipsum')->validate(['ipsum', 'lorem']); // true -``` - -A second parameter may be passed for identical comparison instead -of equal comparison. - -Message template for this validator includes `{{containsValue}}`. - -*** -See also: - - * [StartsWith](StartsWith.md) - * [EndsWith](EndsWith.md) - * [In](In.md) diff --git a/vendor/respect/validation/docs/Countable.md b/vendor/respect/validation/docs/Countable.md deleted file mode 100644 index 0353de4d7a748ed9f490149b8f07d1343f084036..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Countable.md +++ /dev/null @@ -1,19 +0,0 @@ -# Countable - -- `v::countable()` - -Validates if the input is countable, in other words, if you're allowed to use -[count()](http://php.net/count) function on it. - -```php -v::countable()->validate([]); // true -v::countable()->validate(new ArrayObject()); // true -v::countable()->validate('string'); // false -``` - -*** -See also: - - * [ArrayVal](ArrayVal.md) - * [Instance](Instance.md) - * [IterableType](IterableType.md) diff --git a/vendor/respect/validation/docs/CountryCode.md b/vendor/respect/validation/docs/CountryCode.md deleted file mode 100644 index 469313db2dcb66a7306d53510b54c136afa758a8..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/CountryCode.md +++ /dev/null @@ -1,14 +0,0 @@ -# CountryCode - -- `v::countryCode()` - -Validates an ISO country code like US or BR. - -```php -v::countryCode()->validate('BR'); // true -``` - -*** -See also: - - * [Tld](Tld.md) diff --git a/vendor/respect/validation/docs/Cpf.md b/vendor/respect/validation/docs/Cpf.md deleted file mode 100644 index 0fc3a717af13febc2d111218e534d9f61271e037..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Cpf.md +++ /dev/null @@ -1,28 +0,0 @@ -# Cpf - -- `v::cpf()` - -Validates a Brazillian CPF number. - -```php -v::cpf()->validate('44455566820'); // true -``` - -It ignores any non-digit char: - -```php -v::cpf()->validate('444.555.668-20'); // true -``` - -If you need to validate digits only, add `->digit()` to -the chain: - -```php -v::digit()->cpf()->validate('44455566820'); // true -``` - -*** -See also: - - * [Cnpj](Cnpj.md) - * [Cnh](Cnh.md) diff --git a/vendor/respect/validation/docs/CreditCard.md b/vendor/respect/validation/docs/CreditCard.md deleted file mode 100644 index aa9783a23304444b5871f7965eec499ec9de7408..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/CreditCard.md +++ /dev/null @@ -1,39 +0,0 @@ -# CreditCard - -- `v::creditCard()` -- `v::creditCard(string $brand)` - -Validates a credit card number. - -```php -v::creditCard()->validate('5376 7473 9720 8720'); // true - -v::creditCard('American Express')->validate('340316193809364'); // true -v::creditCard('Diners Club')->validate('30351042633884'); // true -v::creditCard('Discover')->validate('6011000990139424'); // true -v::creditCard('JCB')->validate('3566002020360505'); // true -v::creditCard('Master')->validate('5376747397208720'); // true -v::creditCard('Visa')->validate('4024007153361885'); // true -``` - -The current supported brands are: - -- American Express -- Diners Club -- Discover -- JCB -- MasterCard -- Visa - -It ignores any non-digit chars, so use `->digit()` when appropriate. - -```php -v::digit()->creditCard()->validate('5376747397208720'); // true -``` - -*** -See also: - - * [Bank](Bank.md) - * [BankAccount](BankAccount.md) - * [Bic](Bic.md) diff --git a/vendor/respect/validation/docs/CurrencyCode.md b/vendor/respect/validation/docs/CurrencyCode.md deleted file mode 100644 index 95c13fae47325b977071590ec7304b7afdd5b3b6..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/CurrencyCode.md +++ /dev/null @@ -1,15 +0,0 @@ -# CurrencyCode - -- `v::currencyCode()` - -Validates an [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code like GBP or EUR. - -```php -v::currencyCode()->validate('GBP'); // true -``` - -*** -See also: - - * [CountryCode](CountryCode.md) - * [SubdivisionCode](SubdivisionCode.md) diff --git a/vendor/respect/validation/docs/Date.md b/vendor/respect/validation/docs/Date.md deleted file mode 100644 index 4afb9ecbd56a4b49614375508f38bc18cb1b5170..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Date.md +++ /dev/null @@ -1,40 +0,0 @@ -# Date - -- `v::date()` -- `v::date(string $format)` - -Validates if input is a date: - -```php -v::date()->validate('2009-01-01'); // true -``` - -Also accepts strtotime values: - -```php -v::date()->validate('now'); // true -``` - -And DateTime instances: - -```php -v::date()->validate(new DateTime); // true -``` - -You can pass a format when validating strings: - -```php -v::date('Y-m-d')->validate('01-01-2009'); // false -``` - -Format has no effect when validating DateTime instances. - -Message template for this validator includes `{{format}}`. - -*** -See also: - - * [Between](Between.md) - * [MinimumAge](MinimumAge.md) - * [LeapDate](LeapDate.md) - * [LeapYear](LeapYear.md) diff --git a/vendor/respect/validation/docs/Digit.md b/vendor/respect/validation/docs/Digit.md deleted file mode 100644 index c4638483f4d6734817263c9891263a1ea2d41deb..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Digit.md +++ /dev/null @@ -1,13 +0,0 @@ -# Digit - -- `v::digit()` - -This is similar to `v::alnum()`, but it doesn't allow a-Z. - -*** -See also: - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [Vowel](Vowel.md) - * [Consonant](Consonant.md) diff --git a/vendor/respect/validation/docs/Directory.md b/vendor/respect/validation/docs/Directory.md deleted file mode 100644 index 7d49c63b726e0bec8c8d615092d3ed7ce275755c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Directory.md +++ /dev/null @@ -1,30 +0,0 @@ -# Directory - -- `v::directory()` - -Validates directories. - -```php -v::directory()->validate(__DIR__); // true -v::directory()->validate(__FILE__); // false -``` - -This validator will consider SplFileInfo instances, so you can do something like: - -```php -v::directory()->validate(new \SplFileInfo($directory)); -``` - -*** -See also: - - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Domain.md b/vendor/respect/validation/docs/Domain.md deleted file mode 100644 index ac5d76a7b77d89952de912a75c614fa3479f99aa..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Domain.md +++ /dev/null @@ -1,40 +0,0 @@ -# Domain - -- `v::domain()` -- `v::domain(boolean $tldCheck = true)` - -Validates domain names. - -```php -v::domain()->validate('google.com'); -``` - -You can skip *top level domain* (TLD) checks to validate internal -domain names: - -```php -v::domain(false)->validate('dev.machine.local'); -``` - -This is a composite validator, it validates several rules -internally: - - * If input is an IP address, it fails. - * If input contains whitespace, it fails. - * If input does not contain any dots, it fails. - * If input has less than two parts, it fails. - * Input must end with a top-level-domain to pass (if not skipped). - * Each part must be alphanumeric and not start with an hyphen. - * [PunnyCode][] is accepted for [Internationalizing Domain Names in Applications][IDNA]. - -Messages for this validator will reflect rules above. - -*** -See also: - - * [Ip](Ip.md) - * [MacAddress](MacAddress.md) - * [Tld](Tld.md) - -[PunnyCode]: http://en.wikipedia.org/wiki/Punycode "Wikipedia: Punnycode" -[IDNA]: http://en.wikipedia.org/wiki/Internationalized_domain_name#Internationalizing_Domain_Names_in_Applications "Wikipedia: Internationalized domain name" diff --git a/vendor/respect/validation/docs/Each.md b/vendor/respect/validation/docs/Each.md deleted file mode 100644 index ecc1c666359e921a9a33cdebe1a2c3ee5a6c4a92..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Each.md +++ /dev/null @@ -1,27 +0,0 @@ -# Each - -- `v::each(v $validatorForValue)` -- `v::each(null, v $validatorForKey)` -- `v::each(v $validatorForValue, v $validatorForKey)` - -Iterates over an array or Iterator and validates the value or key -of each entry: - -```php -$releaseDates = [ - 'validation' => '2010-01-01', - 'template' => '2011-01-01', - 'relational' => '2011-02-05', -]; - -v::arrayVal()->each(v::date())->validate($releaseDates); // true -v::arrayVal()->each(v::date(), v::stringType()->lowercase())->validate($releaseDates); // true -``` - -Using `arrayVal()` before `each()` is a best practice. - -*** -See also: - - * [Key](Key.md) - * [ArrayVal](ArrayVal.md) diff --git a/vendor/respect/validation/docs/Email.md b/vendor/respect/validation/docs/Email.md deleted file mode 100644 index 64a4d7cf3c4896dd1786e20c99b74bd89adbf184..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Email.md +++ /dev/null @@ -1,16 +0,0 @@ -# Email - -- `v::email()` - -Validates an email address. - -```php -v::email()->validate('alexandre@gaigalas.net'); // true -``` - -*** -See also: - - * [Phone](Phone.md) - * [Url](Url.md) - * [VideoUrl](VideoUrl.md) diff --git a/vendor/respect/validation/docs/EndsWith.md b/vendor/respect/validation/docs/EndsWith.md deleted file mode 100644 index 99ec5b215a194760e80132ea1083bd791b903b0e..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/EndsWith.md +++ /dev/null @@ -1,31 +0,0 @@ -# EndsWith - -- `v::endsWith(mixed $value)` -- `v::endsWith(mixed $value, boolean $identical = false)` - -This validator is similar to `v::contains()`, but validates -only if the value is at the end of the input. - -For strings: - -```php -v::endsWith('ipsum')->validate('lorem ipsum'); // true -``` - -For arrays: - -```php -v::endsWith('ipsum')->validate(['lorem', 'ipsum']); // true -``` - -A second parameter may be passed for identical comparison instead -of equal comparison. - -Message template for this validator includes `{{endValue}}`. - -*** -See also: - - * [StartsWith](StartsWith.md) - * [Contains](Contains.md) - * [In](In.md) diff --git a/vendor/respect/validation/docs/Equals.md b/vendor/respect/validation/docs/Equals.md deleted file mode 100644 index e28f783dfcfd4128c7eecba94307e4ae53aeff1c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Equals.md +++ /dev/null @@ -1,17 +0,0 @@ -# Equals - -- `v::equals(mixed $value)` - -Validates if the input is equal to some value. - -```php -v::equals('alganet')->validate('alganet'); // true -``` - -Message template for this validator includes `{{compareTo}}`. - -*** -See also: - - * [Contains](Contains.md) - * [Identical](Identical.md) diff --git a/vendor/respect/validation/docs/Even.md b/vendor/respect/validation/docs/Even.md deleted file mode 100644 index da52597b85c0793e85862dd42611df0f4da6a7cd..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Even.md +++ /dev/null @@ -1,17 +0,0 @@ -# Even - -- `v::even()` - -Validates an even number. - -```php -v::intVal()->even()->validate(2); // true -``` - -Using `int()` before `even()` is a best practice. - -*** -See also: - - * [Odd](Odd.md) - * [Multiple](Multiple.md) diff --git a/vendor/respect/validation/docs/Executable.md b/vendor/respect/validation/docs/Executable.md deleted file mode 100644 index 7c1e1303dc350d4034dc1f8c6454e835943187e2..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Executable.md +++ /dev/null @@ -1,23 +0,0 @@ -# Executable - -- `v::executable()` - -Validates if a file is an executable. - -```php -v::email()->executable('script.sh'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Exists.md b/vendor/respect/validation/docs/Exists.md deleted file mode 100644 index 681c50743b70cd7b36548571ca47ae2d51cc4075..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Exists.md +++ /dev/null @@ -1,30 +0,0 @@ -# Exists - -- `v::exists()` - -Validates files or directories. - -```php -v::exists()->validate(__FILE__); // true -v::exists()->validate(__DIR__); // true -``` - -This validator will consider SplFileInfo instances, so you can do something like: - -```php -v::exists()->validate(new \SplFileInfo($file)); -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Extension.md b/vendor/respect/validation/docs/Extension.md deleted file mode 100644 index 4abc0d5ba51f701827dd166daac098ec79c65e3f..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Extension.md +++ /dev/null @@ -1,25 +0,0 @@ -# Extension - -- `v::extension(string $extension)` - -Validates if the file extension matches the expected one: - -```php -v::extension('png')->validate('image.png'); // true -``` - -This rule is case-sensitive. - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Factor.md b/vendor/respect/validation/docs/Factor.md deleted file mode 100644 index 1e04276432d1bc8583fa89da6c004d43abdb2568..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Factor.md +++ /dev/null @@ -1,19 +0,0 @@ -# Factor - -- `v::factor(int $dividend)` - -Validates if the input is a factor of the defined dividend. - -```php -v::factor(0)->validate(5); // true -v::factor(4)->validate(2); // true -v::factor(4)->validate(3); // false -``` - -*** -See also: - - * [Digit](Digit.md) - * [Finite](Finite.md) - * [Infinite](Infinite.md) - * [Numeric](Numeric.md) diff --git a/vendor/respect/validation/docs/FalseVal.md b/vendor/respect/validation/docs/FalseVal.md deleted file mode 100644 index 6ca060d33ca40dd587efb0e4583b7606b1000f03..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/FalseVal.md +++ /dev/null @@ -1,21 +0,0 @@ -# FalseVal - -- `v::falseVal()` - -Validates if a value is considered as `false`. - -```php -v::falseVal()->validate(false); // true -v::falseVal()->validate(0); // true -v::falseVal()->validate('0'); // true -v::falseVal()->validate('false'); // true -v::falseVal()->validate('off'); // true -v::falseVal()->validate('no'); // true -v::falseVal()->validate('0.5'); // false -v::falseVal()->validate('2'); // false -``` - -*** -See also: - - * [TrueVal](TrueVal.md) diff --git a/vendor/respect/validation/docs/Fibonacci.md b/vendor/respect/validation/docs/Fibonacci.md deleted file mode 100644 index fe8c5235b775e98fda3c81e43f1736e7e18dc30f..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Fibonacci.md +++ /dev/null @@ -1,17 +0,0 @@ -# Fibonacci - - - `v::fibonacci()` - -Validates whether the input follows the Fibonacci integer sequence. - -```php -v::fibonacci()->validate(1); // true -v::fibonacci()->validate('34'); // true -v::fibonacci()->validate(6); // false -``` - -*** -See also: - - * [PrimeNumber](PrimeNumber.md) - * [PerfectSquare](PerfectSquare.md) \ No newline at end of file diff --git a/vendor/respect/validation/docs/File.md b/vendor/respect/validation/docs/File.md deleted file mode 100644 index 8454d0258d2d1922fc5105c71f1e6ea3a3ab28fb..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/File.md +++ /dev/null @@ -1,30 +0,0 @@ -# File - -- `v::file()` - -Validates files. - -```php -v::file()->validate(__FILE__); // true -v::file()->validate(__DIR__); // false -``` - -This validator will consider SplFileInfo instances, so you can do something like: - -```php -v::file()->validate(new \SplFileInfo($file)); -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/FilterVar.md b/vendor/respect/validation/docs/FilterVar.md deleted file mode 100644 index a13d4fa091ffab6afb9a9df90b13d9adba374d64..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/FilterVar.md +++ /dev/null @@ -1,18 +0,0 @@ -# FilterVar - -- `v::filterVar(int $filter)` -- `v::filterVar(int $filter, mixed $options)` - -A wrapper for PHP's [filter_var()](http://php.net/filter_var) function. - -```php -v::filterVar(FILTER_VALIDATE_EMAIL)->validate('bob@example.com'); // true -v::filterVar(FILTER_VALIDATE_URL)->validate('http://example.com'); // true -v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate('http://example.com'); // false -v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate('http://example.com/path'); // true -``` - -*** -See also: - - * [Callback](Callback.md) diff --git a/vendor/respect/validation/docs/Finite.md b/vendor/respect/validation/docs/Finite.md deleted file mode 100644 index 42ef9f30d6d833305e0140c368d87694dd9b887c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Finite.md +++ /dev/null @@ -1,18 +0,0 @@ -# Finite - -- `v::finite()` - -Validates if the input is a finite number. - -```php -v::finite()->validate('10'); // true -v::finite()->validate(10); // true -``` - -*** -See also: - - * [Digit](Digit.md) - * [Infinite](Infinite.md) - * [IntVal](IntVal.md) - * [Numeric](Numeric.md) diff --git a/vendor/respect/validation/docs/FloatType.md b/vendor/respect/validation/docs/FloatType.md deleted file mode 100644 index 87efee83511a971477a7ec4ca2f84fc4ab81dbcc..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/FloatType.md +++ /dev/null @@ -1,25 +0,0 @@ -# FloatType - -- `v::floatType()` - -Validates whether the type of a value is float. - -```php -v::floatType()->validate(1.5); // true -v::floatType()->validate('1.5'); // false -v::floatType()->validate(0e5); // true -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatVal](FloatVal.md) - * [IntType](IntType.md) - * [IntVal](IntVal.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/FloatVal.md b/vendor/respect/validation/docs/FloatVal.md deleted file mode 100644 index f73c2fc073094600820a00cba34c34ec6c378bd3..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/FloatVal.md +++ /dev/null @@ -1,17 +0,0 @@ -# FloatVal - -- `v::floatVal()` - -Validates a floating point number. - -```php -v::floatVal()->validate(1.5); // true -v::floatVal()->validate('1e5'); // true -``` - -*** -See also: - - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [IntVal](IntVal.md) diff --git a/vendor/respect/validation/docs/Graph.md b/vendor/respect/validation/docs/Graph.md deleted file mode 100644 index 2c7503ad785414e4459968261f12b844a93db206..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Graph.md +++ /dev/null @@ -1,15 +0,0 @@ -# Graph - -- `v::graph()` -- `v::graph(string $additionalChars)` - -Validates all characters that are graphically represented. - -```php -v::graph()->validate('LKM@#$%4;'); // true -``` - -*** -See also: - - * [Prnt](Prnt.md) diff --git a/vendor/respect/validation/docs/HexRgbColor.md b/vendor/respect/validation/docs/HexRgbColor.md deleted file mode 100644 index 3e4a1e98d9e538d3f90f4aa2f25ab88e85bfaf8e..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/HexRgbColor.md +++ /dev/null @@ -1,16 +0,0 @@ -# HexRgbColor - -- `v::hexRgbColor()` - -Validates a hex RGB color - -```php -v::hexRgbColor()->validate('#FFFAAA'); // true -v::hexRgbColor()->validate('123123'); // true -v::hexRgbColor()->validate('FCD'); // true -``` - -*** -See also: - - * [Vxdigit](Vxdigit.md) diff --git a/vendor/respect/validation/docs/INSTALL.md b/vendor/respect/validation/docs/INSTALL.md deleted file mode 100644 index 9cf5efb04d0ebe5d4200890e6af78c7aa90f829d..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/INSTALL.md +++ /dev/null @@ -1,18 +0,0 @@ -# Installation - -Package is available on [Packagist](http://packagist.org/packages/respect/validation), -you can install it using [Composer](http://getcomposer.org). - -```shell -composer require respect/validation -``` - -[PHP](https://php.net) 5.4+ or [HHVM](http://hhvm.com) 3.3+ are required. - -*** -See also: - -- [Contributing](../CONTRIBUTING.md) -- [Feature Guide](README.md) -- [License](../LICENSE.md) -- [Validators](VALIDATORS.md) diff --git a/vendor/respect/validation/docs/Identical.md b/vendor/respect/validation/docs/Identical.md deleted file mode 100644 index 0a280678abbaa25cb0749d159cf47b5b117d7793..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Identical.md +++ /dev/null @@ -1,18 +0,0 @@ -# Identical - -- `v::identical(mixed $value)` - -Validates if the input is identical to some value. - -```php -v::identical(42)->validate(42); // true -v::identical(42)->validate('42'); // false -``` - -Message template for this validator includes `{{compareTo}}`. - -*** -See also: - - * [Contains](Contains.md) - * [Equals](Equals.md) diff --git a/vendor/respect/validation/docs/IdentityCard.md b/vendor/respect/validation/docs/IdentityCard.md deleted file mode 100644 index 052eca1a28fd616d8538eae8d56d50cc2042a729..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/IdentityCard.md +++ /dev/null @@ -1,21 +0,0 @@ -# IdentityCard - -- `v::identityCard(string $countryCode)` - -Validates Identity Card numbers according to the defined country. - -```php -v::identityCard('PL')->validate('AYW036733'); // true -v::identityCard('PL')->validate('APH505567'); // true -v::identityCard('PL')->validate('APH 505567'); // false -v::identityCard('PL')->validate('AYW036731'); // false -``` - -For now this rule only accepts Polish Identity Card numbers (Dowód Osobisty). - -*** -See also: - - * [Bank](Bank.md) - * [Pesel](Pesel.md) - * [SubdivisionCode](SubdivisionCode.md) diff --git a/vendor/respect/validation/docs/Image.md b/vendor/respect/validation/docs/Image.md deleted file mode 100644 index 5a84facf66d6e3f41314691b25d1fee0db21c383..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Image.md +++ /dev/null @@ -1,32 +0,0 @@ -# Image - -- `v::image()` -- `v::image(finfo $fileInfo)` - -Validates if the file is a valid image by checking its MIME type. - -```php -v::image()->validate('image.gif'); // true -v::image()->validate('image.jpg'); // true -v::image()->validate('image.png'); // true -``` - -All the validations above must return `false` if the input is not a valid file -or of the MIME doesn't match with the file extension. - -This rule relies on [fileinfo](http://php.net/fileinfo) PHP extension. - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Imei.md b/vendor/respect/validation/docs/Imei.md deleted file mode 100644 index 96ed8e0a2a9fd0175165d0c7dd96bdee6ae8d76b..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Imei.md +++ /dev/null @@ -1,20 +0,0 @@ -# Imei - -- `v::imei()` - -Validates is the input is a valid [IMEI][]. - -```php -v::imei()->validate('35-209900-176148-1'); // true -v::imei()->validate('490154203237518'); // true -``` - -*** -See also: - - * [Bsn](Bsn.md) - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) - -[IMEI]: https://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity "International Mobile Station Equipment Identity" diff --git a/vendor/respect/validation/docs/In.md b/vendor/respect/validation/docs/In.md deleted file mode 100644 index a8aa698141b844e55c90845c8acdefca31f05ba1..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/In.md +++ /dev/null @@ -1,30 +0,0 @@ -# In - -- `v::in(mixed $haystack)` -- `v::in(mixed $haystack, boolean $identical = false)` - -Validates if the input is contained in a specific haystack. - -For strings: - -```php -v::in('lorem ipsum')->validate('ipsum'); // true -``` - -For arrays: - -```php -v::in(['lorem', 'ipsum'])->validate('lorem'); // true -``` - -A second parameter may be passed for identical comparison instead -of equal comparison. - -Message template for this validator includes `{{haystack}}`. - -*** -See also: - - * [StartsWith](StartsWith.md) - * [EndsWith](EndsWith.md) - * [Contains](Contains.md) diff --git a/vendor/respect/validation/docs/Infinite.md b/vendor/respect/validation/docs/Infinite.md deleted file mode 100644 index d29c666a4f11afd0ae697fca58c4c837705a72b1..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Infinite.md +++ /dev/null @@ -1,17 +0,0 @@ -# Infinite - -- `v::infinite()` - -Validates if the input is an infinite number. - -```php -v::infinite()->validate(INF); // true -``` - -*** -See also: - - * [Digit](Digit.md) - * [Finite](Finite.md) - * [IntVal](IntVal.md) - * [Numeric](Numeric.md) diff --git a/vendor/respect/validation/docs/Instance.md b/vendor/respect/validation/docs/Instance.md deleted file mode 100644 index bbb45dd0c888a24183525f1d9e539c59bbd3c8cf..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Instance.md +++ /dev/null @@ -1,17 +0,0 @@ -# Instance - -- `v::instance(string $instanceName)` - -Validates if the input is an instance of the given class or interface. - -```php -v::instance('DateTime')->validate(new DateTime); // true -v::instance('Traversable')->validate(new ArrayObject); // true -``` - -Message template for this validator includes `{{instanceName}}`. - -*** -See also: - - * [ObjectType](ObjectType.md) diff --git a/vendor/respect/validation/docs/IntType.md b/vendor/respect/validation/docs/IntType.md deleted file mode 100644 index d4313657fccba3df7b4c9c9a4fd95744a6d10950..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/IntType.md +++ /dev/null @@ -1,27 +0,0 @@ -# IntType - -- `v::intType()` - -Validates whether the type of a value is integer. - -```php -v::intType()->validate(42); // true -v::intType()->validate('10'); // false -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [Digit](Digit.md) - * [Finite](Finite.md) - * [FloatType](FloatType.md) - * [Infinite](Infinite.md) - * [IntVal](IntVal.md) - * [NullType](NullType.md) - * [Numeric](Numeric.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/IntVal.md b/vendor/respect/validation/docs/IntVal.md deleted file mode 100644 index 18a04046192e8e3e6642d635d394946f16ec078f..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/IntVal.md +++ /dev/null @@ -1,18 +0,0 @@ -# IntVal - -- `v::intVal()` - -Validates if the input is an integer. - -```php -v::intVal()->validate('10'); // true -v::intVal()->validate(10); // true -``` - -*** -See also: - - * [Digit](Digit.md) - * [Finite](Finite.md) - * [Infinite](Infinite.md) - * [Numeric](Numeric.md) diff --git a/vendor/respect/validation/docs/Ip.md b/vendor/respect/validation/docs/Ip.md deleted file mode 100644 index 927dbc7ef618932495bd9e39f38e735675d27d43..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Ip.md +++ /dev/null @@ -1,24 +0,0 @@ -# Ip - -- `v::ip()` -- `v::ip(mixed $options)` - -Validates IP Addresses. This validator uses the native filter_var() -PHP function. - -```php -v::ip()->validate('192.168.0.1'); -``` - -You can pass a parameter with filter_var flags for IP. - -```php -v::ip(FILTER_FLAG_NO_PRIV_RANGE)->validate('127.0.0.1'); // false -``` - -*** -See also: - - * [Domain](Domain.md) - * [MacAddress](MacAddress.md) - * [Tld](Tld.md) diff --git a/vendor/respect/validation/docs/Iterable.md b/vendor/respect/validation/docs/Iterable.md deleted file mode 100644 index b64abe28899857ddec73717780d5e5acc4a4560c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Iterable.md +++ /dev/null @@ -1,5 +0,0 @@ -# Iterable - -- `v::iterable()` - -**Deprecated**: Use [IterableType](IterableType.md) instead. diff --git a/vendor/respect/validation/docs/IterableType.md b/vendor/respect/validation/docs/IterableType.md deleted file mode 100644 index a246af271f9cba26a1b0dd538f1eb637e6056e14..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/IterableType.md +++ /dev/null @@ -1,20 +0,0 @@ -# IterableType - -- `v::iterableType()` - -Validates if the input is iterable, in other words, if you're able to iterate -over it with [foreach](http://php.net/foreach) language construct. - -```php -v::iterableType()->validate([]); // true -v::iterableType()->validate(new ArrayObject()); // true -v::iterableType()->validate(new stdClass()); // true -v::iterableType()->validate('string'); // false -``` - -*** -See also: - - * [ArrayVal](ArrayVal.md) - * [Countable](Countable.md) - * [Instance](Instance.md) diff --git a/vendor/respect/validation/docs/Json.md b/vendor/respect/validation/docs/Json.md deleted file mode 100644 index eb41367ceaf4ffe1b8060977dada30cad6981013..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Json.md +++ /dev/null @@ -1,18 +0,0 @@ -# Json - -- `v::json()` - -Validates if the given input is a valid JSON. - -```php -v::json()->validate('{"foo":"bar"}'); // true -``` - -*** -See also: - - * [Domain](Domain.md) - * [Email](Email.md) - * [FilterVar](FilterVar.md) - * [Phone](Phone.md) - * [VideoUrl](VideoUrl.md) diff --git a/vendor/respect/validation/docs/Key.md b/vendor/respect/validation/docs/Key.md deleted file mode 100644 index 70a74c07a5a2836c4879799cddfbae89d377a23a..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Key.md +++ /dev/null @@ -1,34 +0,0 @@ -# Key - -- `v::key(string $name)` -- `v::key(string $name, v $validator)` -- `v::key(string $name, v $validator, boolean $mandatory = true)` - -Validates an array key. - -```php -$dict = [ - 'foo' => 'bar' -]; - -v::key('foo')->validate($dict); // true -``` - -You can also validate the key value itself: - -```php -v::key('foo', v::equals('bar'))->validate($dict); // true -``` - -Third parameter makes the key presence optional: - -```php -v::key('lorem', v::stringType(), false)->validate($dict); // true -``` - -The name of this validator is automatically set to the key name. - -*** -See also: - - * [Attribute](Attribute.md) diff --git a/vendor/respect/validation/docs/KeyNested.md b/vendor/respect/validation/docs/KeyNested.md deleted file mode 100644 index 3129dde31c723082fab3332c9c0fa6a3ef81bd2e..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/KeyNested.md +++ /dev/null @@ -1,40 +0,0 @@ -# KeyNested - -- `v::keyNested(string $name)` -- `v::keyNested(string $name, v $validator)` -- `v::keyNested(string $name, v $validator, boolean $mandatory = true)` - -Validates an array key or an object property using `.` to represent nested data. - -Validating keys from arrays or `ArrayAccess` instances: - -```php -$array = [ - 'foo' => [ - 'bar' => 123, - ], -]; - -v::keyNested('foo.bar')->validate($array); // true -``` - -Validating object properties: - -```php -$object = new stdClass(); -$object->foo = new stdClass(); -$object->foo->bar = 42; - -v::keyNested('foo.bar')->validate($object); // true -``` - -This rule was inspired by [Yii2 ArrayHelper][]. - -*** -See also: - - * [Attribute](Attribute.md) - * [Key](Key.md) - - -[Yii2 ArrayHelper]: https://github.com/yiisoft/yii2/blob/68c30c1/framework/helpers/BaseArrayHelper.php "Yii2 ArrayHelper" diff --git a/vendor/respect/validation/docs/KeySet.md b/vendor/respect/validation/docs/KeySet.md deleted file mode 100644 index faf40818aafbd384335127681e039e5c744ce1dc..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/KeySet.md +++ /dev/null @@ -1,51 +0,0 @@ -# KeySet - -- `v::keySet(Key $rule...)` - -Validates a keys in a defined structure. - -```php -$dict = ['foo' => 42]; - -v::keySet( - v::key('foo', v::intVal()) -)->validate($dict); // true -``` - -Extra keys are not allowed: -```php -$dict = ['foo' => 42, 'bar' => 'String']; - -v::keySet( - v::key('foo', v::intVal()) -)->validate($dict); // false -``` - -Missing required keys are not allowed: -```php -$dict = ['foo' => 42, 'bar' => 'String']; - -v::keySet( - v::key('foo', v::intVal()), - v::key('bar', v::stringType()), - v::key('baz', v::boolType()) -)->validate($dict); // false -``` - -Missing non-required keys are allowed: -```php -$dict = ['foo' => 42, 'bar' => 'String']; - -v::keySet( - v::key('foo', v::intVal()), - v::key('bar', v::stringType()), - v::key('baz', v::boolType(), false) -)->validate($dict); // true -``` - -The keys' order is not considered in the validation. - -*** -See also: - - * [Key](Key.md) diff --git a/vendor/respect/validation/docs/KeyValue.md b/vendor/respect/validation/docs/KeyValue.md deleted file mode 100644 index 98ee9db8731581b6fbda57e80f05742a5e4b4b0c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/KeyValue.md +++ /dev/null @@ -1,62 +0,0 @@ -# KeyValue - -- `keyValue(string $comparedKey, string $ruleName, string $baseKey)` - -Performs validation of `$comparedKey` using the rule named on `$ruleName` with -`$baseKey` as base. - -Sometimes, when validating arrays, the validation of a key value depends on -another key value and that may cause some ugly code since you need the input -before the validation, making some checking manually: - -```php -v::key('password')->check($_POST); -v::key('password_confirmation', v::equals($_POST['password']))->check($_POST); -``` - -The problem with the above code is because you do not know if `password` is a -valid key, so you must check it manually before performing the validation on -`password_confirmation`. - -The `keyValue()` rule makes this job easier by creating a rule named on -`$ruleName` passing `$baseKey` as the first argument of this rule, see an example: - -```php -v::keyValue('password_confirmation', 'equals', 'password')->validate($_POST); -``` - -The above code will result on `true` if _`$_POST['password_confirmation']` is -[equals](Equals.md) to `$_POST['password']`_, it's the same of: - -See another example: - -```php -v::keyValue('state', 'subdivisionCode', 'country')->validate($_POST); -``` - -The above code will result on `true` if _`$_POST['state']` is a -[subdivision code](SubdivisionCode.md) of `$_POST['country']`_: - -This rule will invalidate the input if `$comparedKey` or `$baseKey` don't exist, -or if the rule named on `$ruleName` could not be created (or don't exist). - -When using `assert()` or `check()` methods and the rule do not pass, it overwrites -all values in the validation exceptions with `$baseKey` and `$comparedKey`. - -```php -v::keyValue('password_confirmation', 'equals', 'password')->check($input); -``` - -The above code may generate the message: - -``` -password_confirmation must be equals "password" -``` - -*** -See also: - - * [Key](Key.md) - * [KeyNested](KeyNested.md) - * [KeySet](KeySet.md) - diff --git a/vendor/respect/validation/docs/LanguageCode.md b/vendor/respect/validation/docs/LanguageCode.md deleted file mode 100644 index a990f315a9a6f8d8b5261bfeab954fa5890a1bed..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/LanguageCode.md +++ /dev/null @@ -1,20 +0,0 @@ -# LanguageCode - -- `v::languageCode()` - -Validates a language code based on ISO 639: - -```php -v::languageCode()->validate('pt'); // true -v::languageCode()->validate('en'); // true -v::languageCode()->validate('it'); // true -v::languageCode('alpha-3')->validate('ita'); // true -v::languageCode('alpha-3')->validate('eng'); // true -``` - -You can choose between alpha-2 and alpha-3, alpha-2 is set by default. - -*** -See also: - - * [CountryCode](CountryCode.md) \ No newline at end of file diff --git a/vendor/respect/validation/docs/LeapDate.md b/vendor/respect/validation/docs/LeapDate.md deleted file mode 100644 index aa0e7581f7ab4207e3f863dcd14a6c800cd5bd14..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/LeapDate.md +++ /dev/null @@ -1,18 +0,0 @@ -# LeapDate - -- `v::leapDate(string $format)` - -Validates if a date is leap. - -```php -v::leapDate('Y-m-d')->validate('1988-02-29'); // true -``` - -This validator accepts DateTime instances as well. The $format -parameter is mandatory. - -*** -See also: - - * [Date](Date.md) - * [LeapYear](LeapYear.md) diff --git a/vendor/respect/validation/docs/LeapYear.md b/vendor/respect/validation/docs/LeapYear.md deleted file mode 100644 index db208993164f717ab648968850f78013a8794f74..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/LeapYear.md +++ /dev/null @@ -1,17 +0,0 @@ -# LeapYear - -- `v::leapYear()` - -Validates if a year is leap. - -```php -v::leapYear()->validate('1988'); // true -``` - -This validator accepts DateTime instances as well. - -*** -See also: - - * [Date](Date.md) - * [LeapDate](LeapDate.md) diff --git a/vendor/respect/validation/docs/Length.md b/vendor/respect/validation/docs/Length.md deleted file mode 100644 index 2fbf519536b85d41e705750ef6d05b57d0d59645..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Length.md +++ /dev/null @@ -1,44 +0,0 @@ -# Length - -- `v::length(int $min, int $max)` -- `v::length(int $min, null)` -- `v::length(null, int $max)` -- `v::length(int $min, int $max, boolean $inclusive = true)` - -Validates lengths. Most simple example: - -```php -v::stringType()->length(1, 5)->validate('abc'); // true -``` - -You can also validate only minimum length: - -```php -v::stringType()->length(5, null)->validate('abcdef'); // true -``` - -Only maximum length: - -```php -v::stringType()->length(null, 5)->validate('abc'); // true -``` - -The type as the first validator in a chain is a good practice, -since length accepts many types: - -```php -v::arrayVal()->length(1, 5)->validate(['foo', 'bar']); // true -``` - -A third parameter may be passed to validate the passed values inclusive: - -```php -v::stringType()->length(1, 5, true)->validate('a'); // true -``` - -Message template for this validator includes `{{minValue}}` and `{{maxValue}}`. - -*** -See also: - - * [Between](Between.md) diff --git a/vendor/respect/validation/docs/Lowercase.md b/vendor/respect/validation/docs/Lowercase.md deleted file mode 100644 index a79f82b76fdb91a36d71b1ceffa09daa00ea1b07..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Lowercase.md +++ /dev/null @@ -1,14 +0,0 @@ -# Lowercase - -- `v::lowercase()` - -Validates if string characters are lowercase in the input: - -```php -v::stringType()->lowercase()->validate('xkcd'); // true -``` - -*** -See also: - - * [Uppercase](Uppercase.md) diff --git a/vendor/respect/validation/docs/MacAddress.md b/vendor/respect/validation/docs/MacAddress.md deleted file mode 100644 index 92f427af302b90114e4c6705be4687b1c87a3c29..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/MacAddress.md +++ /dev/null @@ -1,17 +0,0 @@ -# MacAddress - -- `v::macAddress()` - -Validates a Mac Address. - -```php -v::macAddress()->validate('00:11:22:33:44:55'); // true -v::macAddress()->validate('af-AA-22-33-44-55'); // true -``` - -*** -See also: - - * [Domain](Domain.md) - * [Ip](Ip.md) - * [Tld](Tld.md) diff --git a/vendor/respect/validation/docs/Max.md b/vendor/respect/validation/docs/Max.md deleted file mode 100644 index 1c199b9497ad9067e2241117fbc8893543443996..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Max.md +++ /dev/null @@ -1,36 +0,0 @@ -# Max - -- `v::max(mixed $maxValue)` -- `v::max(mixed $maxValue, boolean $inclusive = true)` - -Validates if the input doesn't exceed the maximum value. - -```php -v::intVal()->max(15)->validate(20); // false -v::intVal()->max(20)->validate(20); // false -v::intVal()->max(20, true)->validate(20); // true -``` - -Also accepts dates: - -```php -v::date()->max('2012-01-01')->validate('2010-01-01'); // true -``` - -Also date intervals: - -```php -// Same of minimum age validation -v::date()->max('-18 years')->validate('1988-09-09'); // true -``` - -`true` may be passed as a parameter to indicate that inclusive -values must be used. - -Message template for this validator includes `{{maxValue}}`. - -*** -See also: - - * [Min](Min.md) - * [Between](Between.md) diff --git a/vendor/respect/validation/docs/Mimetype.md b/vendor/respect/validation/docs/Mimetype.md deleted file mode 100644 index a2af05e8c74aec337944d3a1566a5a050ba822b4..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Mimetype.md +++ /dev/null @@ -1,25 +0,0 @@ -# Mimetype - -- `v::mimetype(string $mimetype)` - -Validates if the file mimetype matches the expected one: - -```php -v::mimetype('image/png')->validate('image.png'); // true -``` - -This rule is case-sensitive and requires [fileinfo](http://php.net/fileinfo) PHP extension. - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Min.md b/vendor/respect/validation/docs/Min.md deleted file mode 100644 index 460154f25f8435fe489caff1681dd0c1ee49ce37..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Min.md +++ /dev/null @@ -1,29 +0,0 @@ -# Min - -- `v::min(mixed $minValue)` -- `v::min(mixed $minValue, boolean $inclusive = true)` - -Validates if the input is greater than the minimum value. - -```php -v::intVal()->min(15)->validate(5); // false -v::intVal()->min(5)->validate(5); // false -v::intVal()->min(5, true)->validate(5); // true -``` - -Also accepts dates: - -```php -v::date()->min('2012-01-01')->validate('2015-01-01'); // true -``` - -`true` may be passed as a parameter to indicate that inclusive -values must be used. - -Message template for this validator includes `{{minValue}}`. - -*** -See also: - - * [Max](Max.md) - * [Between](Between.md) diff --git a/vendor/respect/validation/docs/MinimumAge.md b/vendor/respect/validation/docs/MinimumAge.md deleted file mode 100644 index 33b457ae0b0ad2d3b34288a56569dee05e6e6188..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/MinimumAge.md +++ /dev/null @@ -1,23 +0,0 @@ -# MinimumAge - -This is going to be deprecated, please use [Age](Age.md) instead. - -- `v::minimumAge(int $age)` -- `v::minimumAge(int $age, string $format)` - -Validates a minimum age for a given date. - -```php -v::minimumAge(18)->validate('1987-01-01'); // true -v::minimumAge(18, 'd/m/Y')->validate('01/01/1987'); // true -``` - -Using `date()` before is a best-practice. - -Message template for this validator includes `{{age}}`. - -*** -See also: - - * [Age](Age.md) - * [Date](Date.md) diff --git a/vendor/respect/validation/docs/Multiple.md b/vendor/respect/validation/docs/Multiple.md deleted file mode 100644 index b6d8c7ff02ce91038d3b57c4abff84308cacc737..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Multiple.md +++ /dev/null @@ -1,14 +0,0 @@ -# Multiple - -- `v::multiple(int $multipleOf)` - -Validates if the input is a multiple of the given parameter - -```php -v::intVal()->multiple(3)->validate(9); // true -``` - -*** -See also: - - * [PrimeNumber](PrimeNumber.md) diff --git a/vendor/respect/validation/docs/Negative.md b/vendor/respect/validation/docs/Negative.md deleted file mode 100644 index efecb52018b0763c49d61deec12b3f45b1bbec7c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Negative.md +++ /dev/null @@ -1,14 +0,0 @@ -# Negative - -- `v::negative()` - -Validates if a number is lower than zero - -```php -v::numeric()->negative()->validate(-15); // true -``` - -*** -See also: - - * [Positive](Positive.md) diff --git a/vendor/respect/validation/docs/NfeAccessKey.md b/vendor/respect/validation/docs/NfeAccessKey.md deleted file mode 100644 index 2f9188f1b0ce52d960b4ef30f58dd17b203c6d61..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/NfeAccessKey.md +++ /dev/null @@ -1,16 +0,0 @@ -# NfeAccessKey - -- `v::nfeAccessKey(string $accessKey)` - -Validates the access key of the Brazilian electronic invoice (NFe). - -```php -v::nfeAccessKey()->validate('31841136830118868211870485416765268625116906'); // true -``` - -*** -See also: - - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) diff --git a/vendor/respect/validation/docs/No.md b/vendor/respect/validation/docs/No.md deleted file mode 100644 index e50b4c72becd343ad8682869488b9522d8fd456f..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/No.md +++ /dev/null @@ -1,24 +0,0 @@ -# No - -- `v::no()` -- `v::no(boolean $locale)` - -Validates if value is considered as "No". - -```php -v::no()->validate('N'); // true -v::no()->validate('Nay'); // true -v::no()->validate('Nix'); // true -v::no()->validate('No'); // true -v::no()->validate('Nope'); // true -v::no()->validate('Not'); // true -``` - -This rule is case insensitive. - -If `$locale` is TRUE, uses the value of [nl_langinfo()](http://php.net/nl_langinfo) with `NOEXPR` constant. - -*** -See also: - - * [Yes](Yes.md) diff --git a/vendor/respect/validation/docs/NoWhitespace.md b/vendor/respect/validation/docs/NoWhitespace.md deleted file mode 100644 index 052cfcdee028d66c24fe55bb1b6bce6ee64e7a27..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/NoWhitespace.md +++ /dev/null @@ -1,21 +0,0 @@ -# NoWhitespace - -- `v::noWhitespace()` - -Validates if a string contains no whitespace (spaces, tabs and line breaks); - -```php -v::noWhitespace()->validate('foo bar'); //false -v::noWhitespace()->validate("foo\nbar"); // false -``` - -This is most useful when chaining with other validators such as `v::alnum()` - -*** -See also: - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NotOptional](NotOptional.md) diff --git a/vendor/respect/validation/docs/NoneOf.md b/vendor/respect/validation/docs/NoneOf.md deleted file mode 100644 index 44e91537e8754135bf7f3a0400e0d5259d036188..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/NoneOf.md +++ /dev/null @@ -1,21 +0,0 @@ -# NoneOf - -- `v::noneOf(v $v1, v $v2, v $v3...)` - -Validates if NONE of the given validators validate: - -```php -v::noneOf( - v::intVal(), - v::floatVal() -)->validate('foo'); // true -``` - -In the sample above, 'foo' isn't a integer nor a float, so noneOf returns true. - -*** -See also: - - * [Not](Not.md) - * [AllOf](AllOf.md) - * [OneOf](OneOf.md) diff --git a/vendor/respect/validation/docs/Not.md b/vendor/respect/validation/docs/Not.md deleted file mode 100644 index 31f575bca1748ce768a9dbc54e4b9ed4d7d7e4c3..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Not.md +++ /dev/null @@ -1,24 +0,0 @@ -# Not - -- `v::not(v $negatedValidator)` - -Negates any rule. - -```php -v::not(v::ip())->validate('foo'); // true -``` - -In the sample above, validator returns true because 'foo' isn't an IP Address. - -You can negate complex, grouped or chained validators as well: - -```php -v::not(v::intVal()->positive())->validate(-1.5); // true -``` - -Each other validation has custom messages for negated rules. - -*** -See also: - - * [NoneOf](NoneOf.md) diff --git a/vendor/respect/validation/docs/NotBlank.md b/vendor/respect/validation/docs/NotBlank.md deleted file mode 100644 index 35a5ef2de273e29918c98c4a743603b026ffd3ca..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/NotBlank.md +++ /dev/null @@ -1,34 +0,0 @@ -# NotBlank - -- `v::notBlank()` - -Validates if the given input is not a blank value (`null`, zeros, empty strings -or empty arrays, recursively). - -```php -v::notBlank()->validate(null); // false -v::notBlank()->validate(''); // false -v::notBlank()->validate([]); // false -v::notBlank()->validate(' '); // false -v::notBlank()->validate(0); // false -v::notBlank()->validate('0'); // false -v::notBlank()->validate(0); // false -v::notBlank()->validate('0.0'); // false -v::notBlank()->validate(false); // false -v::notBlank()->validate(['']); // false -v::notBlank()->validate([' ']); // false -v::notBlank()->validate([0]); // false -v::notBlank()->validate(['0']); // false -v::notBlank()->validate([false]); // false -v::notBlank()->validate([[''], [0]]); // false -v::notBlank()->validate(new stdClass()); // false -``` - -It's similar to [NotEmpty](NotEmpty.md) but it's way more strict. - -*** -See also: - - * [NoWhitespace](NoWhitespace.md) - * [NotEmpty](NotEmpty.md) - * [NullType](NullType.md) diff --git a/vendor/respect/validation/docs/NotEmpty.md b/vendor/respect/validation/docs/NotEmpty.md deleted file mode 100644 index ab888f6a641664ad296b7de9cb616c4421500f08..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/NotEmpty.md +++ /dev/null @@ -1,42 +0,0 @@ -# NotEmpty - -- `v::notEmpty()` - -Validates if the given input is not empty or in other words is input mandatory and -required. This function also takes whitespace into account, use `noWhitespace()` -if no spaces or linebreaks and other whitespace anywhere in the input is desired. - -```php -v::stringType()->notEmpty()->validate(''); // false -``` - -Null values are empty: - -```php -v::notEmpty()->validate(null); // false -``` - -Numbers: - -```php -v::intVal()->notEmpty()->validate(0); // false -``` - -Empty arrays: - -```php -v::arrayVal()->notEmpty()->validate([]); // false -``` - -Whitespace: - -```php -v::stringType()->notEmpty()->validate(' '); //false -v::stringType()->notEmpty()->validate("\t \n \r"); //false -``` - -*** -See also: - - * [NoWhitespace](NoWhitespace.md) - * [NullType](NullType.md) diff --git a/vendor/respect/validation/docs/NotOptional.md b/vendor/respect/validation/docs/NotOptional.md deleted file mode 100644 index 487e7f1ef253ff82ead7b3f150f7c07a3163209b..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/NotOptional.md +++ /dev/null @@ -1,39 +0,0 @@ -# NotOptional - -- `v::notOptional()` - -Validates if the given input is not optional. By _optional_ we consider `null` -or an empty string (`''`). - -```php -v::notOptional()->validate(''); // false -v::notOptional()->validate(null); // false -``` - -Other values: - -```php -v::notOptional()->validate([]); // true -v::notOptional()->validate(' '); // true -v::notOptional()->validate(0); // true -v::notOptional()->validate('0'); // true -v::notOptional()->validate(0); // true -v::notOptional()->validate('0.0'); // true -v::notOptional()->validate(false); // true -v::notOptional()->validate(['']); // true -v::notOptional()->validate([' ']); // true -v::notOptional()->validate([0]); // true -v::notOptional()->validate(['0']); // true -v::notOptional()->validate([false]); // true -v::notOptional()->validate([[''), [0]]); // true -v::notOptional()->validate(new stdClass()); // true -``` - -*** -See also: - - * [NoWhitespace](NoWhitespace.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NullType](NullType.md) - * [Optional](Optional.md) diff --git a/vendor/respect/validation/docs/NullType.md b/vendor/respect/validation/docs/NullType.md deleted file mode 100644 index 5b39feb6c2d0eb36a964fc982d2fcd58aa73cea8..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/NullType.md +++ /dev/null @@ -1,25 +0,0 @@ -# NullType - -- `v::nullType()` - -Validates if the input is null. - -```php -v::nullType()->validate(null); // true -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NotOptional](NotOptional.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/Numeric.md b/vendor/respect/validation/docs/Numeric.md deleted file mode 100644 index d8121fb61c9ae621e4ebe74b45b80853e5c95721..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Numeric.md +++ /dev/null @@ -1,18 +0,0 @@ -# Numeric - -- `v::numeric()` - -Validates on any numeric value. - -```php -v::numeric()->validate(-12); // true -v::numeric()->validate('135.0'); // true -``` - -*** -See also: - - * [Digit](Digit.md) - * [Finite](Finite.md) - * [Infinite](Infinite.md) - * [IntVal](IntVal.md) diff --git a/vendor/respect/validation/docs/ObjectType.md b/vendor/respect/validation/docs/ObjectType.md deleted file mode 100644 index 39212603155048570ca891161b495f1f8f41792c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/ObjectType.md +++ /dev/null @@ -1,24 +0,0 @@ -# ObjectType - -- `v::objectType()` - -Validates if the input is an object. - -```php -v::objectType()->validate(new stdClass); // true -``` - -*** -See also: - - * [Attribute](Attribute.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [Instance](Instance.md) - * [IntType](IntType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/Odd.md b/vendor/respect/validation/docs/Odd.md deleted file mode 100644 index b1a8d05fc978f94cd5e074288b5988969c161868..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Odd.md +++ /dev/null @@ -1,17 +0,0 @@ -# Odd - -- `v::odd()` - -Validates an odd number. - -```php -v::intVal()->odd()->validate(3); // true -``` - -Using `int()` before `odd()` is a best practice. - -*** -See also: - - * [Even](Even.md) - * [Multiple](Multiple.md) diff --git a/vendor/respect/validation/docs/OneOf.md b/vendor/respect/validation/docs/OneOf.md deleted file mode 100644 index e16be50df043ad94aa622584da26a71746077ee0..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/OneOf.md +++ /dev/null @@ -1,25 +0,0 @@ -# OneOf - -- `v::oneOf(v $v1, v $v2, v $v3...)` - -This is a group validator that acts as an OR operator. - -```php -v::oneOf( - v::intVal(), - v::floatVal() -)->validate(15.5); // true -``` - -In the sample above, `v::intVal()` doesn't validates, but -`v::floatVal()` validates, so oneOf returns true. - -`v::oneOf` returns true if at least one inner validator -passes. - -*** -See also: - - * [AllOf](AllOf.md) - * [NoneOf](NoneOf.md) - * [When](When.md) diff --git a/vendor/respect/validation/docs/Optional.md b/vendor/respect/validation/docs/Optional.md deleted file mode 100644 index 1a4aa5ec091f9731c70ae017489abc01c6424de1..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Optional.md +++ /dev/null @@ -1,21 +0,0 @@ -# Optional - -- `v::optional(v $rule)` - -Validates if the given input is optional or not. By _optional_ we consider `null` -or an empty string (`''`). - -```php -v::optional(v::alpha())->validate(''); // true -v::optional(v::digit())->validate(null); // true -``` - - -*** -See also: - - * [NoWhitespace](NoWhitespace.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NotOptional](NotOptional.md) - * [NullType](NullType.md) diff --git a/vendor/respect/validation/docs/PerfectSquare.md b/vendor/respect/validation/docs/PerfectSquare.md deleted file mode 100644 index 3a344b27c9125bd28f0ac6afc1fa8b3d485d372b..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/PerfectSquare.md +++ /dev/null @@ -1,16 +0,0 @@ -# PerfectSquare - -- `v::perfectSquare()` - -Validates a perfect square. - -```php -v::perfectSquare()->validate(25); // true (5*5) -v::perfectSquare()->validate(9); // true (3*3) -``` - -*** -See also: - - * [Factor](Factor.md) - * [PrimeNumber](PrimeNumber.md) diff --git a/vendor/respect/validation/docs/Pesel.md b/vendor/respect/validation/docs/Pesel.md deleted file mode 100644 index 275ff7f8d3117304f091e08f9b3424aff30cbf65..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Pesel.md +++ /dev/null @@ -1,12 +0,0 @@ -# Pesel - -- `v::pesel()` - -Validates PESEL (Polish human identification number). - -```php -v::pesel()->validate('21120209256'); // true -v::pesel()->validate('97072704800'); // true -v::pesel()->validate('97072704801'); // false -v::pesel()->validate('PESEL123456'); // false -``` diff --git a/vendor/respect/validation/docs/Phone.md b/vendor/respect/validation/docs/Phone.md deleted file mode 100644 index ac3cba9b9582c7192467e65376d4c0e7dd8b0899..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Phone.md +++ /dev/null @@ -1,22 +0,0 @@ -# Phone - -- `v::phone()` - -Validates a valid 7, 10, 11 digit phone number (North America, Europe and most -Asian and Middle East countries), supporting country and area codes (in dot, -space or dashed notations) such as: - - (555)555-5555 - 555 555 5555 - +5(555)555.5555 - 33(1)22 22 22 22 - +33(1)22 22 22 22 - +33(020)7777 7777 - 03-6106666 - -*** -See also: - - * [Email](Email.md) - * [Url](Url.md) - * [VideoUrl](VideoUrl.md) diff --git a/vendor/respect/validation/docs/PhpLabel.md b/vendor/respect/validation/docs/PhpLabel.md deleted file mode 100644 index 4295267d72fb63767b02985ce2fd2f4479226e43..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/PhpLabel.md +++ /dev/null @@ -1,24 +0,0 @@ -# PhpLabel - -- `v::phpLabel()` - -Validates if a value is considered a valid PHP Label, -so that it can be used as a *variable*, *function* or *class* name, for example. - -Reference: -http://php.net/manual/en/language.variables.basics.php - -```php -v::phpLabel()->validate('person'); //true -v::phpLabel()->validate('foo'); //true -v::phpLabel()->validate('4ccess'); //false -``` - -*** -See also: - - * [Regex](Regex.md) - * [ResourceType](ResourceType.md) - * [Slug](Slug.md) - * [Charset](Charset.md) - \ No newline at end of file diff --git a/vendor/respect/validation/docs/Positive.md b/vendor/respect/validation/docs/Positive.md deleted file mode 100644 index ecf75d9f00fd536907b1e56462fda4f184920501..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Positive.md +++ /dev/null @@ -1,14 +0,0 @@ -# Positive - -- `v::positive()` - -Validates if a number is higher than zero - -```php -v::numeric()->positive()->validate(-15); // false -``` - -*** -See also: - - * [Negative](Negative.md) diff --git a/vendor/respect/validation/docs/PostalCode.md b/vendor/respect/validation/docs/PostalCode.md deleted file mode 100644 index c18ec96ede6a146bddb14f0c964cb95b278a4670..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/PostalCode.md +++ /dev/null @@ -1,22 +0,0 @@ -# PostalCode - -- `v::postalCode(string $countryCode)` - -Validates a postal code according to the given country code. - -```php -v::postalCode('BR')->validate('02179000'); // true -v::postalCode('BR')->validate('02179-000'); // true -v::postalCode('US')->validate('02179-000'); // false -v::postalCode('US')->validate('55372'); // true -v::postalCode('PL')->validate('99-300'); // true -``` - -Message template for this validator includes `{{countryCode}}`. - -Extracted from [GeoNames](http://www.geonames.org/). - -*** -See also: - - * [CountryCode](CountryCode.md) diff --git a/vendor/respect/validation/docs/PrimeNumber.md b/vendor/respect/validation/docs/PrimeNumber.md deleted file mode 100644 index dee58eabd4c93b89b4e351fd856d9608beeddfa6..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/PrimeNumber.md +++ /dev/null @@ -1,16 +0,0 @@ -# PrimeNumber - -- `v::primeNumber()` - -Validates a prime number - -```php -v::primeNumber()->validate(7); // true -``` - -*** -See also: - - * [Factor](Factor.md) - * [PerfectSquare](PerfectSquare.md) - * [PrimeNumber](PrimeNumber.md) diff --git a/vendor/respect/validation/docs/Prnt.md b/vendor/respect/validation/docs/Prnt.md deleted file mode 100644 index 29dc6d76397b0d52e1cb0b8a269d4f4395952913..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Prnt.md +++ /dev/null @@ -1,15 +0,0 @@ -# Prnt - -- `v::prnt()` -- `v::prnt(string $additionalChars)` - -Similar to `v::graph` but accepts whitespace. - -```php -v::prnt()->validate('LMKA0$% _123'); // true -``` - -*** -See also: - - * [Graph](Graph.md) diff --git a/vendor/respect/validation/docs/Punct.md b/vendor/respect/validation/docs/Punct.md deleted file mode 100644 index d49411aa90978c85ffe136eb0afdf574dc985fd5..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Punct.md +++ /dev/null @@ -1,17 +0,0 @@ -# Punct - -- `v::punct()` -- `v::punct(string $additionalChars)` - -Accepts only punctuation characters: - -```php -v::punct()->validate('&,.;[]'); // true -``` - -*** -See also: - - * [Cntrl](Cntrl.md) - * [Graph](Graph.md) - * [Prnt](Prnt.md) diff --git a/vendor/respect/validation/docs/README.md b/vendor/respect/validation/docs/README.md deleted file mode 100644 index abd573aaff56a3aae4a2660f92ac9c3f62c8ac88..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/README.md +++ /dev/null @@ -1,310 +0,0 @@ -# Feature Guide - -## Namespace import - -Respect\Validation is namespaced, but you can make your life easier by importing -a single class into your context: - -```php -use Respect\Validation\Validator as v; -``` - -## Simple validation - -The Hello World validator is something like this: - -```php -$number = 123; -v::numeric()->validate($number); // true -``` - -## Chained validation - -It is possible to use validators in a chain. Sample below validates a string -containing numbers and letters, no whitespace and length between 1 and 15. - -```php -$usernameValidator = v::alnum()->noWhitespace()->length(1, 15); -$usernameValidator->validate('alganet'); // true -``` - -## Validating object attributes - -Given this simple object: - -```php -$user = new stdClass; -$user->name = 'Alexandre'; -$user->birthdate = '1987-07-01'; -``` - -Is possible to validate its attributes in a single chain: - -```php -$userValidator = v::attribute('name', v::stringType()->length(1,32)) - ->attribute('birthdate', v::date()->age(18)); - -$userValidator->validate($user); // true -``` - -Validating array keys is also possible using `v::key()` - -Note that we used `v::stringType()` and `v::date()` in the beginning of the validator. -Although is not mandatory, it is a good practice to use the type of the -validated object as the first node in the chain. - -## Input optional - -On oldest versions of Respect\Validation all validators treat input as optional -and accept an empty string input as valid. Even though a useful feature that -caused a lot of troubles for our team and neither was an obvious behavior. Also -there was some people who likes to accept `null` as optional value, not only an -empty string. - -For that reason all rules are mandatory now but if you want to treat a value as -optional you can use `v::optional()` rule: - -```php -v::alpha()->validate(''); // false input required -v::alpha()->validate(null); // false input required - -v::optional(v::alpha())->validate(''); // true -v::optional(v::alpha())->validate(null); // true -``` - -By _optional_ we consider `null` or an empty string (`''`). - -See more on [Optional](Optional.md). - -## Negating rules - -You can use the `v::not()` to negate any rule: - -```php -v::not(v::intVal())->validate(10); // false, input must not be integer -``` - -## Validator reuse - -Once created, you can reuse your validator anywhere. Remember `$usernameValidator`? - -```php -$usernameValidator->validate('respect'); //true -$usernameValidator->validate('alexandre gaigalas'); // false -$usernameValidator->validate('#$%'); //false -``` - -## Exception types - -* `Respect\Validation\Exceptions\ExceptionInterface`: - * All exceptions implement this interface; -* `Respect\Validation\Exceptions\ValidationException`: - * Implements the `Respect\Validation\Exceptions\ExceptionInterface` interface - * Thrown when the `check()` fails - * All validation exceptions extend this class - * Available methods: - * `getMainMessage()`; - * `setMode($mode)`; - * `setName($name)`; - * `setParam($name, $value)`; - * `setTemplate($template)`; - * more... -* `Respect\Validation\Exceptions\NestedValidationException`: - * Extends the `Respect\Validation\Exceptions\ValidationException` class - * Usually thrown when the `assert()` fails - * Available methods: - * `findMessages()`; - * `getFullMessage()`; - * `getMessages()`; - * more... - -## Informative exceptions - -When something goes wrong, Validation can tell you exactly what's going on. For this, -we use the `assert()` method instead of `validate()`: - -```php -use Respect\Validation\Exceptions\NestedValidationException; - -try { - $usernameValidator->assert('really messed up screen#name'); -} catch(NestedValidationException $exception) { - echo $exception->getFullMessage(); -} -``` - -The printed message is exactly this, as a nested Markdown list: - -```no-highlight -- All of the required rules must pass for "really messed up screen#name" - - "really messed up screen#name" must contain only letters (a-z) and digits (0-9) - - "really messed up screen#name" must not contain whitespace - - "really messed up screen#name" must have a length between 1 and 15 -``` - -## Getting all messages as an array - -The Markdown list is fine, but unusable on a HTML form or something more custom. -For that you can use `getMessages()`. - -It will return all messages from the rules that did not pass the validation. - -```php -try { - $usernameValidator->assert('really messed up screen#name'); -} catch(NestedValidationException $exception) { - print_r($exception->getMessages()); -} -``` - -The code above may display something like: - -```no-highlight -Array -( - [0] => "really messed up screen#name" must contain only letters (a-z) and digits (0-9) - [1] => "really messed up screen#name" must not contain whitespace - [2] => "really messed up screen#name" must have a length between 1 and 15 -) -``` - -## Getting messages as an array by name - -If you want to get specific message by name you can use `findMessages()` passing -the names of the rules you want: - -```php -try { - $usernameValidator->assert('really messed up screen#name'); -} catch(NestedValidationException $exception) { - print_r($exception->findMessages(['alnum', 'noWhitespace'])); -} -``` - -The `findMessages()` returns an array with messages from the requested validators, -like this: - -```no-highlight -Array -( - [alnum] => "really messed up screen#name" must contain only letters (a-z) and digits (0-9) - [noWhitespace] => "really messed up screen#name" must not contain whitespace -) -``` - -## Custom messages - -Getting messages as an array is fine, but sometimes you need to customize them in order -to present them to the user. This is possible using the `findMessages()` method as well: - -```php -$errors = $exception->findMessages([ - 'alnum' => '{{name}} must contain only letters and digits', - 'length' => '{{name}} must not have more than 15 chars', - 'noWhitespace' => '{{name}} cannot contain spaces' -]); -``` - -For all messages, the `{{name}}` variable is available for templates. If you -do not define a name it uses the input to replace this placeholder. - -## Message localization - -You're also able to translate your message to another language with Validation. -The only thing one must do is to define the param `translator` as a callable that -will handle the translation: - -```php -$exception->setParam('translator', 'gettext'); -``` - -The example above uses `gettext()` but you can use any other callable value, like -`[$translator, 'trans']` or `you_custom_function()`. - -After that, if you call `getMainMessage()` or `getFullMessage()` (for nested), -the message will be translated. - -Note that `getMessage()` will keep the original message. - -## Custom rules - -You also can use your own rules: - -```php -namespace My\Validation\Rules; - -use Respect\Validation\Rules\AbstractRule; - -class MyRule extends AbstractRule -{ - public function validate($input) - { - // Do something here with the $input and return a boolean value - } -} -``` - -If you do want Validation to execute you rule (or rules) in the chain, you must -use `v::with()` passing your rule's namespace as an argument: - -```php -v::with('My\\Validation\\Rules\\'); -v::myRule(); // Try to load "My\Validation\Rules\MyRule" if any -``` - -By default `with()` appends the given prefix, but you can change this behavior -in order to overwrite default rules: - -```php -v::with('My\\Validation\\Rules', true); -v::alnum(); // Try to use "My\Validation\Rules\Alnum" if any -``` - -## Validator name - -On `v::attribute()` and `v::key()`, `{{name}}` is the attribute/key name. For others, -is the same as the input. You can customize a validator name using: - -```php -v::date('Y-m-d')->between('1980-02-02', 'now')->setName('Member Since'); -``` - -## Zend/Symfony validators - -It is also possible to reuse validators from other frameworks if they are installed: - -```php -$hostnameValidator = v::zend('Hostname')->assert('google.com'); -$timeValidator = v::sf('Time')->assert('22:00:01'); -``` - -## Validation methods - -We've seen `validate()` that returns true or false and `assert()` that throws a complete -validation report. There is also a `check()` method that returns an Exception -only with the first error found: - -```php -use Respect\Validation\Exceptions\ValidationException; - -try { - $usernameValidator->check('really messed up screen#name'); -} catch(ValidationException $exception) { - echo $exception->getMainMessage(); -} -``` - -Message: - -```no-highlight -"really messed up screen#name" must contain only letters (a-z) and digits (0-9) -``` - -*** -See also: - -- [Contributing](../CONTRIBUTING.md) -- [Installation](INSTALL.md) -- [License](../LICENSE.md) -- [Validators](VALIDATORS.md) -- [Changelog](../CHANGELOG.md) diff --git a/vendor/respect/validation/docs/Readable.md b/vendor/respect/validation/docs/Readable.md deleted file mode 100644 index 00a074eb9142aa4700965e2bf593d6b3cbd67e3d..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Readable.md +++ /dev/null @@ -1,23 +0,0 @@ -# Readable - -- `v::readable()` - -Validates if the given data is a file exists and is readable. - -```php -v::readable()->validate('/path/of/a/readable/file'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Regex.md b/vendor/respect/validation/docs/Regex.md deleted file mode 100644 index ed0d2517345e6fcb37c9ad8e68a3d83d98b815ab..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Regex.md +++ /dev/null @@ -1,21 +0,0 @@ -# Regex - -- `v::regex(string $regex)` - -Evaluates a regex on the input and validates if matches - -```php -v::regex('/[a-z]/')->validate('a'); // true -``` - -Message template for this validator includes `{{regex}}` - -*** -See also: - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [Contains](Contains.md) - * [Digit](Digit.md) - * [EndsWith](EndsWith.md) - * [StartsWith](StartsWith.md) diff --git a/vendor/respect/validation/docs/ResourceType.md b/vendor/respect/validation/docs/ResourceType.md deleted file mode 100644 index c21a2f1d89b7a85c966d8eefdd07e3abe4d4e565..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/ResourceType.md +++ /dev/null @@ -1,21 +0,0 @@ -# ResourceType - -- `v::resourceType()` - -Validates if the input is a resource. - -```php -v::resourceType()->validate(fopen('/path/to/file.txt', 'w')); // true -``` - -*** -See also: - - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [StringType](StringType.md) - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/Roman.md b/vendor/respect/validation/docs/Roman.md deleted file mode 100644 index b619930e1bf61ec67b70c246aa1aaa23bbfafb00..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Roman.md +++ /dev/null @@ -1,16 +0,0 @@ -# Roman - -- `v::roman()` - -Validates roman numbers - -```php -v::roman()->validate('IV'); // true -``` - -*** -See also: - - * [In](In.md) - * [Regex](Regex.md) - * [Uppercase](Uppercase.md) diff --git a/vendor/respect/validation/docs/ScalarVal.md b/vendor/respect/validation/docs/ScalarVal.md deleted file mode 100644 index 366657854d77bda4e2df7eac79e9787b4c392fc1..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/ScalarVal.md +++ /dev/null @@ -1,15 +0,0 @@ -# ScalarVal - -- `v::scalarVal()` - -Validates if the input is a scalar value. - -```php -v::scalarVal()->validate([]); // false -v::scalarVal()->validate(135.0); // true -``` - -*** -See also: - - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/Sf.md b/vendor/respect/validation/docs/Sf.md deleted file mode 100644 index a7988a8b98d4027c45045556046a7d7169bc4a0b..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Sf.md +++ /dev/null @@ -1,19 +0,0 @@ -# Sf - -- `v::sf(string $validator)` - -Use Symfony2 validators inside Respect\Validation flow. Messages -are preserved. - -```php -v::sf('Time')->validate('15:00:00'); -``` - - -You must add `"symfony/validator": "~2.6"` to your `require` property on composer.json file. - - -*** -See also: - - * [Zend](Zend.md) diff --git a/vendor/respect/validation/docs/Size.md b/vendor/respect/validation/docs/Size.md deleted file mode 100644 index 13f5aee4e96aec1c383ef7bed1c78a471aa33f6f..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Size.md +++ /dev/null @@ -1,48 +0,0 @@ -# Size - -- `v::size(string $minSize)` -- `v::size(string $minSize, string $maxSize)` -- `v::size(null, string $maxSize)` - -Validates file sizes: - -```php -v::size('1KB')->validate($filename); // Must have at least 1KB size -v::size('1MB', '2MB')->validate($filename); // Must have the size between 1MB and 2MB -v::size(null, '1GB')->validate($filename); // Must not be greater than 1GB -``` - -Sizes are not case-sensitive and the accepted values are: - -- B -- KB -- MB -- GB -- TB -- PB -- EB -- ZB -- YB - -This validator will consider `SplFileInfo` instances, like: - -```php -$fileInfo = new SplFileInfo($filename); -v::size('1.5mb')->validate($fileInfo); // Will return true or false -``` - -Message template for this validator includes `{{minSize}}` and `{{maxSize}}`. - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Slug.md b/vendor/respect/validation/docs/Slug.md deleted file mode 100644 index 599bbbaac904fdef72ddcf7fc753511aa67fc8a7..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Slug.md +++ /dev/null @@ -1,17 +0,0 @@ -# Slug - -- `v::slug()` - -Validates slug-like strings: - -```php -v::slug()->validate('my-wordpress-title'); // true -v::slug()->validate('my-wordpress--title'); // false -v::slug()->validate('my-wordpress-title-'); // false -``` - -*** -See also: - - * [Url](Url.md) - * [VideoUrl](VideoUrl.md) diff --git a/vendor/respect/validation/docs/Space.md b/vendor/respect/validation/docs/Space.md deleted file mode 100644 index a0faec57133569ef6457237c0eacd2f9e6782db0..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Space.md +++ /dev/null @@ -1,15 +0,0 @@ -# Space - -- `v::space()` -- `v::space(string $additionalChars)` - -Accepts only whitespace: - -```php -v::space()->validate(' '); // true -``` - -*** -See also: - - * [Cntrl](Cntrl.md) diff --git a/vendor/respect/validation/docs/StartsWith.md b/vendor/respect/validation/docs/StartsWith.md deleted file mode 100644 index 842655d94b25b1460254e12d1d4618032cf77d5c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/StartsWith.md +++ /dev/null @@ -1,31 +0,0 @@ -# StartsWith - -- `v::startsWith(mixed $value)` -- `v::startsWith(mixed $value, boolean $identical = false)` - -This validator is similar to `v::contains()`, but validates -only if the value is at the beginning of the input. - -For strings: - -```php -v::startsWith('lorem')->validate('lorem ipsum'); // true -``` - -For arrays: - -```php -v::startsWith('lorem')->validate(['lorem', 'ipsum']); // true -``` - -`true` may be passed as a parameter to indicate identical comparison -instead of equal. - -Message template for this validator includes `{{startValue}}`. - -*** -See also: - - * [EndsWith](EndsWith.md) - * [Contains](Contains.md) - * [In](In.md) diff --git a/vendor/respect/validation/docs/StringType.md b/vendor/respect/validation/docs/StringType.md deleted file mode 100644 index 624c3df8cfbe16b0774d69203d9d5d32a5c12f03..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/StringType.md +++ /dev/null @@ -1,22 +0,0 @@ -# StringType - -- `v::stringType()` - -Validates a string. - -```php -v::stringType()->validate('hi'); // true -``` - -*** -See also: - - * [Alnum](Alnum.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [FloatType](FloatType.md) - * [IntType](IntType.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/SubdivisionCode.md b/vendor/respect/validation/docs/SubdivisionCode.md deleted file mode 100644 index 3cb031922eff171dcac07b05827f9420049fa83c..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/SubdivisionCode.md +++ /dev/null @@ -1,284 +0,0 @@ -# SubdivisionCode - -- `v::subdivisionCode(string $countryCode)` - -Validates subdivision country codes according to [ISO 3166-2][]. - -The `$countryCode` must be a country in [ISO 3166-1 alpha-2][] format. - -```php -v::subdivisionCode('BR')->validate('SP'); // true -v::subdivisionCode('US')->validate('CA'); // true -``` - -This rule is case sensitive. - -## Available country codes - -- `AD`: Andorra -- `AE`: United Arab Emirates -- `AF`: Afghanistan -- `AG`: Antigua and Barbuda -- `AI`: Anguilla -- `AL`: Albania -- `AM`: Armenia -- `AN`: AN.html -- `AO`: Angola -- `AQ`: Antarctica -- `AR`: Argentina -- `AS`: American Samoa -- `AT`: Austria -- `AU`: Australia -- `AW`: Aruba -- `AX`: Ã…land -- `AZ`: Azerbaijan -- `BA`: Bosnia and Herzegovina -- `BB`: Barbados -- `BD`: Bangladesh -- `BE`: Belgium -- `BF`: Burkina Faso -- `BG`: Bulgaria -- `BH`: Bahrain -- `BI`: Burundi -- `BJ`: Benin -- `BL`: Saint Barthélemy -- `BM`: Bermuda -- `BN`: Brunei -- `BO`: Bolivia -- `BQ`: Bonaire -- `BR`: Brazil -- `BS`: Bahamas -- `BT`: Bhutan -- `BV`: Bouvet Island -- `BW`: Botswana -- `BY`: Belarus -- `BZ`: Belize -- `CA`: Canada -- `CC`: Cocos [Keeling] Islands -- `CD`: Democratic Republic of the Congo -- `CF`: Central African Republic -- `CG`: Republic of the Congo -- `CH`: Switzerland -- `CI`: Ivory Coast -- `CK`: Cook Islands -- `CL`: Chile -- `CM`: Cameroon -- `CN`: China -- `CO`: Colombia -- `CR`: Costa Rica -- `CS`: CS.html -- `CU`: Cuba -- `CV`: Cape Verde -- `CW`: Curacao -- `CX`: Christmas Island -- `CY`: Cyprus -- `CZ`: Czech Republic -- `DE`: Germany -- `DJ`: Djibouti -- `DK`: Denmark -- `DM`: Dominica -- `DO`: Dominican Republic -- `DZ`: Algeria -- `EC`: Ecuador -- `EE`: Estonia -- `EG`: Egypt -- `EH`: Western Sahara -- `ER`: Eritrea -- `ES`: Spain -- `ET`: Ethiopia -- `FI`: Finland -- `FJ`: Fiji -- `FK`: Falkland Islands -- `FM`: Micronesia -- `FO`: Faroe Islands -- `FR`: France -- `GA`: Gabon -- `GB`: United Kingdom -- `GD`: Grenada -- `GE`: Georgia -- `GF`: French Guiana -- `GG`: Guernsey -- `GH`: Ghana -- `GI`: Gibraltar -- `GL`: Greenland -- `GM`: Gambia -- `GN`: Guinea -- `GP`: Guadeloupe -- `GQ`: Equatorial Guinea -- `GR`: Greece -- `GS`: South Georgia and the South Sandwich Islands -- `GT`: Guatemala -- `GU`: Guam -- `GW`: Guinea-Bissau -- `GY`: Guyana -- `HK`: Hong Kong -- `HM`: Heard Island and McDonald Islands -- `HN`: Honduras -- `HR`: Croatia -- `HT`: Haiti -- `HU`: Hungary -- `ID`: Indonesia -- `IE`: Ireland -- `IL`: Israel -- `IM`: Isle of Man -- `IN`: India -- `IO`: British Indian Ocean Territory -- `IQ`: Iraq -- `IR`: Iran -- `IS`: Iceland -- `IT`: Italy -- `JE`: Jersey -- `JM`: Jamaica -- `JO`: Jordan -- `JP`: Japan -- `KE`: Kenya -- `KG`: Kyrgyzstan -- `KH`: Cambodia -- `KI`: Kiribati -- `KM`: Comoros -- `KN`: Saint Kitts and Nevis -- `KP`: North Korea -- `KR`: South Korea -- `KW`: Kuwait -- `KY`: Cayman Islands -- `KZ`: Kazakhstan -- `LA`: Laos -- `LB`: Lebanon -- `LC`: Saint Lucia -- `LI`: Liechtenstein -- `LK`: Sri Lanka -- `LR`: Liberia -- `LS`: Lesotho -- `LT`: Lithuania -- `LU`: Luxembourg -- `LV`: Latvia -- `LY`: Libya -- `MA`: Morocco -- `MC`: Monaco -- `MD`: Moldova -- `ME`: Montenegro -- `MF`: Saint Martin -- `MG`: Madagascar -- `MH`: Marshall Islands -- `MK`: Macedonia -- `ML`: Mali -- `MM`: Myanmar [Burma] -- `MN`: Mongolia -- `MO`: Macao -- `MP`: Northern Mariana Islands -- `MQ`: Martinique -- `MR`: Mauritania -- `MS`: Montserrat -- `MT`: Malta -- `MU`: Mauritius -- `MV`: Maldives -- `MW`: Malawi -- `MX`: Mexico -- `MY`: Malaysia -- `MZ`: Mozambique -- `NA`: Namibia -- `NC`: New Caledonia -- `NE`: Niger -- `NF`: Norfolk Island -- `NG`: Nigeria -- `NI`: Nicaragua -- `NL`: Netherlands -- `NO`: Norway -- `NP`: Nepal -- `NR`: Nauru -- `NU`: Niue -- `NZ`: New Zealand -- `OM`: Oman -- `PA`: Panama -- `PE`: Peru -- `PF`: French Polynesia -- `PG`: Papua New Guinea -- `PH`: Philippines -- `PK`: Pakistan -- `PL`: Poland -- `PM`: Saint Pierre and Miquelon -- `PN`: Pitcairn Islands -- `PR`: Puerto Rico -- `PS`: Palestine -- `PT`: Portugal -- `PW`: Palau -- `PY`: Paraguay -- `QA`: Qatar -- `RE`: Réunion -- `RO`: Romania -- `RS`: Serbia -- `RU`: Russia -- `RW`: Rwanda -- `SA`: Saudi Arabia -- `SB`: Solomon Islands -- `SC`: Seychelles -- `SD`: Sudan -- `SE`: Sweden -- `SG`: Singapore -- `SH`: Saint Helena -- `SI`: Slovenia -- `SJ`: Svalbard and Jan Mayen -- `SK`: Slovakia -- `SL`: Sierra Leone -- `SM`: San Marino -- `SN`: Senegal -- `SO`: Somalia -- `SR`: Suriname -- `SS`: South Sudan -- `ST`: São Tomé and PrÃncipe -- `SV`: El Salvador -- `SX`: Sint Maarten -- `SY`: Syria -- `SZ`: Swaziland -- `TC`: Turks and Caicos Islands -- `TD`: Chad -- `TF`: French Southern Territories -- `TG`: Togo -- `TH`: Thailand -- `TJ`: Tajikistan -- `TK`: Tokelau -- `TL`: East Timor -- `TM`: Turkmenistan -- `TN`: Tunisia -- `TO`: Tonga -- `TR`: Turkey -- `TT`: Trinidad and Tobago -- `TV`: Tuvalu -- `TW`: Taiwan -- `TZ`: Tanzania -- `UA`: Ukraine -- `UG`: Uganda -- `UM`: U.S. Minor Outlying Islands -- `US`: United States -- `UY`: Uruguay -- `UZ`: Uzbekistan -- `VA`: Vatican City -- `VC`: Saint Vincent and the Grenadines -- `VE`: Venezuela -- `VG`: British Virgin Islands -- `VI`: U.S. Virgin Islands -- `VN`: Vietnam -- `VU`: Vanuatu -- `WF`: Wallis and Futuna -- `WS`: Samoa -- `XK`: Kosovo -- `YE`: Yemen -- `YT`: Mayotte -- `ZA`: South Africa -- `ZM`: Zambia -- `ZW`: Zimbabwe - -All data was extrated from [GeoNames][] which is licensed under a -[Creative Commons Attribution 3.0 License][]. - -*** -See also: - - * [CountryCode](CountryCode.md) - * [Tld](Tld.md) - - -[Creative Commons Attribution 3.0 License]: http://creativecommons.org/licenses/by/3.0 "Creative Commons Attribution 3.0 License" -[GeoNames]: http://www.geonames.org "GetNames" -[ISO 3166-1 alpha-2]: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 "ISO 3166-1 alpha-2" -[ISO 3166-2]: http://en.wikipedia.org/wiki/ISO_3166-2 "ISO 3166-2" diff --git a/vendor/respect/validation/docs/SymbolicLink.md b/vendor/respect/validation/docs/SymbolicLink.md deleted file mode 100644 index bc9019657bc68072e439020da43c0169169eab43..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/SymbolicLink.md +++ /dev/null @@ -1,23 +0,0 @@ -# SymbolicLink - -- `v::symbolicLink()` - -Validates if the given data is a path of a valid symbolic link. - -```php -v::symbolicLink()->validate('/path/of/valid/symbolic/link'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Tld.md b/vendor/respect/validation/docs/Tld.md deleted file mode 100644 index db05452a196958e19b794707740c69487c99d5a2..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Tld.md +++ /dev/null @@ -1,17 +0,0 @@ -# Tld - -- `v::tld()` - -Validates a top-level domain - -```php -v::tld()->validate('com'); // true -v::tld()->validate('ly'); // true -v::tld()->validate('org'); // true -``` - -*** -See also: - - * [Domain](Domain.md) - * [CountryCode](CountryCode.md) diff --git a/vendor/respect/validation/docs/TrueVal.md b/vendor/respect/validation/docs/TrueVal.md deleted file mode 100644 index 59869d200419e5db273de2f4fa7c6bb30847dbd7..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/TrueVal.md +++ /dev/null @@ -1,21 +0,0 @@ -# TrueVal - -- `v::trueVal()` - -Validates if a value is considered as `true`. - -```php -v::trueVal()->validate(true); // true -v::trueVal()->validate(1); // true -v::trueVal()->validate('1'); // true -v::trueVal()->validate('true'); // true -v::trueVal()->validate('on'); // true -v::trueVal()->validate('yes'); // true -v::trueVal()->validate('0.5'); // false -v::trueVal()->validate('2'); // false -``` - -*** -See also: - - * [FalseVal](FalseVal.md) diff --git a/vendor/respect/validation/docs/Type.md b/vendor/respect/validation/docs/Type.md deleted file mode 100644 index 50f2abb9f9a75a2e1fa087a69b38274ad45d8631..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Type.md +++ /dev/null @@ -1,31 +0,0 @@ -# Type - -- `v::type(string $type)` - -Validates the type of input. - -```php -v::type('bool')->validate(true); // true -v::type('callable')->validate(function (){}); // true -v::type('object')->validate(new stdClass()); // true -``` - -*** -See also: - - * [ArrayVal](ArrayVal.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [Finite](Finite.md) - * [FloatType](FloatType.md) - * [FloatVal](FloatVal.md) - * [Infinite](Infinite.md) - * [Instance](Instance.md) - * [IntType](IntType.md) - * [IntVal](IntVal.md) - * [NullType](NullType.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [ScalarVal](ScalarVal.md) - * [StringType](StringType.md) - * [Type](Type.md) diff --git a/vendor/respect/validation/docs/Uploaded.md b/vendor/respect/validation/docs/Uploaded.md deleted file mode 100644 index 774f9bb8216835034c4fa9c02263dfe2c9f898f5..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Uploaded.md +++ /dev/null @@ -1,23 +0,0 @@ -# Uploaded - -- `v::uploaded()` - -Validates if the given data is a file that was uploaded via HTTP POST. - -```php -v::uploaded()->validate('/path/of/an/uploaded/file'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Writable](Writable.md) diff --git a/vendor/respect/validation/docs/Uppercase.md b/vendor/respect/validation/docs/Uppercase.md deleted file mode 100644 index 1dff7acf584a5ee43724526f6ff729879521ef2e..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Uppercase.md +++ /dev/null @@ -1,14 +0,0 @@ -# Uppercase - -- `v::uppercase()` - -Validates if string characters are uppercase in the input: - -```php -v::stringType()->uppercase()->validate('W3C'); // true -``` - -*** -See also: - - * [Lowercase](Lowercase.md) diff --git a/vendor/respect/validation/docs/Url.md b/vendor/respect/validation/docs/Url.md deleted file mode 100644 index 5638cf55f4b364edceea324d80904c3f87ce3178..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Url.md +++ /dev/null @@ -1,24 +0,0 @@ -# Url - -- `v::url()` - -Validates if input is an URL: - -```php -v::url()->validate('http://example.com'); // true -v::url()->validate('https://www.youtube.com/watch?v=6FOUqQt3Kg0'); // true -v::url()->validate('ldap://[::1]'); // true -v::url()->validate('mailto:john.doe@example.com'); // true -v::url()->validate('news:new.example.com'); // true -``` - -This rule uses [FilterVar](FilterVar.md) - -*** -See also: - - * [Domain](Domain.md) - * [Email](Email.md) - * [FilterVar](FilterVar.md) - * [Phone](Phone.md) - * [VideoUrl](VideoUrl.md) diff --git a/vendor/respect/validation/docs/VALIDATORS.md b/vendor/respect/validation/docs/VALIDATORS.md deleted file mode 100644 index 4804cbee39d14c11fbdd5325884fbd9399c06964..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/VALIDATORS.md +++ /dev/null @@ -1,338 +0,0 @@ -# Validators - -## Types - - * [ArrayVal](ArrayVal.md) - * [ArrayType](ArrayType.md) - * [BoolVal](BoolVal.md) - * [BoolType](BoolType.md) - * [CallableType](CallableType.md) - * [Countable](Countable.md) - * [Date](Date.md) - * [FalseVal](FalseVal.md) - * [FloatVal](FloatVal.md) - * [FloatType](FloatType.md) - * [Instance](Instance.md) - * [IntVal](IntVal.md) - * [IntType](IntType.md) - * [IterableType](IterableType.md) - * [NullType](NullType.md) - * [Numeric](Numeric.md) - * [ObjectType](ObjectType.md) - * [ResourceType](ResourceType.md) - * [ScalarVal](ScalarVal.md) - * [StringType](StringType.md) - * [TrueVal](TrueVal.md) - * [Type](Type.md) - * [Xdigit](Xdigit.md) - -## Generics - - * [AlwaysInvalid](AlwaysInvalid.md) - * [AlwaysValid](AlwaysValid.md) - * [Call](Call.md) - * [Callback](Callback.md) - * [FilterVar](FilterVar.md) - * [Not](Not.md) - * [Optional](Optional.md) - * [Type](Type.md) - * [When](When.md) - -## Comparing Values - - * [Age](Age.md) - * [Between](Between.md) - * [Equals](Equals.md) - * [Identical](Identical.md) - * [Max](Max.md) - * [Min](Min.md) - -## Numeric - - * [Between](Between.md) - * [BoolType](BoolType.md) - * [Even](Even.md) - * [Factor](Factor.md) - * [Fibonacci](Fibonacci.md) - * [Finite](Finite.md) - * [FloatVal](FloatVal.md) - * [FloatType](FloatType.md) - * [Infinite](Infinite.md) - * [IntVal](IntVal.md) - * [IntType](IntType.md) - * [Multiple](Multiple.md) - * [Negative](Negative.md) - * [NotEmpty](NotEmpty.md) - * [Numeric](Numeric.md) - * [Odd](Odd.md) - * [PerfectSquare](PerfectSquare.md) - * [Positive](Positive.md) - * [PrimeNumber](PrimeNumber.md) - * [Roman](Roman.md) - * [Xdigit](Xdigit.md) - -## String - - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [Between](Between.md) - * [Charset](Charset.md) - * [Cntrl](Cntrl.md) - * [Consonant](Consonant.md) - * [Contains](Contains.md) - * [Digit](Digit.md) - * [EndsWith](EndsWith.md) - * [Graph](Graph.md) - * [In](In.md) - * [Length](Length.md) - * [Lowercase](Lowercase.md) - * [NotEmpty](NotEmpty.md) - * [NoWhitespace](NoWhitespace.md) - * [PhpLabel](PhpLabel.md) - * [Prnt](Prnt.md) - * [Punct](Punct.md) - * [Regex](Regex.md) - * [ResourceType](ResourceType.md) - * [Slug](Slug.md) - * [Space](Space.md) - * [StartsWith](StartsWith.md) - * [Uppercase](Uppercase.md) - * [Version](Version.md) - * [Vowel](Vowel.md) - * [Xdigit](Xdigit.md) - -## Arrays - - * [ArrayVal](ArrayVal.md) - * [ArrayType](ArrayType.md) - * [Contains](Contains.md) - * [Each](Each.md) - * [EndsWith](EndsWith.md) - * [In](In.md) - * [Key](Key.md) - * [KeyNested](KeyNested.md) - * [KeySet](KeySet.md) - * [KeyValue](KeyValue.md) - * [Length](Length.md) - * [NotEmpty](NotEmpty.md) - * [StartsWith](StartsWith.md) - -## Objects - - * [Attribute](Attribute.md) - * [Instance](Instance.md) - * [Length](Length.md) - -## Date and Time - - * [Age](Age.md) - * [Between](Between.md) - * [Date](Date.md) - * [LeapDate](LeapDate.md) - * [LeapYear](LeapYear.md) - * [MinimumAge](MinimumAge.md) - -## Group Validators - - * [AllOf](AllOf.md) - * [NoneOf](NoneOf.md) - * [OneOf](OneOf.md) - -## Regional - - * [CountryCode](CountryCode.md) - * [CurrencyCode](CurrencyCode.md) - * [IdentityCard](IdentityCard.md) - * [LanguageCode](LanguageCode.md) - * [PostalCode](PostalCode.md) - * [SubdivisionCode](SubdivisionCode.md) - * [Tld](Tld.md) - -## Files - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Image](Image.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) - * [Writable](Writable.md) - -## Banking - - * [Bank](Bank.md) - * [BankAccount](BankAccount.md) - * [Bic](Bic.md) - -## Other - - * [Bsn](Bsn.md) - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cpf](Cpf.md) - * [Domain](Domain.md) - * [Email](Email.md) - * [HexRgbColor](HexRgbColor.md) - * [Imei](Imei.md) - * [Ip](Ip.md) - * [Json](Json.md) - * [MacAddress](MacAddress.md) - * [NfeAccessKey](NfeAccessKey.md) - * [NotBlank](NotBlank.md) - * [NotOptional](NotOptional.md) - * [Pesel](Pesel.md) - * [Phone](Phone.md) - * [Sf](Sf.md) - * [Url](Url.md) - * [VideoUrl](VideoUrl.md) - * [Zend](Zend.md) - -## Yes/No - - * [No](No.md) - * [Yes](Yes.md) - -## Alphabetically - - * [Age](Age.md) - * [AllOf](AllOf.md) - * [Alnum](Alnum.md) - * [Alpha](Alpha.md) - * [AlwaysInvalid](AlwaysInvalid.md) - * [AlwaysValid](AlwaysValid.md) - * [ArrayVal](ArrayVal.md) - * [ArrayType](ArrayType.md) - * [Attribute](Attribute.md) - * [Bank](Bank.md) - * [BankAccount](BankAccount.md) - * [Between](Between.md) - * [Bic](Bic.md) - * [BoolType](BoolType.md) - * [Bsn](Bsn.md) - * [Call](Call.md) - * [CallableType](CallableType.md) - * [Callback](Callback.md) - * [Charset](Charset.md) - * [Cnh](Cnh.md) - * [Cnpj](Cnpj.md) - * [Cntrl](Cntrl.md) - * [Consonant](Consonant.md) - * [Contains](Contains.md) - * [Countable](Countable.md) - * [CountryCode](CountryCode.md) - * [Cpf](Cpf.md) - * [CreditCard](CreditCard.md) - * [Date](Date.md) - * [Digit](Digit.md) - * [Directory](Directory.md) - * [Domain](Domain.md) - * [Each](Each.md) - * [Email](Email.md) - * [EndsWith](EndsWith.md) - * [Equals](Equals.md) - * [Even](Even.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [Factor](Factor.md) - * [FalseVal](FalseVal.md) - * [Fibonacci](Fibonacci.md) - * [File](File.md) - * [FilterVar](FilterVar.md) - * [Finite](Finite.md) - * [FloatVal](FloatVal.md) - * [FloatType](FloatType.md) - * [Graph](Graph.md) - * [HexRgbColor](HexRgbColor.md) - * [Identical](Identical.md) - * [IdentityCard](IdentityCard.md) - * [Image](Image.md) - * [Imei](Imei.md) - * [In](In.md) - * [Infinite](Infinite.md) - * [Instance](Instance.md) - * [IntVal](IntVal.md) - * [IntType](IntType.md) - * [Ip](Ip.md) - * [IterableType](IterableType.md) - * [Json](Json.md) - * [Key](Key.md) - * [KeyNested](KeyNested.md) - * [KeySet](KeySet.md) - * [KeyValue](KeyValue.md) - * [LanguageCode](LanguageCode.md) - * [LeapDate](LeapDate.md) - * [LeapYear](LeapYear.md) - * [Length](Length.md) - * [Lowercase](Lowercase.md) - * [MacAddress](MacAddress.md) - * [Max](Max.md) - * [Mimetype](Mimetype.md) - * [Min](Min.md) - * [MinimumAge](MinimumAge.md) - * [Multiple](Multiple.md) - * [Negative](Negative.md) - * [NfeAccessKey](NfeAccessKey.md) - * [No](No.md) - * [NoWhitespace](NoWhitespace.md) - * [NoneOf](NoneOf.md) - * [Not](Not.md) - * [NotBlank](NotBlank.md) - * [NotEmpty](NotEmpty.md) - * [NotOptional](NotOptional.md) - * [NullType](NullType.md) - * [Numeric](Numeric.md) - * [ObjectType](ObjectType.md) - * [Odd](Odd.md) - * [OneOf](OneOf.md) - * [Optional](Optional.md) - * [PerfectSquare](PerfectSquare.md) - * [Pesel](Pesel.md) - * [Phone](Phone.md) - * [PhpLabel](PhpLabel.md) - * [Positive](Positive.md) - * [PostalCode](PostalCode.md) - * [PrimeNumber](PrimeNumber.md) - * [Prnt](Prnt.md) - * [Punct](Punct.md) - * [Readable](Readable.md) - * [Regex](Regex.md) - * [ResourceType](ResourceType.md) - * [Roman](Roman.md) - * [ScalarVal](ScalarVal.md) - * [Sf](Sf.md) - * [Size](Size.md) - * [Slug](Slug.md) - * [Space](Space.md) - * [StartsWith](StartsWith.md) - * [StringType](StringType.md) - * [SubdivisionCode](SubdivisionCode.md) - * [SymbolicLink](SymbolicLink.md) - * [Tld](Tld.md) - * [TrueVal](TrueVal.md) - * [Type](Type.md) - * [Uploaded](Uploaded.md) - * [Uppercase](Uppercase.md) - * [Url](Url.md) - * [Version](Version.md) - * [VideoUrl](VideoUrl.md) - * [Vowel](Vowel.md) - * [When](When.md) - * [Writable](Writable.md) - * [Xdigit](Xdigit.md) - * [Yes](Yes.md) - * [Zend](Zend.md) - -*** -See also: - -- [Contributing](../CONTRIBUTING.md) -- [Feature Guide](README.md) -- [Installation](INSTALL.md) -- [License](../LICENSE.md) -- [Changelog](../CHANGELOG.md) diff --git a/vendor/respect/validation/docs/Version.md b/vendor/respect/validation/docs/Version.md deleted file mode 100644 index aad3ce8a3d02bc333d3bff0c11a9b359a67c66c7..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Version.md +++ /dev/null @@ -1,16 +0,0 @@ -# Version - -- `v::version()` - -Validates version numbers using Semantic Versioning. - -```php -v::version()->validate('1.0.0'); -``` - -*** -See also: - - * [Equals](Equals.md) - * [Regex](Regex.md) - * [Roman](Roman.md) diff --git a/vendor/respect/validation/docs/VideoUrl.md b/vendor/respect/validation/docs/VideoUrl.md deleted file mode 100644 index 1ef962793bdc6082f57ad70d42f059a06095ca5a..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/VideoUrl.md +++ /dev/null @@ -1,35 +0,0 @@ -# VideoUrl - -- `v::videoUrl()` -- `v::videoUrl(string $service)` - -Validates if the input is a video URL value: - -```php -v::videoUrl()->validate('https://player.vimeo.com/video/71787467'); // true -v::videoUrl()->validate('https://vimeo.com/71787467'); // true -v::videoUrl()->validate('https://www.youtube.com/embed/netHLn9TScY'); // true -v::videoUrl()->validate('https://www.youtube.com/watch?v=netHLn9TScY'); // true -v::videoUrl()->validate('https://youtu.be/netHLn9TScY'); // true - -v::videoUrl('youtube')->validate('https://www.youtube.com/watch?v=netHLn9TScY'); // true -v::videoUrl('vimeo')->validate('https://vimeo.com/71787467'); // true - -v::videoUrl()->validate('https://youtube.com'); // false -v::videoUrl('youtube')->validate('https://vimeo.com/71787467'); // false -``` - -The services accepted are: - -- YouTube -- Vimeo - -The `$service` value is not case-sensitive. - -Message template for this validator includes `{{service}}`. - - -*** -See also: - - * [Url](Url.md) diff --git a/vendor/respect/validation/docs/Vowel.md b/vendor/respect/validation/docs/Vowel.md deleted file mode 100644 index 98d806f5d90b39658d61d9e69dec3d86b5330e2f..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Vowel.md +++ /dev/null @@ -1,17 +0,0 @@ -# Vowel - -- `v::vowel()` - -Similar to `v::alnum()`. Validates strings that contains only vowels: - -```php -v::vowel()->validate('aei'); // true -``` - -*** -See also: - - * [Alnum](Alnum.md) - * [Digit](Digit.md) - * [Alpha](Alpha.md) - * [Consonant](Consonant.md) diff --git a/vendor/respect/validation/docs/When.md b/vendor/respect/validation/docs/When.md deleted file mode 100644 index 6254cb34d991733bd29c9b2281bad838f362a24e..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/When.md +++ /dev/null @@ -1,24 +0,0 @@ -# When - -- `v::when(v $if, v $then, v $else)` -- `v::when(v $if, v $then)` - -A ternary validator that accepts three parameters. - -When the `$if` validates, returns validation for `$then`. -When the `$if` doesn't validate, returns validation for `$else`, if defined. - -```php -v::when(v::intVal(), v::positive(), v::notEmpty())->validate($input); -``` - -In the sample above, if `$input` is an integer, then it must be positive. -If `$input` is not an integer, then it must not me empty. -When `$else` is not defined use [AlwaysInvalid](AlwaysInvalid.md) - -*** -See also: - - * [AllOf](AllOf.md) - * [OneOf](OneOf.md) - * [NoneOf](NoneOf.md) diff --git a/vendor/respect/validation/docs/Writable.md b/vendor/respect/validation/docs/Writable.md deleted file mode 100644 index b7aa5e436534c6fee4bdf42b5fdafefc7494b08f..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Writable.md +++ /dev/null @@ -1,23 +0,0 @@ -# Writable - -- `v::writable()` - -Validates if the given input is writable file. - -```php -v::writable()->validate('/path/of/a/writable/file'); // true -``` - -*** -See also: - - * [Directory](Directory.md) - * [Executable](Executable.md) - * [Exists](Exists.md) - * [Extension](Extension.md) - * [File](File.md) - * [Mimetype](Mimetype.md) - * [Readable](Readable.md) - * [Size](Size.md) - * [SymbolicLink](SymbolicLink.md) - * [Uploaded](Uploaded.md) diff --git a/vendor/respect/validation/docs/Xdigit.md b/vendor/respect/validation/docs/Xdigit.md deleted file mode 100644 index 9e79d0fdfc6b52ac263f8748ce5dc03c778c9c81..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Xdigit.md +++ /dev/null @@ -1,22 +0,0 @@ -# Xdigit - -- `v::xdigit()` - -Accepts an hexadecimal number: - -```php -v::xdigit()->validate('abc123'); // true -``` - -Notice, however, that it doesn't accept strings starting with 0x: - -```php -v::xdigit()->validate('0x1f'); // false -``` - -*** -See also: - - * [Digit](Digit.md) - * [Alnum](Alnum.md) - * [HexRgbColor](HexRgbColor.md) diff --git a/vendor/respect/validation/docs/Yes.md b/vendor/respect/validation/docs/Yes.md deleted file mode 100644 index 9fef6d8f4d6b0e02e6b9dab619c39451b9f83db6..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Yes.md +++ /dev/null @@ -1,23 +0,0 @@ -# Yes - -- `v::yes()` -- `v::yes(boolean $locale)` - -Validates if value is considered as "Yes". - -```php -v::yes()->validate('Y'); // true -v::yes()->validate('Yea'); // true -v::yes()->validate('Yeah'); // true -v::yes()->validate('Yep'); // true -v::yes()->validate('Yes'); // true -``` - -This rule is case insensitive. - -If `$locale` is TRUE, uses the value of [nl_langinfo()](http://php.net/nl_langinfo) with `YESEXPR` constant. - -*** -See also: - - * [No](No.md) diff --git a/vendor/respect/validation/docs/Zend.md b/vendor/respect/validation/docs/Zend.md deleted file mode 100644 index 8ec0ae8ed7ff8daf197e3ef1b5e42ed594ca2b94..0000000000000000000000000000000000000000 --- a/vendor/respect/validation/docs/Zend.md +++ /dev/null @@ -1,17 +0,0 @@ -# Zend - -- `v::zend(mixed $validator)` - -Use Zend validators inside Respect\Validation flow. Messages -are preserved. - -```php -v::zend('Hostname')->validate('google.com'); -``` - -You must add `"zendframework/zend-validator": "~2.3"` to your `require` property on composer.json file. - -*** -See also: - - * [Sf](Sf.md) diff --git a/vendor/respect/validation/library/Rules/AbstractInterval.php b/vendor/respect/validation/library/Rules/AbstractInterval.php index 5879d992ef0ef1544e73301ed8b1a88c28160bf6..09758633ae1f15a433a6fbd2d1bf08e3a4026bcd 100644 --- a/vendor/respect/validation/library/Rules/AbstractInterval.php +++ b/vendor/respect/validation/library/Rules/AbstractInterval.php @@ -25,6 +25,11 @@ abstract class AbstractInterval extends AbstractRule $this->inclusive = $inclusive; } + protected function isAbleToCompareValues($left, $right) + { + return is_scalar($left) === is_scalar($right); + } + protected function filterInterval($value) { if (!is_string($value) || is_numeric($value) || empty($value)) { diff --git a/vendor/respect/validation/library/Rules/Date.php b/vendor/respect/validation/library/Rules/Date.php index eb47d16db423b9683e04b44cc68e579ac73f0d66..342e1d434fcc73104412f03cf69908e5a7944d90 100644 --- a/vendor/respect/validation/library/Rules/Date.php +++ b/vendor/respect/validation/library/Rules/Date.php @@ -49,8 +49,39 @@ class Date extends AbstractRule $this->format = $exceptionalFormats[$this->format]; } - $info = date_parse_from_format($this->format, $inputString); + return $this->isValidForFormatProvided($input); + } + + private function isValidForFormatProvided($input) + { + $info = date_parse_from_format($this->format, $input); + if (!$this->isParsable($info)) { + return false; + } + + if ($this->hasDateFormat()) { + return $this->hasValidDate($info); + } + + return true; + } + private function isParsable(array $info) + { return ($info['error_count'] === 0 && $info['warning_count'] === 0); } + + private function hasDateFormat() + { + return preg_match('/[djSFmMnYy]/', $this->format) > 0; + } + + private function hasValidDate(array $info) + { + if ($info['day']) { + return checkdate((int) $info['month'], $info['day'], (int) $info['year']); + } + + return checkdate($info['month'] ?: 1, $info['day'] ?: 1, $info['year'] ?: 1); + } } diff --git a/vendor/respect/validation/library/Rules/Email.php b/vendor/respect/validation/library/Rules/Email.php index d6ef31d5cfebfd8616663428276bf297621ea4a6..9de8547ce1bb75dabf71d0086469f19d80b99c08 100644 --- a/vendor/respect/validation/library/Rules/Email.php +++ b/vendor/respect/validation/library/Rules/Email.php @@ -33,9 +33,13 @@ class Email extends AbstractRule public function validate($input) { + if (!is_string($input)) { + return false; + } + $emailValidator = $this->getEmailValidator(); if (!$emailValidator instanceof EmailValidator) { - return is_string($input) && filter_var($input, FILTER_VALIDATE_EMAIL); + return (bool) filter_var($input, FILTER_VALIDATE_EMAIL); } if (!class_exists('Egulias\\EmailValidator\\Validation\\RFCValidation')) { diff --git a/vendor/respect/validation/library/Rules/IntVal.php b/vendor/respect/validation/library/Rules/IntVal.php index 8f8ff81eb48b19fce79eabaa7754b7ec492800bb..e5c89f1f871cc333a0f633f7229c24b649ebed42 100644 --- a/vendor/respect/validation/library/Rules/IntVal.php +++ b/vendor/respect/validation/library/Rules/IntVal.php @@ -19,6 +19,6 @@ class IntVal extends AbstractRule return false; } - return false !== filter_var($input, FILTER_VALIDATE_INT); + return false !== filter_var($input, FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_OCTAL); } } diff --git a/vendor/respect/validation/library/Rules/Max.php b/vendor/respect/validation/library/Rules/Max.php index 2bad580062662d4f118fdcfc5b0b1e5dad99db1f..79d97fbf63ed49328b5285d22c8a1bedf78bf26e 100644 --- a/vendor/respect/validation/library/Rules/Max.php +++ b/vendor/respect/validation/library/Rules/Max.php @@ -15,10 +15,17 @@ class Max extends AbstractInterval { public function validate($input) { + $filteredInput = $this->filterInterval($input); + $filteredInterval = $this->filterInterval($this->interval); + + if (!$this->isAbleToCompareValues($filteredInput, $filteredInterval)) { + return false; + } + if ($this->inclusive) { - return $this->filterInterval($input) <= $this->filterInterval($this->interval); + return $filteredInput <= $filteredInterval; } - return $this->filterInterval($input) < $this->filterInterval($this->interval); + return $filteredInput < $filteredInterval; } } diff --git a/vendor/respect/validation/library/Rules/Min.php b/vendor/respect/validation/library/Rules/Min.php index 994e813ba6c6e94e52a15b0aac7984f257ab7a50..26b5085bda2b98743ebf8bce1d7c129747801bd4 100644 --- a/vendor/respect/validation/library/Rules/Min.php +++ b/vendor/respect/validation/library/Rules/Min.php @@ -15,10 +15,17 @@ class Min extends AbstractInterval { public function validate($input) { + $filteredInput = $this->filterInterval($input); + $filteredInterval = $this->filterInterval($this->interval); + + if (!$this->isAbleToCompareValues($filteredInput, $filteredInterval)) { + return false; + } + if ($this->inclusive) { - return $this->filterInterval($input) >= $this->filterInterval($this->interval); + return $filteredInput >= $filteredInterval; } - return $this->filterInterval($input) > $this->filterInterval($this->interval); + return $filteredInput > $filteredInterval; } } diff --git a/vendor/respect/validation/library/Rules/PostalCode.php b/vendor/respect/validation/library/Rules/PostalCode.php index a2847a730456a5a553379fe7c261c1524d8fab11..a5aa67935e8defbf99660f5cfdf3ae8e1cf28cd8 100644 --- a/vendor/respect/validation/library/Rules/PostalCode.php +++ b/vendor/respect/validation/library/Rules/PostalCode.php @@ -21,157 +21,166 @@ class PostalCode extends Regex * @link http://download.geonames.org/export/dump/countryInfo.txt */ public $postalCodes = [ - 'AD' => "/^(?:AD)*(\d{3})$/", - 'AM' => "/^(\d{6})$/", - 'AR' => "/^([A-Z]\d{4}[A-Z]{3})$/", - 'AT' => "/^(\d{4})$/", - 'AU' => "/^(\d{4})$/", - 'AX' => "/^(?:FI)*(\d{5})$/", - 'AZ' => "/^(?:AZ)*(\d{4})$/", - 'BA' => "/^(\d{5})$/", - 'BB' => "/^(?:BB)*(\d{5})$/", - 'BD' => "/^(\d{4})$/", - 'BE' => "/^(\d{4})$/", - 'BG' => "/^(\d{4})$/", - 'BH' => "/^(\d{3}\d?)$/", - 'BM' => "/^([A-Z]{2}\d{2})$/", - 'BN' => "/^([A-Z]{2}\d{4})$/", - 'BR' => "/^(\d{8}|\d{5}-\d{3})$/", - 'BY' => "/^(\d{6})$/", - 'CA' => "/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]) ?(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$/", - 'CH' => "/^(\d{4})$/", - 'CL' => "/^(\d{7})$/", - 'CN' => "/^(\d{6})$/", - 'CR' => "/^(\d{4})$/", - 'CS' => "/^((\d{5})|(\d{3}\040\d{2}))$/", - 'CU' => "/^(?:CP)*(\d{5})$/", - 'CV' => "/^(\d{4})$/", - 'CX' => "/^(\d{4})$/", - 'CY' => "/^(\d{4})$/", - 'CZ' => "/^(\d{5})$/", - 'DE' => "/^(\d{5})$/", - 'DK' => "/^(\d{4})$/", - 'DO' => "/^(\d{5})$/", - 'DZ' => "/^(\d{5})$/", - 'EC' => "/^([a-zA-Z]\d{4}[a-zA-Z])$/", - 'EE' => "/^(\d{5})$/", - 'EG' => "/^(\d{5})$/", - 'ES' => "/^(\d{5})$/", - 'ET' => "/^(\d{4})$/", - 'FI' => "/^(?:FI)*(\d{5})$/", - 'FM' => "/^(\d{5})$/", - 'FO' => "/^(?:FO)*(\d{3})$/", - 'FR' => "/^(\d{5})$/", + 'AD' => '/^(?:AD)*(\d{3})$/', + 'AL' => '/^(\d{4})$/', + 'AM' => '/^(\d{6})$/', + 'AR' => '/^[A-Z]?\d{4}[A-Z]{0,3}$/', + 'AS' => '/96799/', + 'AT' => '/^(\d{4})$/', + 'AU' => '/^(\d{4})$/', + 'AX' => '/^(?:FI)*(\d{5})$/', + 'AZ' => '/^(?:AZ)*(\d{4})$/', + 'BA' => '/^(\d{5})$/', + 'BB' => '/^(?:BB)*(\d{5})$/', + 'BD' => '/^(\d{4})$/', + 'BE' => '/^(\d{4})$/', + 'BG' => '/^(\d{4})$/', + 'BH' => '/^(\d{3}\d?)$/', + 'BL' => '/^(\d{5})$/', + 'BM' => '/^([A-Z]{2}\d{2})$/', + 'BN' => '/^([A-Z]{2}\d{4})$/', + 'BR' => '/^\d{5}-?\d{3}$/', + 'BY' => '/^(\d{6})$/', + 'CA' => '/^([ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]) ?(\d[ABCEGHJKLMNPRSTVWXYZ]\d)$ /', + 'CH' => '/^(\d{4})$/', + 'CL' => '/^(\d{7})$/', + 'CN' => '/^(\d{6})$/', + 'CO' => '/^(\d{6})$/', + 'CR' => '/^(\d{5})$/', + 'CS' => '/^(\d{5})$/', + 'CU' => '/^(?:CP)*(\d{5})$/', + 'CV' => '/^(\d{4})$/', + 'CX' => '/^(\d{4})$/', + 'CY' => '/^(\d{4})$/', + 'CZ' => '/^\d{3}\s?\d{2}$/', + 'DE' => '/^(\d{5})$/', + 'DK' => '/^(\d{4})$/', + 'DO' => '/^(\d{5})$/', + 'DZ' => '/^(\d{5})$/', + 'EC' => '/^([a-zA-Z]\d{4}[a-zA-Z])$/', + 'EE' => '/^(\d{5})$/', + 'EG' => '/^(\d{5})$/', + 'ES' => '/^(\d{5})$/', + 'ET' => '/^(\d{4})$/', + 'FI' => '/^(?:FI)*(\d{5})$/', + 'FM' => '/^(\d{5})$/', + 'FO' => '/^(?:FO)*(\d{3})$/', + 'FR' => '/^(\d{5})$/', 'GB' => '/^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})$/', - 'GE' => "/^(\d{4})$/", - 'GF' => "/^((97|98)3\d{2})$/", - 'GG' => "/^(([A-Z]\d{2}[A-Z]{2})|([A-Z]\d{3}[A-Z]{2})|([A-Z]{2}\d{2}[A-Z]{2})|([A-Z]{2}\d{3}[A-Z]{2})|([A-Z]\d[A-Z]\d[A-Z]{2})|([A-Z]{2}\d[A-Z]\d[A-Z]{2})|(GIR0AA))$/", - 'GL' => "/^(\d{4})$/", - 'GP' => "/^((97|98)\d{3})$/", - 'GR' => "/^(\d{5})$/", - 'GT' => "/^(\d{5})$/", - 'GU' => "/^(969\d{2})$/", - 'GW' => "/^(\d{4})$/", - 'HN' => "/^([A-Z]{2}\d{4})$/", - 'HR' => "/^(?:HR)*(\d{5})$/", - 'HT' => "/^(?:HT)*(\d{4})$/", - 'HU' => "/^(\d{4})$/", - 'ID' => "/^(\d{5})$/", - 'IL' => "/^(\d{5})$/", - 'IM' => "/^(([A-Z]\d{2}[A-Z]{2})|([A-Z]\d{3}[A-Z]{2})|([A-Z]{2}\d{2}[A-Z]{2})|([A-Z]{2}\d{3}[A-Z]{2})|([A-Z]\d[A-Z]\d[A-Z]{2})|([A-Z]{2}\d[A-Z]\d[A-Z]{2})|(GIR0AA))$/", - 'IN' => "/^(\d{6})$/", - 'IQ' => "/^(\d{5})$/", - 'IR' => "/^(\d{10})$/", - 'IS' => "/^(\d{3})$/", - 'IT' => "/^(\d{5})$/", - 'JE' => "/^(([A-Z]\d{2}[A-Z]{2})|([A-Z]\d{3}[A-Z]{2})|([A-Z]{2}\d{2}[A-Z]{2})|([A-Z]{2}\d{3}[A-Z]{2})|([A-Z]\d[A-Z]\d[A-Z]{2})|([A-Z]{2}\d[A-Z]\d[A-Z]{2})|(GIR0AA))$/", - 'JO' => "/^(\d{5})$/", - 'JP' => "/^(\d{7})$/", - 'KE' => "/^(\d{5})$/", - 'KG' => "/^(\d{6})$/", - 'KH' => "/^(\d{5})$/", - 'KP' => "/^(\d{6})$/", - 'KR' => "/^(?:SEOUL)*(\d{6})$/", - 'KW' => "/^(\d{5})$/", - 'KZ' => "/^(\d{6})$/", - 'LA' => "/^(\d{5})$/", - 'LB' => "/^(\d{4}(\d{4})?)$/", - 'LI' => "/^(\d{4})$/", - 'LK' => "/^(\d{5})$/", - 'LR' => "/^(\d{4})$/", - 'LS' => "/^(\d{3})$/", - 'LT' => "/^(?:LT)*(\d{5})$/", - 'LU' => "/^(\d{4})$/", - 'LV' => "/^(?:LV)*(\d{4})$/", - 'MA' => "/^(\d{5})$/", - 'MC' => "/^(\d{5})$/", - 'MD' => "/^(?:MD)*(\d{4})$/", - 'ME' => "/^(\d{5})$/", - 'MG' => "/^(\d{3})$/", - 'MK' => "/^(\d{4})$/", - 'MM' => "/^(\d{5})$/", - 'MN' => "/^(\d{6})$/", - 'MQ' => "/^(\d{5})$/", - 'MT' => "/^([A-Z]{3}\d{2}\d?)$/", - 'MV' => "/^(\d{5})$/", - 'MX' => "/^(\d{5})$/", - 'MY' => "/^(\d{5})$/", - 'MZ' => "/^(\d{4})$/", - 'NC' => "/^(\d{5})$/", - 'NE' => "/^(\d{4})$/", - 'NF' => "/^(\d{4})$/", - 'NG' => "/^(\d{6})$/", - 'NI' => "/^(\d{7})$/", - 'NL' => "/^(\d{4} ?[A-Z]{2})$/", - 'NO' => "/^(\d{4})$/", - 'NP' => "/^(\d{5})$/", - 'NZ' => "/^(\d{4})$/", - 'OM' => "/^(\d{3})$/", - 'PF' => "/^((97|98)7\d{2})$/", - 'PG' => "/^(\d{3})$/", - 'PH' => "/^(\d{4})$/", - 'PK' => "/^(\d{5})$/", - 'PL' => "/^(\d{2}-\d{3})$/", + 'GE' => '/^(\d{4})$/', + 'GF' => '/^((97|98)3\d{2})$/', + 'GG' => '/^((?:(?:[A-PR-UWYZ][A-HK-Y]\d[ABEHMNPRV-Y0-9]|[A-PR-UWYZ]\d[A-HJKPS-UW0-9])\s\d[ABD-HJLNP-UW-Z]{2})|GIR\s?0AA)$/', + 'GL' => '/^(\d{4})$/', + 'GP' => '/^((97|98)\d{3})$/', + 'GR' => '/^(\d{5})$/', + 'GT' => '/^(\d{5})$/', + 'GU' => '/^(969\d{2})$/', + 'GW' => '/^(\d{4})$/', + 'HN' => '/^([A-Z]{2}\d{4})$/', + 'HR' => '/^(?:HR)*(\d{5})$/', + 'HT' => '/^(?:HT)*(\d{4})$/', + 'HU' => '/^(\d{4})$/', + 'ID' => '/^(\d{5})$/', + 'IE' => '/^[A-Z]\d{2}$|^[A-Z]{3}[A-Z]{4}$/', + 'IL' => '/^(\d{5})$/', + 'IM' => '/^((?:(?:[A-PR-UWYZ][A-HK-Y]\d[ABEHMNPRV-Y0-9]|[A-PR-UWYZ]\d[A-HJKPS-UW0-9])\s\d[ABD-HJLNP-UW-Z]{2})|GIR\s?0AA)$/', + 'IN' => '/^(\d{6})$/', + 'IQ' => '/^(\d{5})$/', + 'IR' => '/^(\d{10})$/', + 'IS' => '/^(\d{3})$/', + 'IT' => '/^(\d{5})$/', + 'JE' => '/^((?:(?:[A-PR-UWYZ][A-HK-Y]\d[ABEHMNPRV-Y0-9]|[A-PR-UWYZ]\d[A-HJKPS-UW0-9])\s\d[ABD-HJLNP-UW-Z]{2})|GIR\s?0AA)$/', + 'JO' => '/^(\d{5})$/', + 'JP' => '/^\d{3}-\d{4}$/', + 'KE' => '/^(\d{5})$/', + 'KG' => '/^(\d{6})$/', + 'KH' => '/^(\d{5})$/', + 'KP' => '/^(\d{6})$/', + 'KR' => '/^(\d{5})$/', + 'KW' => '/^(\d{5})$/', + 'KZ' => '/^(\d{6})$/', + 'LA' => '/^(\d{5})$/', + 'LB' => '/^(\d{4}(\d{4})?)$/', + 'LI' => '/^(\d{4})$/', + 'LK' => '/^(\d{5})$/', + 'LR' => '/^(\d{4})$/', + 'LS' => '/^(\d{3})$/', + 'LT' => '/^(?:LT)*(\d{5})$/', + 'LU' => '/^(?:L-)?\d{4}$/', + 'LV' => '/^(?:LV)*(\d{4})$/', + 'MA' => '/^(\d{5})$/', + 'MC' => '/^(\d{5})$/', + 'MD' => '/^MD-\d{4}$/', + 'ME' => '/^(\d{5})$/', + 'MF' => '/^(\d{5})$/', + 'MG' => '/^(\d{3})$/', + 'MH' => '/^969\d{2}(-\d{4})$/', + 'MK' => '/^(\d{4})$/', + 'MM' => '/^(\d{5})$/', + 'MN' => '/^(\d{6})$/', + 'MP' => '/^9695\d{1}$/', + 'MQ' => '/^(\d{5})$/', + 'MT' => '/^[A-Z]{3}\s?\d{4}$/', + 'MV' => '/^(\d{5})$/', + 'MX' => '/^(\d{5})$/', + 'MY' => '/^(\d{5})$/', + 'MZ' => '/^(\d{4})$/', + 'NC' => '/^(\d{5})$/', + 'NE' => '/^(\d{4})$/', + 'NF' => '/^(\d{4})$/', + 'NG' => '/^(\d{6})$/', + 'NI' => '/^(\d{7})$/', + 'NL' => '/^(\d{4} ?[A-Z]{2})$/', + 'NO' => '/^(\d{4})$/', + 'NP' => '/^(\d{5})$/', + 'NZ' => '/^(\d{4})$/', + 'OM' => '/^(\d{3})$/', + 'PF' => '/^((97|98)7\d{2})$/', + 'PG' => '/^(\d{3})$/', + 'PH' => '/^(\d{4})$/', + 'PK' => '/^(\d{5})$/', + 'PL' => '/^\d{2}-\d{3}$/', 'PM' => '/^(97500)$/', - 'PR' => "/^(\d{9})$/", - 'PT' => "/^(\d{7})$/", + 'PR' => '/^00[679]\d{2}(?:-\d{4})?$/', + 'PT' => '/^\d{4}-?\d{3}$/', 'PW' => '/^(96940)$/', - 'PY' => "/^(\d{4})$/", - 'RE' => "/^((97|98)(4|7|8)\d{2})$/", - 'RO' => "/^(\d{6})$/", - 'RS' => "/^(\d{6})$/", - 'RU' => "/^(\d{6})$/", - 'SA' => "/^(\d{5})$/", - 'SD' => "/^(\d{5})$/", - 'SE' => "/^(?:SE)*(\d{5})$/", - 'SG' => "/^(\d{6})$/", + 'PY' => '/^(\d{4})$/', + 'RE' => '/^((97|98)(4|7|8)\d{2})$/', + 'RO' => '/^(\d{6})$/', + 'RS' => '/^(\d{6})$/', + 'RU' => '/^(\d{6})$/', + 'SA' => '/^(\d{5})$/', + 'SD' => '/^(\d{5})$/', + 'SE' => '/^(?:SE)?\d{3}\s\d{2}$/', + 'SG' => '/^(\d{6})$/', 'SH' => '/^(STHL1ZZ)$/', - 'SI' => "/^(?:SI)*(\d{4})$/", - 'SK' => "/^((\d{5})|(\d{3}\040\d{2}))$/", - 'SM' => "/^(4789\d)$/", - 'SN' => "/^(\d{5})$/", - 'SO' => "/^([A-Z]{2}\d{5})$/", - 'SV' => "/^(?:CP)*(\d{4})$/", - 'SZ' => "/^([A-Z]\d{3})$/", + 'SI' => '/^(?:SI)*(\d{4})$/', + 'SJ' => '/^(\d{4})$/', + 'SK' => '/^\d{3}\s?\d{2}$/', + 'SM' => '/^(4789\d)$/', + 'SN' => '/^(\d{5})$/', + 'SO' => '/^([A-Z]{2}\d{5})$/', + 'SV' => '/^(?:CP)*(\d{4})$/', + 'SZ' => '/^([A-Z]\d{3})$/', 'TC' => '/^(TKCA 1ZZ)$/', - 'TH' => "/^(\d{5})$/", - 'TJ' => "/^(\d{6})$/", - 'TM' => "/^(\d{6})$/", - 'TN' => "/^(\d{4})$/", - 'TR' => "/^(\d{5})$/", - 'TW' => "/^(\d{5})$/", - 'UA' => "/^(\d{5})$/", - 'US' => "/^\d{5}(-\d{4})?$/", - 'UY' => "/^(\d{5})$/", - 'UZ' => "/^(\d{6})$/", - 'VA' => "/^(\d{5})$/", - 'VE' => "/^(\d{4})$/", - 'VI' => "/^\d{5}(-\d{4})?$/", - 'VN' => "/^(\d{6})$/", - 'WF' => "/^(986\d{2})$/", - 'YT' => "/^(\d{5})$/", - 'ZA' => "/^(\d{4})$/", - 'ZM' => "/^(\d{5})$/", + 'TH' => '/^(\d{5})$/', + 'TJ' => '/^(\d{6})$/', + 'TM' => '/^(\d{6})$/', + 'TN' => '/^(\d{4})$/', + 'TR' => '/^(\d{5})$/', + 'TW' => '/^(\d{5})$/', + 'UA' => '/^(\d{5})$/', + 'US' => '/^\d{5}(-\d{4})?$/', + 'UY' => '/^(\d{5})$/', + 'UZ' => '/^(\d{6})$/', + 'VA' => '/^(\d{5})$/', + 'VE' => '/^(\d{4})$/', + 'VI' => '/^008\d{2}(?:-\d{4})?$/', + 'VN' => '/^(\d{6})$/', + 'WF' => '/^(986\d{2})$/', + 'YT' => '/^(\d{5})$/', + 'ZA' => '/^(\d{4})$/', + 'ZM' => '/^(\d{5})$/', ]; public $countryCode; diff --git a/vendor/respect/validation/library/Rules/Tld.php b/vendor/respect/validation/library/Rules/Tld.php index 3c10223323c8363aece34832034f26ca995f19d6..fe53ad898ef3dd6413a367011b549a539cd1e397 100644 --- a/vendor/respect/validation/library/Rules/Tld.php +++ b/vendor/respect/validation/library/Rules/Tld.php @@ -14,109 +14,230 @@ namespace Respect\Validation\Rules; class Tld extends AbstractRule { protected $tldList = [ - //generic - http://en.wikipedia.org/wiki/Generic_top-level_domain - 'aero', 'asia', 'biz', 'cat', 'com', 'coop', 'edu', 'gov', 'info', - 'int', 'jobs', 'mil', 'mobi', 'museum', 'name', 'net', 'org', 'post', 'pro', - 'tel', 'travel', 'xxx', 'ninja', 'abb', 'abbott', 'abogado', 'academy', - 'accenture', 'accountant', 'accountants', 'active', 'actor', 'ads', 'adult', - 'aeg', 'afl', 'agency', 'aig', 'airforce', 'allfinanz', 'alsace', 'amsterdam', - 'an', 'android', 'apartments', 'app', 'aquarelle', 'archi', 'army', 'arpa', - 'associates', 'attorney', 'auction', 'audio', 'auto', 'autos', 'axa', 'azure', - 'band', 'bank', 'bar', 'barclaycard', 'barclays', 'bargains', 'bauhaus', - 'bayern', 'bbc', 'bbva', 'beer', 'berlin', 'best', 'bharti', 'bible', 'bid', - 'bike', 'bing', 'bingo', 'bio', 'black', 'blackfriday', 'bloomberg', 'blue', - 'bmw', 'bnl', 'bnpparibas', 'boats', 'bond', 'boo', 'boutique', 'bradesco', - 'bridgestone', 'broker', 'brother', 'brussels', 'budapest', 'build', 'builders', - 'business', 'buzz', 'bv', 'bzh', 'cab', 'cafe', 'cal', 'camera', 'camp', - 'cancerresearch', 'canon', 'capetown', 'capital', 'caravan', 'cards', - 'care', 'career', 'careers', 'cars', 'cartier', 'casa', 'cash', 'casino', - 'catering', 'cba', 'cbn', 'center', 'ceo', 'cern', 'cfa', 'cfd', 'channel', - 'chat', 'cheap', 'chloe', 'christmas', 'chrome', 'church', 'cisco', 'citic', - 'city', 'claims', 'cleaning', 'click', 'clinic', 'clothing', 'cloud', 'club', - 'coach', 'codes', 'coffee', 'college', 'cologne', 'commbank', 'community', - 'company', 'computer', 'condos', 'construction', 'consulting', 'contractors', - 'cooking', 'cool', 'corsica', 'country', 'coupons', 'courses', 'credit', - 'creditcard', 'cricket', 'crown', 'crs', 'cruises', 'cuisinella', 'cw', - 'cymru', 'cyou', 'dabur', 'dad', 'dance', 'date', 'dating', 'datsun', - 'day', 'dclk', 'deals', 'degree', 'delivery', 'democrat', 'dental', 'dentist' - , 'desi', 'design', 'dev', 'diamonds', 'diet', 'digital', 'direct', 'directory', - 'discount', 'dnp', 'docs', 'dog', 'doha', 'domains', 'doosan', 'download', - 'drive', 'durban', 'dvag', 'earth', 'eat', 'education', 'email', 'emerck', - 'energy', 'engineer', 'engineering', 'enterprises', 'epson', 'equipment', - 'erni', 'esq', 'estate', 'eurovision', 'eus', 'events', 'everbank', - 'exchange', 'expert', 'exposed', 'express', 'fail', 'faith', 'fan', 'fans', - 'farm', 'fashion', 'feedback', 'film', 'finance', 'financial', 'firmdale', - 'fish', 'fishing', 'fit', 'fitness', 'flights', 'florist', 'flowers', 'flsmidth', - 'fly', 'foo', 'football', 'forex', 'forsale', 'forum', 'foundation', 'frl', - 'frogans', 'fund', 'furniture', 'futbol', 'fyi', 'gal', 'gallery', 'garden', - 'gbiz', 'gdn', 'gent', 'genting', 'ggee', 'gift', 'gifts', 'gives', 'glass', - 'gle', 'global', 'globo', 'gmail', 'gmo', 'gmx', 'gold', 'goldpoint', 'golf', - 'goo', 'goog', 'google', 'gop', 'graphics', 'gratis', 'green', 'gripe', 'guge', - 'guide', 'guitars', 'guru', 'hamburg', 'hangout', 'haus', 'healthcare', 'help', - 'here', 'hermes', 'hiphop', 'hitachi', 'hiv', 'hockey', 'holdings', 'holiday', - 'homedepot', 'homes', 'honda', 'horse', 'host', 'hosting', 'hoteles', 'hotmail', - 'house', 'how', 'ibm', 'icbc', 'icu', 'ifm', 'immo', 'immobilien', 'industries', - 'infiniti', 'ing', 'ink', 'institute', 'insure', 'international', 'investments', - 'irish', 'iwc', 'java', 'jcb', 'jetzt', 'jewelry', 'jlc', 'jll', 'joburg', 'juegos', - 'kaufen', 'kddi', 'kim', 'kitchen', 'kiwi', 'koeln', 'komatsu', 'krd', 'kred', - 'kyoto', 'lacaixa', 'land', 'lasalle', 'lat', 'latrobe', 'law', 'lawyer', 'lds', - 'lease', 'leclerc', 'legal', 'lgbt', 'liaison', 'lidl', 'life', 'lighting', - 'limited', 'limo', 'link', 'loan', 'loans', 'lol', 'london', 'lotte', 'lotto', - 'love', 'ltda', 'lupin', 'luxe', 'luxury', 'madrid', 'maif', 'maison', 'management', - 'mango', 'market', 'marketing', 'markets', 'marriott', 'mba', 'media', 'meet', - 'melbourne', 'meme', 'memorial', 'men', 'menu', 'miami', 'microsoft', 'mini', 'mma', - 'moda', 'moe', 'monash', 'money', 'montblanc', 'mormon', 'mortgage', 'moscow', - 'motorcycles', 'mov', 'movie', 'movistar', 'mtn', 'mtpc', 'nadex', 'nagoya', 'navy', - 'nec', 'netbank', 'network', 'neustar', 'new', 'news', 'nexus', 'ngo', 'nhk', 'nico', - 'ninja', 'nissan', 'nra', 'nrw', 'ntt', 'nyc', 'office', 'okinawa', 'omega', 'one', - 'ong', 'onl', 'online', 'ooo', 'oracle', 'organic', 'osaka', 'otsuka', 'ovh', 'page', - 'panerai', 'paris', 'partners', 'parts', 'party', 'pharmacy', 'philips', 'photo', - 'photography', 'photos', 'physio', 'piaget', 'pics', 'pictet', 'pictures', 'pink', - 'pizza', 'place', 'play', 'plumbing', 'plus', 'pohl', 'poker', 'porn', 'praxi', - 'press', 'prod', 'productions', 'prof', 'properties', 'property', 'pub', 'qpon', - 'quebec', 'racing', 'realtor', 'realty', 'recipes', 'red', 'redstone', 'rehab', - 'reise', 'reisen', 'reit', 'ren', 'rent', 'rentals', 'repair', 'report', 'republican', - 'rest', 'restaurant', 'review', 'reviews', 'rich', 'ricoh', 'rio', 'rip', 'rocks', - 'rodeo', 'rsvp', 'ruhr', 'run', 'ryukyu', 'saarland', 'sakura', 'sale', 'samsung', - 'sandvik', 'sandvikcoromant', 'sap', 'sarl', 'saxo', 'sca', 'scb', 'schmidt', - 'scholarships', 'school', 'schule', 'schwarz', 'science', 'scor', 'scot', 'seat', - 'sener', 'services', 'sew', 'sex', 'sexy', 'shiksha', 'shoes', 'show', 'shriram', - 'singles', 'site', 'sj', 'ski', 'sky', 'skype', 'sncf', 'soccer', 'social', - 'software', 'sohu', 'solar', 'solutions', 'sony', 'soy', 'space', 'spiegel', - 'spreadbetting', 'starhub', 'statoil', 'studio', 'study', 'style', 'sucks', 'supplies', - 'supply', 'support', 'surf', 'surgery', 'suzuki', 'swatch', 'swiss', 'sx', 'sydney', - 'systems', 'taipei', 'tatar', 'tattoo', 'tax', 'taxi', 'team', 'tech', 'technology', - 'telefonica', 'temasek', 'tennis', 'thd', 'theater', 'tickets', 'tienda', 'tips', - 'tires', 'tirol', 'today', 'tokyo', 'tools', 'top', 'toray', 'toshiba', 'tours', - 'town', 'toys', 'trade', 'trading', 'training', 'trust', 'tui', 'university', 'uno', - 'uol', 'vacations', 'vegas', 'ventures', 'versicherung', 'vet', 'viajes', 'video', - 'villas', 'vision', 'vista', 'vistaprint', 'vlaanderen', 'vodka', 'vote', 'voting', - 'voto', 'voyage', 'wales', 'walter', 'wang', 'watch', 'webcam', 'website', 'wed', - 'wedding', 'weir', 'whoswho', 'wien', 'wiki', 'williamhill', 'win', 'windows', - 'wme', 'work', 'works', 'world', 'wtc', 'wtf', 'xbox', 'xerox', 'xin', 'xyz', - 'yachts', 'yandex', 'yodobashi', 'yoga', 'yokohama', 'youtube', 'zip', 'zone', 'zuerich', - //country - 'ac', 'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'ao', 'aq', 'ar', 'as', - 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', - 'bi', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bw', 'by', 'bz', - 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', - 'cr', 'cs', 'cu', 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', - 'dz', 'ec', 'ee', 'eg', 'er', 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', - 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', 'gh', 'gi', 'gl', 'gm', - 'gn', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', 'hm', 'hn', - 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'io', 'iq', 'ir', 'is', - 'it', 'je', 'jm', 'jo', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', - 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', - 'lu', 'lv', 'ly', 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mk', 'ml', 'mm', - 'mn', 'mo', 'mp', 'mq', 'mr', 'ms', 'mt', 'mu', 'mv', 'mw', 'mx', 'my', - 'mz', 'na', 'nc', 'ne', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', - 'nz', 'om', 'pa', 'pe', 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', - 'ps', 'pt', 'pw', 'py', 'qa', 're', 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', - 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sk', 'sl', 'sm', 'sn', 'so', - 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tf', 'tg', 'th', 'tj', - 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'tt', 'tv', 'tw', 'tz', 'ua', - 'ug', 'uk', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', - 'wf', 'ws', 'ye', 'yt', 'za', 'zm', 'zw', + // https://data.iana.org/TLD/tlds-alpha-by-domain.txt + // Version 2018100800, Last Updated Mon Oct 8 07:07:01 2018 UTC + 'aaa', 'aarp', 'abarth', 'abb', 'abbott', 'abbvie', 'abc', 'able', + 'abogado', 'abudhabi', 'ac', 'academy', 'accenture', 'accountant', + 'accountants', 'aco', 'active', 'actor', 'ad', 'adac', 'ads', 'adult', + 'ae', 'aeg', 'aero', 'aetna', 'af', 'afamilycompany', 'afl', 'africa', + 'ag', 'agakhan', 'agency', 'ai', 'aig', 'aigo', 'airbus', 'airforce', + 'airtel', 'akdn', 'al', 'alfaromeo', 'alibaba', 'alipay', 'allfinanz', + 'allstate', 'ally', 'alsace', 'alstom', 'am', 'americanexpress', + 'americanfamily', 'amex', 'amfam', 'amica', 'amsterdam', 'analytics', + 'android', 'anquan', 'anz', 'ao', 'aol', 'apartments', 'app', 'apple', + 'aq', 'aquarelle', 'ar', 'arab', 'aramco', 'archi', 'army', 'arpa', + 'art', 'arte', 'as', 'asda', 'asia', 'associates', 'at', 'athleta', + 'attorney', 'au', 'auction', 'audi', 'audible', 'audio', 'auspost', + 'author', 'auto', 'autos', 'avianca', 'aw', 'aws', 'ax', 'axa', 'az', + 'azure', 'ba', 'baby', 'baidu', 'banamex', 'bananarepublic', 'band', + 'bank', 'bar', 'barcelona', 'barclaycard', 'barclays', 'barefoot', + 'bargains', 'baseball', 'basketball', 'bauhaus', 'bayern', 'bb', 'bbc', + 'bbt', 'bbva', 'bcg', 'bcn', 'bd', 'be', 'beats', 'beauty', 'beer', + 'bentley', 'berlin', 'best', 'bestbuy', 'bet', 'bf', 'bg', 'bh', + 'bharti', 'bi', 'bible', 'bid', 'bike', 'bing', 'bingo', 'bio', 'biz', + 'bj', 'black', 'blackfriday', 'blanco', 'blockbuster', 'blog', + 'bloomberg', 'blue', 'bm', 'bms', 'bmw', 'bn', 'bnl', 'bnpparibas', + 'bo', 'boats', 'boehringer', 'bofa', 'bom', 'bond', 'boo', 'book', + 'booking', 'bosch', 'bostik', 'boston', 'bot', 'boutique', 'box', 'br', + 'bradesco', 'bridgestone', 'broadway', 'broker', 'brother', 'brussels', + 'bs', 'bt', 'budapest', 'bugatti', 'build', 'builders', 'business', + 'buy', 'buzz', 'bv', 'bw', 'by', 'bz', 'bzh', 'ca', 'cab', 'cafe', + 'cal', 'call', 'calvinklein', 'cam', 'camera', 'camp', + 'cancerresearch', 'canon', 'capetown', 'capital', 'capitalone', 'car', + 'caravan', 'cards', 'care', 'career', 'careers', 'cars', 'cartier', + 'casa', 'case', 'caseih', 'cash', 'casino', 'cat', 'catering', + 'catholic', 'cba', 'cbn', 'cbre', 'cbs', 'cc', 'cd', 'ceb', 'center', + 'ceo', 'cern', 'cf', 'cfa', 'cfd', 'cg', 'ch', 'chanel', 'channel', + 'charity', 'chase', 'chat', 'cheap', 'chintai', 'christmas', 'chrome', + 'chrysler', 'church', 'ci', 'cipriani', 'circle', 'cisco', 'citadel', + 'citi', 'citic', 'city', 'cityeats', 'ck', 'cl', 'claims', 'cleaning', + 'click', 'clinic', 'clinique', 'clothing', 'cloud', 'club', 'clubmed', + 'cm', 'cn', 'co', 'coach', 'codes', 'coffee', 'college', 'cologne', + 'com', 'comcast', 'commbank', 'community', 'company', 'compare', + 'computer', 'comsec', 'condos', 'construction', 'consulting', + 'contact', 'contractors', 'cooking', 'cookingchannel', 'cool', 'coop', + 'corsica', 'country', 'coupon', 'coupons', 'courses', 'cr', 'credit', + 'creditcard', 'creditunion', 'cricket', 'crown', 'crs', 'cruise', + 'cruises', 'csc', 'cu', 'cuisinella', 'cv', 'cw', 'cx', 'cy', 'cymru', + 'cyou', 'cz', 'dabur', 'dad', 'dance', 'data', 'date', 'dating', + 'datsun', 'day', 'dclk', 'dds', 'de', 'deal', 'dealer', 'deals', + 'degree', 'delivery', 'dell', 'deloitte', 'delta', 'democrat', + 'dental', 'dentist', 'desi', 'design', 'dev', 'dhl', 'diamonds', + 'diet', 'digital', 'direct', 'directory', 'discount', 'discover', + 'dish', 'diy', 'dj', 'dk', 'dm', 'dnp', 'do', 'docs', 'doctor', + 'dodge', 'dog', 'doha', 'domains', 'dot', 'download', 'drive', 'dtv', + 'dubai', 'duck', 'dunlop', 'duns', 'dupont', 'durban', 'dvag', 'dvr', + 'dz', 'earth', 'eat', 'ec', 'eco', 'edeka', 'edu', 'education', 'ee', + 'eg', 'email', 'emerck', 'energy', 'engineer', 'engineering', + 'enterprises', 'epost', 'epson', 'equipment', 'er', 'ericsson', 'erni', + 'es', 'esq', 'estate', 'esurance', 'et', 'etisalat', 'eu', + 'eurovision', 'eus', 'events', 'everbank', 'exchange', 'expert', + 'exposed', 'express', 'extraspace', 'fage', 'fail', 'fairwinds', + 'faith', 'family', 'fan', 'fans', 'farm', 'farmers', 'fashion', 'fast', + 'fedex', 'feedback', 'ferrari', 'ferrero', 'fi', 'fiat', 'fidelity', + 'fido', 'film', 'final', 'finance', 'financial', 'fire', 'firestone', + 'firmdale', 'fish', 'fishing', 'fit', 'fitness', 'fj', 'fk', 'flickr', + 'flights', 'flir', 'florist', 'flowers', 'fly', 'fm', 'fo', 'foo', + 'food', 'foodnetwork', 'football', 'ford', 'forex', 'forsale', 'forum', + 'foundation', 'fox', 'fr', 'free', 'fresenius', 'frl', 'frogans', + 'frontdoor', 'frontier', 'ftr', 'fujitsu', 'fujixerox', 'fun', 'fund', + 'furniture', 'futbol', 'fyi', 'ga', 'gal', 'gallery', 'gallo', + 'gallup', 'game', 'games', 'gap', 'garden', 'gb', 'gbiz', 'gd', 'gdn', + 'ge', 'gea', 'gent', 'genting', 'george', 'gf', 'gg', 'ggee', 'gh', + 'gi', 'gift', 'gifts', 'gives', 'giving', 'gl', 'glade', 'glass', + 'gle', 'global', 'globo', 'gm', 'gmail', 'gmbh', 'gmo', 'gmx', 'gn', + 'godaddy', 'gold', 'goldpoint', 'golf', 'goo', 'goodyear', 'goog', + 'google', 'gop', 'got', 'gov', 'gp', 'gq', 'gr', 'grainger', + 'graphics', 'gratis', 'green', 'gripe', 'grocery', 'group', 'gs', 'gt', + 'gu', 'guardian', 'gucci', 'guge', 'guide', 'guitars', 'guru', 'gw', + 'gy', 'hair', 'hamburg', 'hangout', 'haus', 'hbo', 'hdfc', 'hdfcbank', + 'health', 'healthcare', 'help', 'helsinki', 'here', 'hermes', 'hgtv', + 'hiphop', 'hisamitsu', 'hitachi', 'hiv', 'hk', 'hkt', 'hm', 'hn', + 'hockey', 'holdings', 'holiday', 'homedepot', 'homegoods', 'homes', + 'homesense', 'honda', 'honeywell', 'horse', 'hospital', 'host', + 'hosting', 'hot', 'hoteles', 'hotels', 'hotmail', 'house', 'how', 'hr', + 'hsbc', 'ht', 'hu', 'hughes', 'hyatt', 'hyundai', 'ibm', 'icbc', 'ice', + 'icu', 'id', 'ie', 'ieee', 'ifm', 'ikano', 'il', 'im', 'imamat', + 'imdb', 'immo', 'immobilien', 'in', 'inc', 'industries', 'infiniti', + 'info', 'ing', 'ink', 'institute', 'insurance', 'insure', 'int', + 'intel', 'international', 'intuit', 'investments', 'io', 'ipiranga', + 'iq', 'ir', 'irish', 'is', 'iselect', 'ismaili', 'ist', 'istanbul', + 'it', 'itau', 'itv', 'iveco', 'jaguar', 'java', 'jcb', 'jcp', 'je', + 'jeep', 'jetzt', 'jewelry', 'jio', 'jll', 'jm', 'jmp', 'jnj', 'jo', + 'jobs', 'joburg', 'jot', 'joy', 'jp', 'jpmorgan', 'jprs', 'juegos', + 'juniper', 'kaufen', 'kddi', 'ke', 'kerryhotels', 'kerrylogistics', + 'kerryproperties', 'kfh', 'kg', 'kh', 'ki', 'kia', 'kim', 'kinder', + 'kindle', 'kitchen', 'kiwi', 'km', 'kn', 'koeln', 'komatsu', 'kosher', + 'kp', 'kpmg', 'kpn', 'kr', 'krd', 'kred', 'kuokgroup', 'kw', 'ky', + 'kyoto', 'kz', 'la', 'lacaixa', 'ladbrokes', 'lamborghini', 'lamer', + 'lancaster', 'lancia', 'lancome', 'land', 'landrover', 'lanxess', + 'lasalle', 'lat', 'latino', 'latrobe', 'law', 'lawyer', 'lb', 'lc', + 'lds', 'lease', 'leclerc', 'lefrak', 'legal', 'lego', 'lexus', 'lgbt', + 'li', 'liaison', 'lidl', 'life', 'lifeinsurance', 'lifestyle', + 'lighting', 'like', 'lilly', 'limited', 'limo', 'lincoln', 'linde', + 'link', 'lipsy', 'live', 'living', 'lixil', 'lk', 'llc', 'loan', + 'loans', 'locker', 'locus', 'loft', 'lol', 'london', 'lotte', 'lotto', + 'love', 'lpl', 'lplfinancial', 'lr', 'ls', 'lt', 'ltd', 'ltda', 'lu', + 'lundbeck', 'lupin', 'luxe', 'luxury', 'lv', 'ly', 'ma', 'macys', + 'madrid', 'maif', 'maison', 'makeup', 'man', 'management', 'mango', + 'map', 'market', 'marketing', 'markets', 'marriott', 'marshalls', + 'maserati', 'mattel', 'mba', 'mc', 'mckinsey', 'md', 'me', 'med', + 'media', 'meet', 'melbourne', 'meme', 'memorial', 'men', 'menu', + 'merckmsd', 'metlife', 'mg', 'mh', 'miami', 'microsoft', 'mil', 'mini', + 'mint', 'mit', 'mitsubishi', 'mk', 'ml', 'mlb', 'mls', 'mm', 'mma', + 'mn', 'mo', 'mobi', 'mobile', 'mobily', 'moda', 'moe', 'moi', 'mom', + 'monash', 'money', 'monster', 'mopar', 'mormon', 'mortgage', 'moscow', + 'moto', 'motorcycles', 'mov', 'movie', 'movistar', 'mp', 'mq', 'mr', + 'ms', 'msd', 'mt', 'mtn', 'mtr', 'mu', 'museum', 'mutual', 'mv', 'mw', + 'mx', 'my', 'mz', 'na', 'nab', 'nadex', 'nagoya', 'name', 'nationwide', + 'natura', 'navy', 'nba', 'nc', 'ne', 'nec', 'net', 'netbank', + 'netflix', 'network', 'neustar', 'new', 'newholland', 'news', 'next', + 'nextdirect', 'nexus', 'nf', 'nfl', 'ng', 'ngo', 'nhk', 'ni', 'nico', + 'nike', 'nikon', 'ninja', 'nissan', 'nissay', 'nl', 'no', 'nokia', + 'northwesternmutual', 'norton', 'now', 'nowruz', 'nowtv', 'np', 'nr', + 'nra', 'nrw', 'ntt', 'nu', 'nyc', 'nz', 'obi', 'observer', 'off', + 'office', 'okinawa', 'olayan', 'olayangroup', 'oldnavy', 'ollo', 'om', + 'omega', 'one', 'ong', 'onl', 'online', 'onyourside', 'ooo', 'open', + 'oracle', 'orange', 'org', 'organic', 'origins', 'osaka', 'otsuka', + 'ott', 'ovh', 'pa', 'page', 'panasonic', 'paris', 'pars', 'partners', + 'parts', 'party', 'passagens', 'pay', 'pccw', 'pe', 'pet', 'pf', + 'pfizer', 'pg', 'ph', 'pharmacy', 'phd', 'philips', 'phone', 'photo', + 'photography', 'photos', 'physio', 'piaget', 'pics', 'pictet', + 'pictures', 'pid', 'pin', 'ping', 'pink', 'pioneer', 'pizza', 'pk', + 'pl', 'place', 'play', 'playstation', 'plumbing', 'plus', 'pm', 'pn', + 'pnc', 'pohl', 'poker', 'politie', 'porn', 'post', 'pr', 'pramerica', + 'praxi', 'press', 'prime', 'pro', 'prod', 'productions', 'prof', + 'progressive', 'promo', 'properties', 'property', 'protection', 'pru', + 'prudential', 'ps', 'pt', 'pub', 'pw', 'pwc', 'py', 'qa', 'qpon', + 'quebec', 'quest', 'qvc', 'racing', 'radio', 'raid', 're', 'read', + 'realestate', 'realtor', 'realty', 'recipes', 'red', 'redstone', + 'redumbrella', 'rehab', 'reise', 'reisen', 'reit', 'reliance', 'ren', + 'rent', 'rentals', 'repair', 'report', 'republican', 'rest', + 'restaurant', 'review', 'reviews', 'rexroth', 'rich', 'richardli', + 'ricoh', 'rightathome', 'ril', 'rio', 'rip', 'rmit', 'ro', 'rocher', + 'rocks', 'rodeo', 'rogers', 'room', 'rs', 'rsvp', 'ru', 'rugby', + 'ruhr', 'run', 'rw', 'rwe', 'ryukyu', 'sa', 'saarland', 'safe', + 'safety', 'sakura', 'sale', 'salon', 'samsclub', 'samsung', 'sandvik', + 'sandvikcoromant', 'sanofi', 'sap', 'sarl', 'sas', 'save', 'saxo', + 'sb', 'sbi', 'sbs', 'sc', 'sca', 'scb', 'schaeffler', 'schmidt', + 'scholarships', 'school', 'schule', 'schwarz', 'science', 'scjohnson', + 'scor', 'scot', 'sd', 'se', 'search', 'seat', 'secure', 'security', + 'seek', 'select', 'sener', 'services', 'ses', 'seven', 'sew', 'sex', + 'sexy', 'sfr', 'sg', 'sh', 'shangrila', 'sharp', 'shaw', 'shell', + 'shia', 'shiksha', 'shoes', 'shop', 'shopping', 'shouji', 'show', + 'showtime', 'shriram', 'si', 'silk', 'sina', 'singles', 'site', 'sj', + 'sk', 'ski', 'skin', 'sky', 'skype', 'sl', 'sling', 'sm', 'smart', + 'smile', 'sn', 'sncf', 'so', 'soccer', 'social', 'softbank', + 'software', 'sohu', 'solar', 'solutions', 'song', 'sony', 'soy', + 'space', 'spiegel', 'sport', 'spot', 'spreadbetting', 'sr', 'srl', + 'srt', 'st', 'stada', 'staples', 'star', 'starhub', 'statebank', + 'statefarm', 'stc', 'stcgroup', 'stockholm', 'storage', 'store', + 'stream', 'studio', 'study', 'style', 'su', 'sucks', 'supplies', + 'supply', 'support', 'surf', 'surgery', 'suzuki', 'sv', 'swatch', + 'swiftcover', 'swiss', 'sx', 'sy', 'sydney', 'symantec', 'systems', + 'sz', 'tab', 'taipei', 'talk', 'taobao', 'target', 'tatamotors', + 'tatar', 'tattoo', 'tax', 'taxi', 'tc', 'tci', 'td', 'tdk', 'team', + 'tech', 'technology', 'tel', 'telefonica', 'temasek', 'tennis', 'teva', + 'tf', 'tg', 'th', 'thd', 'theater', 'theatre', 'tiaa', 'tickets', + 'tienda', 'tiffany', 'tips', 'tires', 'tirol', 'tj', 'tjmaxx', 'tjx', + 'tk', 'tkmaxx', 'tl', 'tm', 'tmall', 'tn', 'to', 'today', 'tokyo', + 'tools', 'top', 'toray', 'toshiba', 'total', 'tours', 'town', 'toyota', + 'toys', 'tr', 'trade', 'trading', 'training', 'travel', + 'travelchannel', 'travelers', 'travelersinsurance', 'trust', 'trv', + 'tt', 'tube', 'tui', 'tunes', 'tushu', 'tv', 'tvs', 'tw', 'tz', 'ua', + 'ubank', 'ubs', 'uconnect', 'ug', 'uk', 'unicom', 'university', 'uno', + 'uol', 'ups', 'us', 'uy', 'uz', 'va', 'vacations', 'vana', 'vanguard', + 'vc', 've', 'vegas', 'ventures', 'verisign', 'versicherung', 'vet', + 'vg', 'vi', 'viajes', 'video', 'vig', 'viking', 'villas', 'vin', 'vip', + 'virgin', 'visa', 'vision', 'vistaprint', 'viva', 'vivo', 'vlaanderen', + 'vn', 'vodka', 'volkswagen', 'volvo', 'vote', 'voting', 'voto', + 'voyage', 'vu', 'vuelos', 'wales', 'walmart', 'walter', 'wang', + 'wanggou', 'warman', 'watch', 'watches', 'weather', 'weatherchannel', + 'webcam', 'weber', 'website', 'wed', 'wedding', 'weibo', 'weir', 'wf', + 'whoswho', 'wien', 'wiki', 'williamhill', 'win', 'windows', 'wine', + 'winners', 'wme', 'wolterskluwer', 'woodside', 'work', 'works', + 'world', 'wow', 'ws', 'wtc', 'wtf', 'xbox', 'xerox', 'xfinity', + 'xihuan', 'xin', 'xn--11b4c3d', 'xn--1ck2e1b', 'xn--1qqw23a', + 'xn--2scrj9c', 'xn--30rr7y', 'xn--3bst00m', 'xn--3ds443g', + 'xn--3e0b707e', 'xn--3hcrj9c', 'xn--3oq18vl8pn36a', 'xn--3pxu8k', + 'xn--42c2d9a', 'xn--45br5cyl', 'xn--45brj9c', 'xn--45q11c', + 'xn--4gbrim', 'xn--54b7fta0cc', 'xn--55qw42g', 'xn--55qx5d', + 'xn--5su34j936bgsg', 'xn--5tzm5g', 'xn--6frz82g', 'xn--6qq986b3xl', + 'xn--80adxhks', 'xn--80ao21a', 'xn--80aqecdr1a', 'xn--80asehdb', + 'xn--80aswg', 'xn--8y0a063a', 'xn--90a3ac', 'xn--90ae', 'xn--90ais', + 'xn--9dbq2a', 'xn--9et52u', 'xn--9krt00a', 'xn--b4w605ferd', + 'xn--bck1b9a5dre4c', 'xn--c1avg', 'xn--c2br7g', 'xn--cck2b3b', + 'xn--cg4bki', 'xn--clchc0ea0b2g2a9gcd', 'xn--czr694b', 'xn--czrs0t', + 'xn--czru2d', 'xn--d1acj3b', 'xn--d1alf', 'xn--e1a4c', 'xn--eckvdtc9d', + 'xn--efvy88h', 'xn--estv75g', 'xn--fct429k', 'xn--fhbei', + 'xn--fiq228c5hs', 'xn--fiq64b', 'xn--fiqs8s', 'xn--fiqz9s', + 'xn--fjq720a', 'xn--flw351e', 'xn--fpcrj9c3d', 'xn--fzc2c9e2c', + 'xn--fzys8d69uvgm', 'xn--g2xx48c', 'xn--gckr3f0f', 'xn--gecrj9c', + 'xn--gk3at1e', 'xn--h2breg3eve', 'xn--h2brj9c', 'xn--h2brj9c8c', + 'xn--hxt814e', 'xn--i1b6b1a6a2e', 'xn--imr513n', 'xn--io0a7i', + 'xn--j1aef', 'xn--j1amh', 'xn--j6w193g', 'xn--jlq61u9w7b', + 'xn--jvr189m', 'xn--kcrx77d1x4a', 'xn--kprw13d', 'xn--kpry57d', + 'xn--kpu716f', 'xn--kput3i', 'xn--l1acc', 'xn--lgbbat1ad8j', + 'xn--mgb9awbf', 'xn--mgba3a3ejt', 'xn--mgba3a4f16a', + 'xn--mgba7c0bbn0a', 'xn--mgbaakc7dvf', 'xn--mgbaam7a8h', + 'xn--mgbab2bd', 'xn--mgbai9azgqp6j', 'xn--mgbayh7gpa', + 'xn--mgbb9fbpob', 'xn--mgbbh1a', 'xn--mgbbh1a71e', 'xn--mgbc0a9azcg', + 'xn--mgbca7dzdo', 'xn--mgberp4a5d4ar', 'xn--mgbgu82a', + 'xn--mgbi4ecexp', 'xn--mgbpl2fh', 'xn--mgbt3dhd', 'xn--mgbtx2b', + 'xn--mgbx4cd0ab', 'xn--mix891f', 'xn--mk1bu44c', 'xn--mxtq1m', + 'xn--ngbc5azd', 'xn--ngbe9e0a', 'xn--ngbrx', 'xn--node', 'xn--nqv7f', + 'xn--nqv7fs00ema', 'xn--nyqy26a', 'xn--o3cw4h', 'xn--ogbpf8fl', + 'xn--otu796d', 'xn--p1acf', 'xn--p1ai', 'xn--pbt977c', 'xn--pgbs0dh', + 'xn--pssy2u', 'xn--q9jyb4c', 'xn--qcka1pmc', 'xn--qxam', 'xn--rhqv96g', + 'xn--rovu88b', 'xn--rvc1e0am3e', 'xn--s9brj9c', 'xn--ses554g', + 'xn--t60b56a', 'xn--tckwe', 'xn--tiq49xqyj', 'xn--unup4y', + 'xn--vermgensberater-ctb', 'xn--vermgensberatung-pwb', 'xn--vhquv', + 'xn--vuq861b', 'xn--w4r85el8fhu5dnra', 'xn--w4rs40l', 'xn--wgbh1c', + 'xn--wgbl6a', 'xn--xhq521b', 'xn--xkc2al3hye2a', 'xn--xkc2dl3a5ee0h', + 'xn--y9a3aq', 'xn--yfro4i67o', 'xn--ygbi2ammx', 'xn--zfr164b', 'xxx', + 'xyz', 'yachts', 'yahoo', 'yamaxun', 'yandex', 'ye', 'yodobashi', + 'yoga', 'yokohama', 'you', 'youtube', 'yt', 'yun', 'za', 'zappos', + 'zara', 'zero', 'zip', 'zippo', 'zm', 'zone', 'zuerich', 'zw', ]; public function validate($input) diff --git a/vendor/respect/validation/tests/unit/Rules/DateTest.php b/vendor/respect/validation/tests/unit/Rules/DateTest.php index 0b895592387946fc02e22e4881811e2c8714591d..b0262a6e663f75866f85d09432e36429e3778e97 100644 --- a/vendor/respect/validation/tests/unit/Rules/DateTest.php +++ b/vendor/respect/validation/tests/unit/Rules/DateTest.php @@ -19,7 +19,7 @@ use DateTimeImmutable; * @covers Respect\Validation\Rules\Date * @covers Respect\Validation\Exceptions\DateException */ -class DateTest extends \PHPUnit_Framework_TestCase +class DateTest extends RuleTestCase { protected $dateValidator; @@ -150,4 +150,57 @@ class DateTest extends \PHPUnit_Framework_TestCase ['UTC', 'z', 320], ]; } + + /** + * {@inheritdoc} + */ + public function providerForValidInput() + { + return [ + [new Date(), 'now'], + [new Date(), 'today'], + [new Date(), 'tomorrow'], + [new Date(), 'yesterday'], + [new Date(), '+1 day'], + [new Date(), 'next Thursday'], + [new Date(), '+1 week 2 days 4 hours 2 seconds'], + [new Date(), 2018], + [new Date(), new DateTime()], + [new Date('Y-m-d'), '2009-09-09'], + [new Date('d/m/Y'), '23/05/1987'], + [new Date('c'), '2004-02-12T15:19:21+00:00'], + [new Date('r'), 'Thu, 29 Dec 2005 01:02:03 +0000'], + [new Date('U'), 1464658596], + [new Date('h'), 6], + [new Date('z'), 320], + [new Date('Ym'), 202302], + [new Date('m'), 12], + [new Date('Y'), 2000], + ]; + } + + /** + * {@inheritdoc} + */ + public function providerForInvalidInput() + { + return [ + [new Date(), 'not-a-date'], + [new Date(), []], + [new Date(), true], + [new Date(), false], + [new Date(), null], + [new Date(), ''], + [new Date('Y-m-d'), '2009-12-00'], + [new Date('Y-m-d'), '2018-02-29'], + [new Date('h'), 24], + [new Date(), '2014-99'], + [new Date('d'), 1], + [new Date('Y-m'), '2014-99'], + [new Date('m'), '99'], + [new Date('H'), '24'], + [new Date('i'), '60'], + [new Date('s'), '60'], + ]; + } } diff --git a/vendor/respect/validation/tests/unit/Rules/EmailTest.php b/vendor/respect/validation/tests/unit/Rules/EmailTest.php index 1d74eebacda6dea1da6baee23d64d372a5985519..3c32e47392d91f18da14ec8d6c7b0b12c7986e12 100644 --- a/vendor/respect/validation/tests/unit/Rules/EmailTest.php +++ b/vendor/respect/validation/tests/unit/Rules/EmailTest.php @@ -11,6 +11,8 @@ namespace Respect\Validation\Rules; +use stdClass; + function class_exists($className) { if (isset($GLOBALS['class_exists'][$className])) { @@ -142,6 +144,10 @@ class EmailTest extends \PHPUnit_Framework_TestCase ['test@test..com'], ['test@test.com.'], ['.test@test.com'], + [[]], + [new stdClass()], + [null], + [tmpfile()], ]; } } diff --git a/vendor/respect/validation/tests/unit/Rules/IntValTest.php b/vendor/respect/validation/tests/unit/Rules/IntValTest.php index 5d3bd04ed213e9fddab3474d638e7dbe15d3fac3..302c19da32b373a63103e2803152e4f397b6d1a8 100644 --- a/vendor/respect/validation/tests/unit/Rules/IntValTest.php +++ b/vendor/respect/validation/tests/unit/Rules/IntValTest.php @@ -52,6 +52,8 @@ class IntValTest extends \PHPUnit_Framework_TestCase ['165'], [123456], [PHP_INT_MAX], + ['06'], + ['0'] ]; } diff --git a/vendor/respect/validation/tests/unit/Rules/MaxTest.php b/vendor/respect/validation/tests/unit/Rules/MaxTest.php index 34a05ec1dd596d29fb64258e7ab4e98a9ca017ee..72771e52cc442dcd8793e9157f5487cb3f70224a 100644 --- a/vendor/respect/validation/tests/unit/Rules/MaxTest.php +++ b/vendor/respect/validation/tests/unit/Rules/MaxTest.php @@ -62,6 +62,8 @@ class MaxTest extends \PHPUnit_Framework_TestCase [200, false, 250], [200, false, 1500], [200, false, 200], + [1900, false, '2018-01-25'], + [10.5, false, '2018-01-25'], ]; } } diff --git a/vendor/respect/validation/tests/unit/Rules/MinTest.php b/vendor/respect/validation/tests/unit/Rules/MinTest.php index f8bce87b673c2646a67bc755b01778fa3fd18606..fa01e132792e6d2345117ef923dbe713397880f6 100644 --- a/vendor/respect/validation/tests/unit/Rules/MinTest.php +++ b/vendor/respect/validation/tests/unit/Rules/MinTest.php @@ -70,6 +70,8 @@ class MinTest extends \PHPUnit_Framework_TestCase [0, false, -250], [0, false, -50], [50, false, 50], + [2040, false, '2018-01-25'], + [10.5, false, '2018-01-25'], ]; } } diff --git a/vendor/respect/validation/tests/unit/Rules/PostalCodeTest.php b/vendor/respect/validation/tests/unit/Rules/PostalCodeTest.php index e87d6549662a241c00d3cfc8a708f0fef0adcabc..a29df67588a8e1a4ad1a5dbe3530e5c78f7dd694 100644 --- a/vendor/respect/validation/tests/unit/Rules/PostalCodeTest.php +++ b/vendor/respect/validation/tests/unit/Rules/PostalCodeTest.php @@ -93,6 +93,10 @@ class PostalCodeTest extends \PHPUnit_Framework_TestCase ['PL', '99-300'], ['NL', '1012 GX'], ['NL', '1012GX'], + ['PT', '3660-606'], + ['PT', '3660606'], + ['CO', '110231'], + ['KR', '03187'], ]; } @@ -127,6 +131,8 @@ class PostalCodeTest extends \PHPUnit_Framework_TestCase ['US', '021 79'], ['YE', '02179'], ['PL', '99300'], + ['KR', '548940'], + ['KR', '548-940'], ]; } } diff --git a/vendor/setasign/fpdi/README.md b/vendor/setasign/fpdi/README.md index 5a68ad2bde3681dc594cc52412288ad324493058..42856df3e52d6ae9b9428d69adf83bae69a2f0ac 100644 --- a/vendor/setasign/fpdi/README.md +++ b/vendor/setasign/fpdi/README.md @@ -13,14 +13,16 @@ FPDI is a collection of PHP classes facilitating developers to read pages from e 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), too. +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 or TCPDF we didn't added a fixed dependency in the main -composer.json file but we added metadata packages for both -[FPDF](https://github.com/Setasign/FPDI-FPDF) and -[TCPDF](https://github.com/Setasign/FPDI-TCPDF). +Because FPDI can be used with FPDF, TCPDF or tFPDF we didn't added a fixed dependency in the main +composer.json file but we added metadata packages for +[FPDF](https://github.com/Setasign/FPDI-FPDF), +[TCPDF](https://github.com/Setasign/FPDI-TCPDF) and +[tFPDF](https://github.com/Setasign/FPDI-tFPDF). ### Evaluate Dependencies Automatically @@ -42,6 +44,15 @@ For TCPDF add following [package](https://github.com/Setasign/FPDI-TCPDF) to you } ``` +For tFPDF add following [package](https://github.com/Setasign/FPDI-tFPDF) to your composer.json: +```json +{ + "require": { + "setasign/fpdi-tfpdf": "^2.1" + } +} +``` + ### Manual Dependencies If you don't want to use the metadata packages, it is up to you to add the dependencies to your @@ -69,6 +80,17 @@ If you want to use TCPDF, your have to update your composer.json respectively to } ``` +If you want to use tFPDF, your have to update your composer.json respectively to: + +```json +{ + "require": { + "tecnickcom/tfpdf": "1.25", + "setasign/fpdi": "^2.1" + } +} +``` + ## Manual Installation If you do not use composer, just require the autoload.php in the /src folder: @@ -110,8 +132,8 @@ version 2: 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 `TcpdfFpdi` -instead of `FPDI`. +- 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 @@ -119,13 +141,18 @@ A simple example, that imports a single page and places this onto a new created ```php <?php -use setasign\Fpdi; +use setasign\Fpdi\Fpdi; +// or for usage with TCPDF: +// use setasign\Fpdi\Tcpdf\Fpdi; + +// or for usage with tFPDF: +// use setasign\Fpdi\Tfpdf\Fpdi; // setup the autoload function require_once('vendor/autoload.php'); // initiate FPDI -$pdf = new Fpdi\Fpdi(); +$pdf = new Fpdi(); // add a page $pdf->AddPage(); // set the source file diff --git a/vendor/setasign/fpdi/composer.json b/vendor/setasign/fpdi/composer.json index ba4eb380080bcbd409d5ab39574f83ba997ce3f0..58f79315dd98f3ae08ab88240a4450ca6355a230 100644 --- a/vendor/setasign/fpdi/composer.json +++ b/vendor/setasign/fpdi/composer.json @@ -31,14 +31,16 @@ } ], "suggest": { - "setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.", + "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.", "setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.", - "setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF." + "setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF.", + "setasign/fpdi-tfpdf": "Use this package to automatically evaluate dependencies to tFPDF." }, "require-dev": { "phpunit/phpunit": "~5.7", "setasign/fpdf": "~1.8", - "tecnickcom/tcpdf": "~6.2" + "tecnickcom/tcpdf": "~6.2", + "setasign/tfpdf": "1.25" }, "autoload-dev": { "psr-4": { diff --git a/vendor/setasign/fpdi/src/FpdfTpl.php b/vendor/setasign/fpdi/src/FpdfTpl.php index 0d11850fdda6c22648dbfaaa144d41e7dbc7b47d..86672e59370b228b5b52cf82f9c64001fd0705de 100644 --- a/vendor/setasign/fpdi/src/FpdfTpl.php +++ b/vendor/setasign/fpdi/src/FpdfTpl.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi; @@ -19,440 +18,5 @@ namespace setasign\Fpdi; */ class FpdfTpl extends \FPDF { - /** - * Data of all created templates. - * - * @var array - */ - protected $templates = []; - - /** - * The template id for the currently created template. - * - * @var null|int - */ - protected $currentTemplateId; - - /** - * A counter for template ids. - * - * @var int - */ - protected $templateId = 0; - - /** - * Set the page format of the current page. - * - * @param array $size An array with two values defining the size. - * @param string $orientation "L" for landscape, "P" for portrait. - * @throws \BadMethodCallException - */ - public function setPageFormat($size, $orientation) - { - if ($this->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. - * - * Omit 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 FpdfTpl::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 CallableParameterUseCaseInTypeContextInspection */ - 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. - * - * Omit 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, - 'w' => $this->w, - 'FontFamily' => $this->FontFamily, - 'FontStyle' => $this->FontStyle, - 'FontSizePt' => $this->FontSizePt, - 'FontSize' => $this->FontSize, - 'underline' => $this->underline - ] - ]; - - $this->SetAutoPageBreak(false); - $this->currentTemplateId = $templateId; - - $this->h = $height; - $this->w = $width; - - $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 (null === $this->currentTemplateId) { - 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->w = $state['w']; - $this->SetAutoPageBreak($state['AutoPageBreak'], $state['bMargin']); - - $this->FontFamily = $state['FontFamily']; - $this->FontStyle = $state['FontStyle']; - $this->FontSizePt = $state['FontSizePt']; - $this->FontSize = $state['FontSize']; - - $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)); - } - } - - /** - * @inheritdoc - */ - protected function _putimages() - { - parent::_putimages(); - - foreach ($this->templates as $key => $template) { - $this->_newobj(); - $this->templates[$key]['objectNumber'] = $this->n; - - $this->_put('<</Type /XObject /Subtype /Form /FormType 1'); - $this->_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 <</Type/Group/S/Transparency>>'); - } - - $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); - } - } + use FpdfTplTrait; } diff --git a/vendor/setasign/fpdi/src/Fpdi.php b/vendor/setasign/fpdi/src/Fpdi.php index 769a8530afe120b8215007329addaf9afa066981..266123a4eb8d3e98f39e2cc66b370e57c9dd21b2 100644 --- a/vendor/setasign/fpdi/src/Fpdi.php +++ b/vendor/setasign/fpdi/src/Fpdi.php @@ -3,14 +3,14 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi; use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException; +use setasign\Fpdi\PdfParser\PdfParserException; use setasign\Fpdi\PdfParser\Type\PdfIndirectObject; use setasign\Fpdi\PdfParser\Type\PdfNull; @@ -30,7 +30,7 @@ class Fpdi extends FpdfTpl * * @string */ - const VERSION = '2.0.3'; + const VERSION = '2.1.0'; /** * Draws an imported page or a template onto the page or another template. @@ -75,7 +75,7 @@ class Fpdi extends FpdfTpl public function getTemplateSize($tpl, $width = null, $height = null) { $size = parent::getTemplateSize($tpl, $width, $height); - if (false === $size) { + if ($size === false) { return $this->getImportedPageSize($tpl, $width, $height); } @@ -84,6 +84,8 @@ class Fpdi extends FpdfTpl /** * @inheritdoc + * @throws CrossReferenceException + * @throws PdfParserException */ protected function _putimages() { diff --git a/vendor/setasign/fpdi/src/FpdiException.php b/vendor/setasign/fpdi/src/FpdiException.php index 7a23c71023f9a485a0be55414197abafc38b5588..e9522f53bfd10200a222b70847dc2cd4a0586f53 100644 --- a/vendor/setasign/fpdi/src/FpdiException.php +++ b/vendor/setasign/fpdi/src/FpdiException.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi; diff --git a/vendor/setasign/fpdi/src/FpdiTrait.php b/vendor/setasign/fpdi/src/FpdiTrait.php index 03e42483366b27bb1dbccc901db924b7cd76d285..f5702e550d1ff78d3d9953f38f637b9761b24f3c 100644 --- a/vendor/setasign/fpdi/src/FpdiTrait.php +++ b/vendor/setasign/fpdi/src/FpdiTrait.php @@ -3,14 +3,16 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi; +use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException; +use setasign\Fpdi\PdfParser\Filter\FilterException; use setasign\Fpdi\PdfParser\PdfParser; +use setasign\Fpdi\PdfParser\PdfParserException; use setasign\Fpdi\PdfParser\StreamReader; use setasign\Fpdi\PdfParser\Type\PdfArray; use setasign\Fpdi\PdfParser\Type\PdfBoolean; @@ -25,6 +27,7 @@ use setasign\Fpdi\PdfParser\Type\PdfStream; use setasign\Fpdi\PdfParser\Type\PdfString; use setasign\Fpdi\PdfParser\Type\PdfToken; use setasign\Fpdi\PdfParser\Type\PdfType; +use setasign\Fpdi\PdfParser\Type\PdfTypeException; use setasign\Fpdi\PdfReader\PageBoundaries; use setasign\Fpdi\PdfReader\PdfReader; use setasign\Fpdi\PdfReader\PdfReaderException; @@ -121,7 +124,7 @@ trait FpdiTrait $id = (string) $file; } elseif (\is_string($file)) { $id = \realpath($file); - if (false === $id) { + if ($id === false) { $id = $file; } } elseif (\is_object($file)) { @@ -132,6 +135,7 @@ trait FpdiTrait ); } + /** @noinspection OffsetOperationsInspection */ if (isset($this->readers[$id])) { return $id; } @@ -145,6 +149,7 @@ trait FpdiTrait } $reader = new PdfReader($this->getPdfParserInstance($streamReader)); + /** @noinspection OffsetOperationsInspection */ $this->readers[$id] = $reader; return $id; @@ -172,6 +177,7 @@ trait FpdiTrait * * @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) { @@ -191,8 +197,12 @@ trait FpdiTrait * @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). * @return string A unique string identifying the imported page. - * @see PageBoundaries + * @throws CrossReferenceException + * @throws FilterException + * @throws PdfParserException + * @throws PdfTypeException * @throws PdfReaderException + * @see PageBoundaries */ public function importPage($pageNumber, $box = PageBoundaries::CROP_BOX, $groupXObject = true) { @@ -364,6 +374,7 @@ trait FpdiTrait 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 */ @@ -446,6 +457,7 @@ trait FpdiTrait * Writes a PdfType object to the resulting buffer. * * @param PdfType $value + * @throws PdfTypeException */ protected function writePdfType(PdfType $value) { diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/AbstractReader.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/AbstractReader.php index 6db71199d312e136458fffe179931a408a40ddf3..4bd6a16fa82c56d5b8fb0d6a23ab8b3045a4f06b 100644 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/AbstractReader.php +++ b/vendor/setasign/fpdi/src/PdfParser/CrossReference/AbstractReader.php @@ -3,16 +3,16 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\CrossReference; use setasign\Fpdi\PdfParser\PdfParser; use setasign\Fpdi\PdfParser\Type\PdfDictionary; use setasign\Fpdi\PdfParser\Type\PdfToken; +use setasign\Fpdi\PdfParser\Type\PdfTypeException; /** * Abstract class for cross-reference reader classes. @@ -35,6 +35,8 @@ abstract class AbstractReader * AbstractReader constructor. * * @param PdfParser $parser + * @throws CrossReferenceException + * @throws PdfTypeException */ public function __construct(PdfParser $parser) { @@ -56,28 +58,36 @@ abstract class AbstractReader * Read the trailer dictionary. * * @throws CrossReferenceException + * @throws PdfTypeException */ protected function readTrailer() { - $trailerKeyword = $this->parser->readValue(); - if ($trailerKeyword === false || - !($trailerKeyword instanceof PdfToken) || - $trailerKeyword->value !== 'trailer' - ) { + 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( - \sprintf( - 'Unexpected end of cross reference. "trailer"-keyword expected, got: %s', - $trailerKeyword instanceof PdfToken ? $trailerKeyword->value : 'nothing' - ), - CrossReferenceException::UNEXPECTED_END + 'Unexpected end of cross reference. "trailer"-keyword expected, got an invalid object type.', + CrossReferenceException::UNEXPECTED_END, + $e ); } - $trailer = $this->parser->readValue(); - if ($trailer === false || !($trailer instanceof PdfDictionary)) { + 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 + CrossReferenceException::UNEXPECTED_END, + $e ); } diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php index a9d2d8f1ee6eeb12c91b6d016a1331f5e9b1b518..c1fcf81876824f0233bbf91b28b1d700cdf497b9 100644 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php +++ b/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReference.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\CrossReference; @@ -16,6 +15,7 @@ use setasign\Fpdi\PdfParser\Type\PdfIndirectObject; use setasign\Fpdi\PdfParser\Type\PdfNumeric; use setasign\Fpdi\PdfParser\Type\PdfStream; use setasign\Fpdi\PdfParser\Type\PdfToken; +use setasign\Fpdi\PdfParser\Type\PdfTypeException; /** * Class CrossReference @@ -52,6 +52,8 @@ class CrossReference * CrossReference constructor. * * @param PdfParser $parser + * @throws CrossReferenceException + * @throws PdfTypeException */ public function __construct(PdfParser $parser, $fileHeaderOffset = 0) { @@ -60,7 +62,8 @@ class CrossReference $offset = $this->findStartXref(); $reader = null; - while ($offset !== false) { + /** @noinspection TypeUnsafeComparisonInspection */ + while ($offset != false) { // By doing an unsafe comparsion we ignore faulty references to byte offset 0 $reader = $this->readXref($offset + $this->fileHeaderOffset); $trailer = $reader->getTrailer(); $this->checkForEncryption($trailer); @@ -122,7 +125,7 @@ class CrossReference { foreach ($this->getReaders() as $reader) { $offset = $reader->getOffsetFor($objectNumber); - if (false !== $offset) { + if ($offset !== false) { return $offset; } } @@ -140,7 +143,7 @@ class CrossReference public function getIndirectObject($objectNumber) { $offset = $this->getOffsetFor($objectNumber); - if (false === $offset) { + if ($offset === false) { throw new CrossReferenceException( \sprintf('Object (id:%s) not found.', $objectNumber), CrossReferenceException::OBJECT_NOT_FOUND @@ -152,11 +155,14 @@ class CrossReference $parser->getTokenizer()->clearStack(); $parser->getStreamReader()->reset($offset + $this->fileHeaderOffset); - $object = $parser->readValue(); - if (false === $object || !($object instanceof PdfIndirectObject)) { + 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 + CrossReferenceException::OBJECT_NOT_FOUND, + $e ); } @@ -178,6 +184,7 @@ class CrossReference * @param int $offset * @return ReaderInterface * @throws CrossReferenceException + * @throws PdfTypeException */ protected function readXref($offset) { @@ -194,6 +201,7 @@ class CrossReference * @param PdfToken|PdfIndirectObject $initValue * @return ReaderInterface|bool * @throws CrossReferenceException + * @throws PdfTypeException */ protected function initReaderInstance($initValue) { @@ -268,10 +276,10 @@ class CrossReference $buffer = $reader->getBuffer(false); $pos = \strrpos($buffer, 'startxref'); $addOffset = 9; - if (false === $pos) { + if ($pos === false) { // Some corrupted documents uses startref, instead of startxref $pos = \strrpos($buffer, 'startref'); - if (false === $pos) { + if ($pos === false) { throw new CrossReferenceException( 'Unable to find pointer to xref table', CrossReferenceException::NO_STARTXREF_FOUND @@ -282,11 +290,13 @@ class CrossReference $reader->setOffset($pos + $addOffset); - $value = $this->parser->readValue(); - if (!($value instanceof PdfNumeric)) { + try { + $value = $this->parser->readValue(null, PdfNumeric::class); + } catch (PdfTypeException $e) { throw new CrossReferenceException( 'Invalid data after startxref keyword.', - CrossReferenceException::INVALID_DATA + CrossReferenceException::INVALID_DATA, + $e ); } diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php index 73bb09f82e1aa35fb018d096b8dee693a8183ce8..faffdcb990b5ca4f6c7df5f301500024bb09d9f4 100644 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php +++ b/vendor/setasign/fpdi/src/PdfParser/CrossReference/CrossReferenceException.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\CrossReference; diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/FixedReader.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/FixedReader.php index 0a9c0e8f2cbdbdc124b9f35a57803a7810ebde1b..b77bcbbcb6670e132e9120d928aa6eff9e273e16 100644 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/FixedReader.php +++ b/vendor/setasign/fpdi/src/PdfParser/CrossReference/FixedReader.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\CrossReference; @@ -39,6 +38,7 @@ class FixedReader extends AbstractReader implements ReaderInterface * FixedReader constructor. * * @param PdfParser $parser + * @throws CrossReferenceException */ public function __construct(PdfParser $parser) { @@ -99,7 +99,7 @@ class FixedReader extends AbstractReader implements ReaderInterface } // jump over if line content doesn't match the expected string - if (2 !== \sscanf($line, '%d %d', $startObject, $entryCount)) { + if (\sscanf($line, '%d %d', $startObject, $entryCount) !== 2) { continue; } @@ -138,6 +138,9 @@ class FixedReader extends AbstractReader implements ReaderInterface $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.', diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php index 260ac22ada0800cf60ba5791c34238b805f2a59e..6e9939c96190aa81533c94d8b4ee94d70721d97a 100644 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php +++ b/vendor/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\CrossReference; @@ -34,6 +33,7 @@ class LineReader extends AbstractReader implements ReaderInterface * LineReader constructor. * * @param PdfParser $parser + * @throws CrossReferenceException */ public function __construct(PdfParser $parser) { @@ -80,14 +80,14 @@ class LineReader extends AbstractReader implements ReaderInterface while ( ($trailerPos = \strpos($reader->getBuffer(false), 'trailer', \max($bytesPerCycle * $cycles++, 0))) === false ) { - if (false === $reader->increaseLength($bytesPerCycle)) { + if ($reader->increaseLength($bytesPerCycle) === false) { break; } } - if (false === $trailerPos) { + if ($trailerPos === false) { throw new CrossReferenceException( - 'Unexpected end of cross reference. trailer-keyword not found.', + 'Unexpected end of cross reference. "trailer"-keyword not found.', CrossReferenceException::NO_TRAILER_FOUND ); } diff --git a/vendor/setasign/fpdi/src/PdfParser/CrossReference/ReaderInterface.php b/vendor/setasign/fpdi/src/PdfParser/CrossReference/ReaderInterface.php index 6d8015b1ae9d15d3e197a368a17dab0d18371a6e..ca2ef8fde1807a18440c43348f34fc4443a60e47 100644 --- a/vendor/setasign/fpdi/src/PdfParser/CrossReference/ReaderInterface.php +++ b/vendor/setasign/fpdi/src/PdfParser/CrossReference/ReaderInterface.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\CrossReference; diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85.php b/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85.php index 76ad3735a35bd9507961fe34d97cd81669856593..74a11fcb66bfa567cdcd6607e3dfbca2e5a5fff5 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85.php +++ b/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Filter; diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85Exception.php b/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85Exception.php index a6f5887d078f24de0b3323135296f62d7f15a4d6..ac2a003133f3662cd11659107873d58f5b0351b4 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85Exception.php +++ b/vendor/setasign/fpdi/src/PdfParser/Filter/Ascii85Exception.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Filter; diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/AsciiHex.php b/vendor/setasign/fpdi/src/PdfParser/Filter/AsciiHex.php index 92ad8d8e921f55676e0907663fe2688ff4029188..9c9e401cb0436a5ed0d6c752508b02740d5e61b1 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/AsciiHex.php +++ b/vendor/setasign/fpdi/src/PdfParser/Filter/AsciiHex.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Filter; diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/FilterException.php b/vendor/setasign/fpdi/src/PdfParser/Filter/FilterException.php index 878cb128ed219e0badab784021ce440e9eab6c02..e7e189cda4960cf2353744bf23966bc74392322c 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/FilterException.php +++ b/vendor/setasign/fpdi/src/PdfParser/Filter/FilterException.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Filter; diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/FilterInterface.php b/vendor/setasign/fpdi/src/PdfParser/Filter/FilterInterface.php index 86f54fe14914f52d1d3f22461c5bd1a0b79eab4c..3177a3497f0e36dc2cd9c8da970c87c80bc7fc18 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/FilterInterface.php +++ b/vendor/setasign/fpdi/src/PdfParser/Filter/FilterInterface.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Filter; diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/Flate.php b/vendor/setasign/fpdi/src/PdfParser/Filter/Flate.php index 1fd032dd74df90058cd4936f5d46d236f403387a..13d61970ff40cafea177ba4b2a1b4ea8ef3e2f49 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/Flate.php +++ b/vendor/setasign/fpdi/src/PdfParser/Filter/Flate.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Filter; @@ -42,7 +41,7 @@ class Flate implements FilterInterface if ($this->extensionLoaded()) { $oData = $data; $data = @((\strlen($data) > 0) ? \gzuncompress($data) : ''); - if (false === $data) { + if ($data === false) { // Try this fallback $tries = 1; while ($tries < 10 && ($data === false || \strlen($data) < (\strlen($oData) - $tries - 1))) { @@ -50,7 +49,7 @@ class Flate implements FilterInterface $tries++; } - if (false === $data) { + if ($data === false) { throw new FlateException( 'Error while decompressing stream.', FlateException::DECOMPRESS_ERROR diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/FlateException.php b/vendor/setasign/fpdi/src/PdfParser/Filter/FlateException.php index f3bc6e3eeba8e74e2401820c76e0d4fb7c75d64a..c87ac342fc24db57eba9d8ae9c550f33d732c792 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/FlateException.php +++ b/vendor/setasign/fpdi/src/PdfParser/Filter/FlateException.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Filter; diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/Lzw.php b/vendor/setasign/fpdi/src/PdfParser/Filter/Lzw.php index c8f416bef8997eeadfb7bf18ba2bb7ab45ae7bb4..df10bad73875c529ae2540935baa23e53990c3e0 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/Lzw.php +++ b/vendor/setasign/fpdi/src/PdfParser/Filter/Lzw.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Filter; @@ -71,7 +70,7 @@ class Lzw implements FilterInterface */ public function decode($data) { - if ($data[0] == 0x00 && $data[1] == 0x01) { + if ($data[0] === "\x00" && $data[1] === "\x01") { throw new LzwException( 'LZW flavour not supported.', LzwException::LZW_FLAVOUR_NOT_SUPPORTED @@ -93,12 +92,12 @@ class Lzw implements FilterInterface $uncompData = ''; - while (($code = $this->getNextCode()) != 257) { - if ($code == 256) { + while (($code = $this->getNextCode()) !== 257) { + if ($code === 256) { $this->initsTable(); $code = $this->getNextCode(); - if ($code == 257) { + if ($code === 257) { break; } @@ -154,11 +153,11 @@ class Lzw implements FilterInterface // Add this new String to the table $this->sTable[$this->tIdx++] = $string; - if ($this->tIdx == 511) { + if ($this->tIdx === 511) { $this->bitsToGet = 10; - } elseif ($this->tIdx == 1023) { + } elseif ($this->tIdx === 1023) { $this->bitsToGet = 11; - } elseif ($this->tIdx == 2047) { + } elseif ($this->tIdx === 2047) { $this->bitsToGet = 12; } } @@ -170,7 +169,7 @@ class Lzw implements FilterInterface */ protected function getNextCode() { - if ($this->bytePointer == $this->dataLength) { + if ($this->bytePointer === $this->dataLength) { return 257; } diff --git a/vendor/setasign/fpdi/src/PdfParser/Filter/LzwException.php b/vendor/setasign/fpdi/src/PdfParser/Filter/LzwException.php index dabc3df498191c2a291e38dab03938f1b8a36033..4d88616d20a6daf788be26044caae145a737c879 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Filter/LzwException.php +++ b/vendor/setasign/fpdi/src/PdfParser/Filter/LzwException.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Filter; diff --git a/vendor/setasign/fpdi/src/PdfParser/PdfParser.php b/vendor/setasign/fpdi/src/PdfParser/PdfParser.php index efb291f1fdd4a26361930f6cdf70461019995400..c6759c56e405960564b07024db06f2e9c8665221 100644 --- a/vendor/setasign/fpdi/src/PdfParser/PdfParser.php +++ b/vendor/setasign/fpdi/src/PdfParser/PdfParser.php @@ -3,14 +3,14 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser; use setasign\Fpdi\PdfParser\CrossReference\CrossReference; +use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException; use setasign\Fpdi\PdfParser\Type\PdfArray; use setasign\Fpdi\PdfParser\Type\PdfBoolean; use setasign\Fpdi\PdfParser\Type\PdfDictionary; @@ -125,7 +125,7 @@ class PdfParser while (true) { $buffer = $this->streamReader->getBuffer(false); $offset = \strpos($buffer, '%PDF-'); - if (false === $offset) { + if ($offset === false) { if (!$this->streamReader->increaseLength(100) || (--$maxIterations === 0)) { throw new PdfParserException( 'Unable to find PDF file header.', @@ -148,10 +148,12 @@ class PdfParser * Get the cross reference instance. * * @return CrossReference + * @throws CrossReferenceException + * @throws PdfParserException */ public function getCrossReference() { - if (null === $this->xref) { + if ($this->xref === null) { $this->xref = new CrossReference($this, $this->resolveFileHeader()); } @@ -191,6 +193,9 @@ class PdfParser * Get the catalog dictionary. * * @return PdfDictionary + * @throws Type\PdfTypeException + * @throws CrossReferenceException + * @throws PdfParserException */ public function getCatalog() { @@ -208,6 +213,8 @@ class PdfParser * @param int $objectNumber * @param bool $cache * @return PdfIndirectObject + * @throws CrossReferenceException + * @throws PdfParserException */ public function getIndirectObject($objectNumber, $cache = false) { @@ -230,34 +237,44 @@ class PdfParser * Read a PDF value. * * @param null|bool|string $token + * @param null|string $expectedType * @return bool|PdfArray|PdfBoolean|PdfHexString|PdfName|PdfNull|PdfNumeric|PdfString|PdfToken|PdfIndirectObjectReference + * @throws Type\PdfTypeException */ - public function readValue($token = null) + public function readValue($token = null, $expectedType = null) { - if (null === $token) { + if ($token === null) { $token = $this->tokenizer->getNextToken(); } - if (false === $token) { + 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 PdfString::parse($this->streamReader); case '<': if ($this->streamReader->getByte() === '<') { + $this->ensureExpectedType('<<', $expectedType); $this->streamReader->addOffset(1); return PdfDictionary::parse($this->tokenizer, $this->streamReader, $this); } + $this->ensureExpectedType($token, $expectedType); return PdfHexString::parse($this->streamReader); case '/': + $this->ensureExpectedType($token, $expectedType); return PdfName::parse($this->tokenizer, $this->streamReader); case '[': + $this->ensureExpectedType($token, $expectedType); return PdfArray::parse($this->tokenizer, $this); default: @@ -267,6 +284,12 @@ class PdfParser if (($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 PdfIndirectObject::parse( $token, $token2, @@ -275,6 +298,14 @@ class PdfParser $this->streamReader ); case 'R': + if ($expectedType !== null && + $expectedType !== PdfIndirectObjectReference::class + ) { + throw new Type\PdfTypeException( + 'Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE + ); + } + return PdfIndirectObjectReference::create($token, $token2); } @@ -285,21 +316,62 @@ class PdfParser $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); } - if ('true' === $token || 'false' === $token) { - return PdfBoolean::create('true' === $token); + if ($token === 'true' || $token === 'false') { + $this->ensureExpectedType($token, $expectedType); + return PdfBoolean::create($token === 'true'); } - if ('null' === $token) { + 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; } } + + /** + * 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 + */ + private 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 index d81f46f076fb9b612b3f28d4e6e25689a8453c23..86f73c9b3bacefb11943fc686142ada6ccd4253b 100644 --- a/vendor/setasign/fpdi/src/PdfParser/PdfParserException.php +++ b/vendor/setasign/fpdi/src/PdfParser/PdfParserException.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser; diff --git a/vendor/setasign/fpdi/src/PdfParser/StreamReader.php b/vendor/setasign/fpdi/src/PdfParser/StreamReader.php index e3bd456059f2a214d41dcff90d0046df9ee87bb9..bda71a4c87692dd489d5e6c1c6849c8c18d31048 100644 --- a/vendor/setasign/fpdi/src/PdfParser/StreamReader.php +++ b/vendor/setasign/fpdi/src/PdfParser/StreamReader.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser; @@ -163,7 +162,7 @@ class StreamReader */ public function getBuffer($atOffset = true) { - if (false === $atOffset) { + if ($atOffset === false) { return $this->buffer; } @@ -184,7 +183,7 @@ class StreamReader */ public function getByte($position = null) { - $position = (int) (null !== $position ? $position : $this->offset); + $position = (int) ($position !== null ? $position : $this->offset); if ($position >= $this->bufferLength && (!$this->increaseLength() || $position >= $this->bufferLength) ) { @@ -206,7 +205,7 @@ class StreamReader */ public function readByte($position = null) { - if (null !== $position) { + 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)) { @@ -243,7 +242,7 @@ class StreamReader public function readBytes($length, $position = null) { $length = (int) $length; - if (null !== $position) { + 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); @@ -275,7 +274,7 @@ class StreamReader */ public function readLine($length = 1024) { - if (false === $this->ensureContent()) { + if ($this->ensureContent() === false) { return false; } @@ -372,7 +371,7 @@ class StreamReader */ public function getTotalLength() { - if (null === $this->totalLength) { + if ($this->totalLength === null) { $stat = \fstat($this->stream); $this->totalLength = $stat['size']; } @@ -394,7 +393,7 @@ class StreamReader */ public function reset($pos = 0, $length = 200) { - if (null === $pos) { + if ($pos === null) { $pos = $this->position + $this->offset; } elseif ($pos < 0) { $pos = \max(0, $this->getTotalLength() + $pos); diff --git a/vendor/setasign/fpdi/src/PdfParser/Tokenizer.php b/vendor/setasign/fpdi/src/PdfParser/Tokenizer.php index 500b247785e125d29f287fe6fc7df3c7f08e054b..f49f62e357b245ec9cc65ca02a814a73aa09b433 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Tokenizer.php +++ b/vendor/setasign/fpdi/src/PdfParser/Tokenizer.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser; @@ -75,7 +74,7 @@ class Tokenizer public function getNextToken() { $token = \array_pop($this->stack); - if (null !== $token) { + if ($token !== null) { return $token; } @@ -90,7 +89,7 @@ class Tokenizer $byte === "\x09" || $byte === "\x00" ) { - if (false === $this->leapWhiteSpaces()) { + if ($this->leapWhiteSpaces() === false) { return false; } $byte = $this->streamReader->readByte(); diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfArray.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfArray.php index 6ad096d8806b47568cca5180f84e860f985bcce3..bb203de4c8401dbfea0af286499a7a02f9414654 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfArray.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfArray.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -27,6 +26,7 @@ class PdfArray extends PdfType * @param Tokenizer $tokenizer * @param PdfParser $parser * @return bool|self + * @throws PdfTypeException */ public static function parse(Tokenizer $tokenizer, PdfParser $parser) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php index 0910d087ac31a58d07f9ebd51381a1c9ef23b07d..6fd42abf144114f23ed1cd03c95dfe8ae499e3ce 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -35,6 +34,7 @@ class PdfBoolean extends PdfType * * @param mixed $value * @return self + * @throws PdfTypeException */ public static function ensure($value) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php index b0a2ee0d190fd19c33a15d3203d3ebe1db05ac3b..49267ff9c6de426532f8072a4d0851baaaf69509 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -28,6 +27,7 @@ class PdfDictionary extends PdfType * @param StreamReader $streamReader * @param PdfParser $parser * @return bool|self + * @throws PdfTypeException */ public static function parse(Tokenizer $tokenizer, StreamReader $streamReader, PdfParser $parser) { @@ -41,7 +41,7 @@ class PdfDictionary extends PdfType } $key = $parser->readValue($token); - if (false === $key) { + if ($key === false) { return false; } @@ -62,7 +62,7 @@ class PdfDictionary extends PdfType $value = $parser->readValue(); - if (false === $value) { + if ($value === false) { return false; } @@ -106,6 +106,7 @@ class PdfDictionary extends PdfType * @param string $key * @param PdfType|mixed|null $default * @return PdfNull|PdfType + * @throws PdfTypeException */ public static function get($dictionary, $key, PdfType $default = null) { @@ -125,6 +126,7 @@ class PdfDictionary extends PdfType * * @param mixed $dictionary * @return self + * @throws PdfTypeException */ public static function ensure($dictionary) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfHexString.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfHexString.php index f6f44811eebaee6f6bada552d68c18a3917d781f..2eb9539c25a81bb325e4a230c9688f4050682904 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfHexString.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfHexString.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -36,7 +35,7 @@ class PdfHexString extends PdfType while (true) { $buffer = $streamReader->getBuffer(false); $pos = \strpos($buffer, '>', $bufferOffset); - if (false === $pos) { + if ($pos === false) { if (!$streamReader->increaseLength()) { return false; } @@ -74,6 +73,7 @@ class PdfHexString extends PdfType * * @param mixed $hexString * @return self + * @throws PdfTypeException */ public static function ensure($hexString) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObject.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObject.php index bbe42ffda851acb981197ba2df1c541b477939f1..046616a28d3ffde6644442f4d403b5ce3773e453 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObject.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObject.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -30,6 +29,7 @@ class PdfIndirectObject extends PdfType * @param Tokenizer $tokenizer * @param StreamReader $reader * @return bool|self + * @throws PdfTypeException */ public static function parse( $objectNumberToken, @@ -81,6 +81,7 @@ class PdfIndirectObject extends PdfType * * @param mixed $indirectObject * @return self + * @throws PdfTypeException */ public static function ensure($indirectObject) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObjectReference.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObjectReference.php index 02a2a62c60b5abe5997baca8d597fa8a2cb16abb..517199d558b3334c89ab85b2f6476930335d9856 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObjectReference.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfIndirectObjectReference.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -38,6 +37,7 @@ class PdfIndirectObjectReference extends PdfType * * @param mixed $value * @return self + * @throws PdfTypeException */ public static function ensure($value) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfName.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfName.php index dab2e07eecba8073faa8dde6986d44ca128b0b18..cb3ad51e901ed94a9fcfe74eb09432fa70a5d913 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfName.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfName.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -47,7 +46,7 @@ class PdfName extends PdfType */ static public function unescape($value) { - if (false === strpos($value, '#')) + if (strpos($value, '#') === false) return $value; return preg_replace_callback('/#[a-fA-F\d]{2}/', function($matches) { @@ -74,6 +73,7 @@ class PdfName extends PdfType * * @param mixed $name * @return self + * @throws PdfTypeException */ public static function ensure($name) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfNull.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfNull.php index fc97ac036c01a0f72dba02e86c97789c331e06e5..6d040a6b7a7d900244097e9aebd966964941bff8 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfNull.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfNull.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfNumeric.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfNumeric.php index ed6921f7ef2041bd13d32cd6697230e00e553c8b..fc3a4e112a63d6ce35bd53775bfd89e589014ea0 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfNumeric.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfNumeric.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -36,6 +35,7 @@ class PdfNumeric extends PdfType * * @param mixed $value * @return self + * @throws PdfTypeException */ public static function ensure($value) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfStream.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfStream.php index a3418ead6f1eafa160c5a66c605e528f01a134c7..eeec67f515d5cb170affc3ed5b736a612ee879fd 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfStream.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfStream.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -95,6 +94,7 @@ class PdfStream extends PdfType * * @param mixed $stream * @return self + * @throws PdfTypeException */ public static function ensure($stream) { @@ -120,6 +120,7 @@ class PdfStream extends PdfType * * @param bool $cache Whether cache the stream data or not. * @return bool|string + * @throws PdfTypeException */ public function getStream($cache = false) { @@ -130,7 +131,7 @@ class PdfStream extends PdfType while (true) { $buffer = $this->reader->getBuffer(false); $length = \strpos($buffer, 'endstream'); - if (false === $length) { + if ($length === false) { if (!$this->reader->increaseLength(100000)) { return false; } diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfString.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfString.php index 55852cc1f8b982124a86a3ce442d72fda784719b..9a3bb47eec09aabfa42b904dd0c5fadb67406d7f 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfString.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfString.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -73,6 +72,7 @@ class PdfString extends PdfType * * @param mixed $string * @return self + * @throws PdfTypeException */ public static function ensure($string) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfToken.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfToken.php index e9419027f4d33cd1540e1e7dbb3e69ce1c7c313f..89cf113fb18a005eadc31a5cc72dcf2a76de299d 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfToken.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfToken.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; @@ -36,6 +35,7 @@ class PdfToken extends PdfType * * @param mixed $token * @return self + * @throws PdfTypeException */ public static function ensure($token) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfType.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfType.php index 927f0f7bc33914c16999c7244058d702e6edb6b5..61aeb6ee919fb86af8c6c59a91cec79f561eb8d9 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfType.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfType.php @@ -3,14 +3,15 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; +use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException; use setasign\Fpdi\PdfParser\PdfParser; +use setasign\Fpdi\PdfParser\PdfParserException; /** * A class defining a PDF data type @@ -28,6 +29,8 @@ class PdfType * @param PdfParser $parser * @param bool $stopAtIndirectObject * @return PdfType + * @throws CrossReferenceException + * @throws PdfParserException */ public static function resolve(PdfType $value, PdfParser $parser, $stopAtIndirectObject = false) { diff --git a/vendor/setasign/fpdi/src/PdfParser/Type/PdfTypeException.php b/vendor/setasign/fpdi/src/PdfParser/Type/PdfTypeException.php index 9f59a589817552a79438bf2794e2ad483490a6a2..97de6463d5ef373c5fd7f939db4f295ae0735578 100644 --- a/vendor/setasign/fpdi/src/PdfParser/Type/PdfTypeException.php +++ b/vendor/setasign/fpdi/src/PdfParser/Type/PdfTypeException.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfParser\Type; diff --git a/vendor/setasign/fpdi/src/PdfReader/DataStructure/Rectangle.php b/vendor/setasign/fpdi/src/PdfReader/DataStructure/Rectangle.php index e11cb2ae8e7ff7f7bf80921fa0c67b38757c9b53..8ffa956237bfc3fc47f96d5940b7e3ec39b4a0d4 100644 --- a/vendor/setasign/fpdi/src/PdfReader/DataStructure/Rectangle.php +++ b/vendor/setasign/fpdi/src/PdfReader/DataStructure/Rectangle.php @@ -3,17 +3,19 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfReader\DataStructure; +use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException; use setasign\Fpdi\PdfParser\PdfParser; +use setasign\Fpdi\PdfParser\PdfParserException; use setasign\Fpdi\PdfParser\Type\PdfArray; use setasign\Fpdi\PdfParser\Type\PdfNumeric; use setasign\Fpdi\PdfParser\Type\PdfType; +use setasign\Fpdi\PdfParser\Type\PdfTypeException; /** * Class representing a rectangle @@ -48,6 +50,9 @@ class Rectangle * @param PdfArray|mixed $array * @param PdfParser $parser * @return Rectangle + * @throws PdfTypeException + * @throws CrossReferenceException + * @throws PdfParserException */ public static function byPdfArray($array, PdfParser $parser) { diff --git a/vendor/setasign/fpdi/src/PdfReader/Page.php b/vendor/setasign/fpdi/src/PdfReader/Page.php index f9f84355b60f063a8933b220f033984a43f637bb..64668297bb02446b2b20ca9c38081bb4d7a1bfd9 100644 --- a/vendor/setasign/fpdi/src/PdfReader/Page.php +++ b/vendor/setasign/fpdi/src/PdfReader/Page.php @@ -3,14 +3,15 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfReader; +use setasign\Fpdi\PdfParser\Filter\FilterException; use setasign\Fpdi\PdfParser\PdfParser; +use setasign\Fpdi\PdfParser\PdfParserException; use setasign\Fpdi\PdfParser\Type\PdfArray; use setasign\Fpdi\PdfParser\Type\PdfDictionary; use setasign\Fpdi\PdfParser\Type\PdfIndirectObject; @@ -18,7 +19,9 @@ use setasign\Fpdi\PdfParser\Type\PdfNull; use setasign\Fpdi\PdfParser\Type\PdfNumeric; use setasign\Fpdi\PdfParser\Type\PdfStream; use setasign\Fpdi\PdfParser\Type\PdfType; +use setasign\Fpdi\PdfParser\Type\PdfTypeException; use setasign\Fpdi\PdfReader\DataStructure\Rectangle; +use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException; /** * Class representing a page of a PDF document @@ -75,6 +78,9 @@ class Page * Get the dictionary of this page. * * @return PdfDictionary + * @throws PdfParserException + * @throws PdfTypeException + * @throws CrossReferenceException */ public function getPageDictionary() { @@ -91,6 +97,9 @@ class Page * @param string $name * @param bool $inherited * @return PdfType|null + * @throws PdfParserException + * @throws PdfTypeException + * @throws CrossReferenceException */ public function getAttribute($name, $inherited = true) { @@ -102,7 +111,7 @@ class Page $inheritedKeys = ['Resources', 'MediaBox', 'CropBox', 'Rotate']; if ($inherited && \in_array($name, $inheritedKeys, true)) { - if (null === $this->inheritedAttributes) { + if ($this->inheritedAttributes === null) { $this->inheritedAttributes = []; $inheritedKeys = \array_filter($inheritedKeys, function ($key) use ($dict) { return !isset($dict->value[$key]); @@ -140,6 +149,9 @@ class Page * Get the rotation value. * * @return int + * @throws PdfParserException + * @throws PdfTypeException + * @throws CrossReferenceException */ public function getRotation() { @@ -163,17 +175,20 @@ class 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 (null !== $value) { + if ($value !== null) { return Rectangle::byPdfArray($value, $this->parser); } - if (false === $fallback) { + if ($fallback === false) { return false; } @@ -195,11 +210,14 @@ class 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 (false === $boundary) { + if ($boundary === false) { return false; } @@ -217,6 +235,9 @@ class Page * * @return string * @throws PdfReaderException + * @throws PdfTypeException + * @throws FilterException + * @throws PdfParserException */ public function getContentStream() { diff --git a/vendor/setasign/fpdi/src/PdfReader/PageBoundaries.php b/vendor/setasign/fpdi/src/PdfReader/PageBoundaries.php index 2aeaada70dec95a822dea0a29988c1b9933eccb6..08e4224eaf1a11cc5167843c80ab9f86195c79e8 100644 --- a/vendor/setasign/fpdi/src/PdfReader/PageBoundaries.php +++ b/vendor/setasign/fpdi/src/PdfReader/PageBoundaries.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfReader; diff --git a/vendor/setasign/fpdi/src/PdfReader/PdfReader.php b/vendor/setasign/fpdi/src/PdfReader/PdfReader.php index 31da99c4e562a40ed686867d6199b0451b037b7b..f8f3419205597ea50ffb40b95bb79ea04cb2bbd6 100644 --- a/vendor/setasign/fpdi/src/PdfReader/PdfReader.php +++ b/vendor/setasign/fpdi/src/PdfReader/PdfReader.php @@ -3,19 +3,21 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfReader; +use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException; use setasign\Fpdi\PdfParser\PdfParser; +use setasign\Fpdi\PdfParser\PdfParserException; use setasign\Fpdi\PdfParser\Type\PdfArray; use setasign\Fpdi\PdfParser\Type\PdfDictionary; use setasign\Fpdi\PdfParser\Type\PdfIndirectObjectReference; use setasign\Fpdi\PdfParser\Type\PdfNumeric; use setasign\Fpdi\PdfParser\Type\PdfType; +use setasign\Fpdi\PdfParser\Type\PdfTypeException; /** * A PDF reader class @@ -76,6 +78,7 @@ class PdfReader * Get the PDF version. * * @return string + * @throws PdfParserException */ public function getPdfVersion() { @@ -86,6 +89,9 @@ class PdfReader * Get the page count. * * @return int + * @throws PdfTypeException + * @throws CrossReferenceException + * @throws PdfParserException */ public function getPageCount() { @@ -106,6 +112,10 @@ class PdfReader * * @param int $pageNumber * @return Page + * @throws PdfTypeException + * @throws CrossReferenceException + * @throws PdfParserException + * @throws \InvalidArgumentException */ public function getPage($pageNumber) { @@ -168,6 +178,10 @@ class PdfReader /** * Walk the page tree and resolve all indirect objects of all pages. + * + * @throws PdfTypeException + * @throws CrossReferenceException + * @throws PdfParserException */ protected function readPages() { diff --git a/vendor/setasign/fpdi/src/PdfReader/PdfReaderException.php b/vendor/setasign/fpdi/src/PdfReader/PdfReaderException.php index 37ce77d18cf9fc02f571953b0ef728a3542035aa..20413acced6e08ce882fea7d2b65ceb8180e2db8 100644 --- a/vendor/setasign/fpdi/src/PdfReader/PdfReaderException.php +++ b/vendor/setasign/fpdi/src/PdfReader/PdfReaderException.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi\PdfReader; diff --git a/vendor/setasign/fpdi/src/TcpdfFpdi.php b/vendor/setasign/fpdi/src/TcpdfFpdi.php index 519accf27797024add3d6499401f632b84760fe3..e71dc9d4ee9868823f96baf08d88d659cbb8b5de 100644 --- a/vendor/setasign/fpdi/src/TcpdfFpdi.php +++ b/vendor/setasign/fpdi/src/TcpdfFpdi.php @@ -3,260 +3,21 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ namespace setasign\Fpdi; -use setasign\Fpdi\PdfParser\CrossReference\CrossReferenceException; -use setasign\Fpdi\PdfParser\Filter\AsciiHex; -use setasign\Fpdi\PdfParser\Type\PdfHexString; -use setasign\Fpdi\PdfParser\Type\PdfIndirectObject; -use setasign\Fpdi\PdfParser\Type\PdfNull; -use setasign\Fpdi\PdfParser\Type\PdfNumeric; -use setasign\Fpdi\PdfParser\Type\PdfStream; -use setasign\Fpdi\PdfParser\Type\PdfString; -use setasign\Fpdi\PdfParser\Type\PdfType; - /** * Class TcpdfFpdi * * This class let you import pages of existing PDF documents into a reusable structure for TCPDF. * * @package setasign\Fpdi + * @deprecated Class was moved to \setasign\Fpdi\Tcpdf\Fpdi */ -class TcpdfFpdi extends \TCPDF +class TcpdfFpdi extends \setasign\Fpdi\Tcpdf\Fpdi { - use FpdiTrait { - writePdfType as fpdiWritePdfType; - useImportedPage as fpdiUseImportedPage; - } - - /** - * FPDI version - * - * @string - */ - const VERSION = '2.0.3'; - - /** - * A counter for template ids. - * - * @var int - */ - protected $templateId = 0; - - /** - * The currently used object number. - * - * @var int - */ - protected $currentObjectNumber; - - /** - * Get the next template id. - * - * @return int - */ - protected function getNextTemplateId() - { - return $this->templateId++; - } - - /** - * Draws an imported page onto the page or another template. - * - * Omit 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. - * - * Omit 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. - * - * Omit 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 - */ - protected function _getxobjectdict() - { - $out = parent::_getxobjectdict(); - - foreach ($this->importedPages as $key => $pageData) { - $out .= '/' . $pageData['id'] . ' ' . $pageData['objectNumber'] . ' 0 R '; - } - - return $out; - } - - /** - * @inheritdoc - */ - 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 - */ - 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 = \TCPDF_STATIC::_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 $value PdfIndirectObject - */ - $this->currentObjectNumber = $this->objectMap[$this->currentReaderId][$value->objectNumber]; - } - - $this->fpdiWritePdfType($value); - } + // this class is moved to \setasign\Fpdi\Tcpdf\Fpdi } diff --git a/vendor/setasign/fpdi/src/autoload.php b/vendor/setasign/fpdi/src/autoload.php index 64086bed84316e73cf49ec95fd1067212bb98f48..5fed74df1ca8340f386dcc3814417ffd1cfa04a0 100644 --- a/vendor/setasign/fpdi/src/autoload.php +++ b/vendor/setasign/fpdi/src/autoload.php @@ -3,10 +3,9 @@ * This file is part of FPDI * * @package setasign\Fpdi - * @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com) + * @copyright Copyright (c) 2018 Setasign - Jan Slabon (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License - * @version 2.0.3 - */ + */ spl_autoload_register(function ($class) { if (strpos($class, 'setasign\Fpdi\\') === 0) { diff --git a/vendor/slim/slim/Slim/App.php b/vendor/slim/slim/Slim/App.php index ba2aef40695fde23b49021b307e1cbbfeceed8d2..6bf64a0f904b3da4a710eb258f06d5ac99fdc97c 100644 --- a/vendor/slim/slim/Slim/App.php +++ b/vendor/slim/slim/Slim/App.php @@ -52,7 +52,7 @@ class App * * @var string */ - const VERSION = '3.10.0'; + const VERSION = '3.11.0'; /** * Container @@ -424,8 +424,10 @@ class App if (!headers_sent()) { // Headers foreach ($response->getHeaders() as $name => $values) { + $first = stripos($name, 'Set-Cookie') === 0 ? false : true; foreach ($values as $value) { - header(sprintf('%s: %s', $name, $value), false); + header(sprintf('%s: %s', $name, $value), $first); + $first = false; } } @@ -438,7 +440,7 @@ class App $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase() - )); + ), true, $response->getStatusCode()); } // Body diff --git a/vendor/slim/slim/Slim/Http/Request.php b/vendor/slim/slim/Slim/Http/Request.php index 3bda649b3353be17eb101839f99a7d3d771f4a20..2762ffc555054a64eb586fcdd59ca0ca22e8d973 100644 --- a/vendor/slim/slim/Slim/Http/Request.php +++ b/vendor/slim/slim/Slim/Http/Request.php @@ -1134,7 +1134,7 @@ class Request extends Message implements ServerRequestInterface * Note: This method is not part of the PSR-7 standard. * * @param string $key The parameter key. - * @param string $default The default value. + * @param mixed $default The default value. * * @return mixed The parameter value. */ @@ -1211,7 +1211,7 @@ class Request extends Message implements ServerRequestInterface $params = $this->getQueryParams(); $postParams = $this->getParsedBody(); if ($postParams) { - $params = array_merge($params, (array)$postParams); + $params = array_replace($params, (array)$postParams); } if ($only) { diff --git a/vendor/slim/slim/Slim/Http/Response.php b/vendor/slim/slim/Slim/Http/Response.php index d8fb8dcb02c7a2e96e94fd15cde0d3c6dde0c4de..9b5272e648c00c5e88155c9a7a794e1e7a735028 100644 --- a/vendor/slim/slim/Slim/Http/Response.php +++ b/vendor/slim/slim/Slim/Http/Response.php @@ -31,7 +31,7 @@ class Response extends Message implements ResponseInterface * * @var int */ - protected $status = 200; + protected $status = StatusCode::HTTP_OK; /** * Reason phrase @@ -47,74 +47,74 @@ class Response extends Message implements ResponseInterface */ protected static $messages = [ //Informational 1xx - 100 => 'Continue', - 101 => 'Switching Protocols', - 102 => 'Processing', + StatusCode::HTTP_CONTINUE => 'Continue', + StatusCode::HTTP_SWITCHING_PROTOCOLS => 'Switching Protocols', + StatusCode::HTTP_PROCESSING => 'Processing', //Successful 2xx - 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', + StatusCode::HTTP_OK => 'OK', + StatusCode::HTTP_CREATED => 'Created', + StatusCode::HTTP_ACCEPTED => 'Accepted', + StatusCode::HTTP_NONAUTHORITATIVE_INFORMATION => 'Non-Authoritative Information', + StatusCode::HTTP_NO_CONTENT => 'No Content', + StatusCode::HTTP_RESET_CONTENT => 'Reset Content', + StatusCode::HTTP_PARTIAL_CONTENT => 'Partial Content', + StatusCode::HTTP_MULTI_STATUS => 'Multi-Status', + StatusCode::HTTP_ALREADY_REPORTED => 'Already Reported', + StatusCode::HTTP_IM_USED => 'IM Used', //Redirection 3xx - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 306 => '(Unused)', - 307 => 'Temporary Redirect', - 308 => 'Permanent Redirect', + StatusCode::HTTP_MULTIPLE_CHOICES => 'Multiple Choices', + StatusCode::HTTP_MOVED_PERMANENTLY => 'Moved Permanently', + StatusCode::HTTP_FOUND => 'Found', + StatusCode::HTTP_SEE_OTHER => 'See Other', + StatusCode::HTTP_NOT_MODIFIED => 'Not Modified', + StatusCode::HTTP_USE_PROXY => 'Use Proxy', + StatusCode::HTTP_UNUSED => '(Unused)', + StatusCode::HTTP_TEMPORARY_REDIRECT => 'Temporary Redirect', + StatusCode::HTTP_PERMANENT_REDIRECT => 'Permanent Redirect', //Client Error 4xx - 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 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - 418 => 'I\'m a teapot', - 421 => 'Misdirected Request', - 422 => 'Unprocessable Entity', - 423 => 'Locked', - 424 => 'Failed Dependency', - 426 => 'Upgrade Required', - 428 => 'Precondition Required', - 429 => 'Too Many Requests', - 431 => 'Request Header Fields Too Large', - 444 => 'Connection Closed Without Response', - 451 => 'Unavailable For Legal Reasons', - 499 => 'Client Closed Request', + StatusCode::HTTP_BAD_REQUEST => 'Bad Request', + StatusCode::HTTP_UNAUTHORIZED => 'Unauthorized', + StatusCode::HTTP_PAYMENT_REQUIRED => 'Payment Required', + StatusCode::HTTP_FORBIDDEN => 'Forbidden', + StatusCode::HTTP_NOT_FOUND => 'Not Found', + StatusCode::HTTP_METHOD_NOT_ALLOWED => 'Method Not Allowed', + StatusCode::HTTP_NOT_ACCEPTABLE => 'Not Acceptable', + StatusCode::HTTP_PROXY_AUTHENTICATION_REQUIRED => 'Proxy Authentication Required', + StatusCode::HTTP_REQUEST_TIMEOUT => 'Request Timeout', + StatusCode::HTTP_CONFLICT => 'Conflict', + StatusCode::HTTP_GONE => 'Gone', + StatusCode::HTTP_LENGTH_REQUIRED => 'Length Required', + StatusCode::HTTP_PRECONDITION_FAILED => 'Precondition Failed', + StatusCode::HTTP_REQUEST_ENTITY_TOO_LARGE => 'Request Entity Too Large', + StatusCode::HTTP_REQUEST_URI_TOO_LONG => 'Request-URI Too Long', + StatusCode::HTTP_UNSUPPORTED_MEDIA_TYPE => 'Unsupported Media Type', + StatusCode::HTTP_REQUESTED_RANGE_NOT_SATISFIABLE => 'Requested Range Not Satisfiable', + StatusCode::HTTP_EXPECTATION_FAILED => 'Expectation Failed', + StatusCode::HTTP_IM_A_TEAPOT => 'I\'m a teapot', + StatusCode::HTTP_MISDIRECTED_REQUEST => 'Misdirected Request', + StatusCode::HTTP_UNPROCESSABLE_ENTITY => 'Unprocessable Entity', + StatusCode::HTTP_LOCKED => 'Locked', + StatusCode::HTTP_FAILED_DEPENDENCY => 'Failed Dependency', + StatusCode::HTTP_UPGRADE_REQUIRED => 'Upgrade Required', + StatusCode::HTTP_PRECONDITION_REQUIRED => 'Precondition Required', + StatusCode::HTTP_TOO_MANY_REQUESTS => 'Too Many Requests', + StatusCode::HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE => 'Request Header Fields Too Large', + StatusCode::HTTP_CONNECTION_CLOSED_WITHOUT_RESPONSE => 'Connection Closed Without Response', + StatusCode::HTTP_UNAVAILABLE_FOR_LEGAL_REASONS => 'Unavailable For Legal Reasons', + StatusCode::HTTP_CLIENT_CLOSED_REQUEST => 'Client Closed Request', //Server Error 5xx - 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', - 599 => 'Network Connect Timeout Error', + StatusCode::HTTP_INTERNAL_SERVER_ERROR => 'Internal Server Error', + StatusCode::HTTP_NOT_IMPLEMENTED => 'Not Implemented', + StatusCode::HTTP_BAD_GATEWAY => 'Bad Gateway', + StatusCode::HTTP_SERVICE_UNAVAILABLE => 'Service Unavailable', + StatusCode::HTTP_GATEWAY_TIMEOUT => 'Gateway Timeout', + StatusCode::HTTP_VERSION_NOT_SUPPORTED => 'HTTP Version Not Supported', + StatusCode::HTTP_VARIANT_ALSO_NEGOTIATES => 'Variant Also Negotiates', + StatusCode::HTTP_INSUFFICIENT_STORAGE => 'Insufficient Storage', + StatusCode::HTTP_LOOP_DETECTED => 'Loop Detected', + StatusCode::HTTP_NOT_EXTENDED => 'Not Extended', + StatusCode::HTTP_NETWORK_AUTHENTICATION_REQUIRED => 'Network Authentication Required', + StatusCode::HTTP_NETWORK_CONNECTION_TIMEOUT_ERROR => 'Network Connect Timeout Error', ]; /** @@ -122,7 +122,7 @@ class Response extends Message implements ResponseInterface * * @var string */ - const EOL = "\r\n"; + const EOL = "\r\n"; /** * Create new HTTP response. @@ -131,8 +131,11 @@ class Response extends Message implements ResponseInterface * @param HeadersInterface|null $headers The response headers. * @param StreamInterface|null $body The response body. */ - public function __construct($status = 200, HeadersInterface $headers = null, StreamInterface $body = null) - { + public function __construct( + $status = StatusCode::HTTP_OK, + HeadersInterface $headers = null, + StreamInterface $body = null + ) { $this->status = $this->filterStatus($status); $this->headers = $headers ? $headers : new Headers(); $this->body = $body ? $body : new Body(fopen('php://temp', 'r+')); @@ -218,7 +221,10 @@ class Response extends Message implements ResponseInterface */ protected function filterStatus($status) { - if (!is_integer($status) || $status<100 || $status>599) { + if (!is_integer($status) || + $status<StatusCode::HTTP_CONTINUE || + $status>StatusCode::HTTP_NETWORK_CONNECTION_TIMEOUT_ERROR + ) { throw new InvalidArgumentException('Invalid HTTP status code'); } @@ -269,8 +275,8 @@ class Response extends Message implements ResponseInterface $clone = clone $this; $clone->headers->set($name, $value); - if ($clone->getStatusCode() === 200 && strtolower($name) === 'location') { - $clone = $clone->withStatus(302); + if ($clone->getStatusCode() === StatusCode::HTTP_OK && strtolower($name) === 'location') { + $clone = $clone->withStatus(StatusCode::HTTP_FOUND); } return $clone; @@ -318,8 +324,8 @@ class Response extends Message implements ResponseInterface { $responseWithRedirect = $this->withHeader('Location', (string)$url); - if (is_null($status) && $this->getStatusCode() === 200) { - $status = 302; + if (is_null($status) && $this->getStatusCode() === StatusCode::HTTP_OK) { + $status = StatusCode::HTTP_FOUND; } if (!is_null($status)) { @@ -369,7 +375,10 @@ class Response extends Message implements ResponseInterface */ public function isEmpty() { - return in_array($this->getStatusCode(), [204, 205, 304]); + return in_array( + $this->getStatusCode(), + [StatusCode::HTTP_NO_CONTENT, StatusCode::HTTP_RESET_CONTENT, StatusCode::HTTP_NOT_MODIFIED] + ); } /** @@ -381,7 +390,7 @@ class Response extends Message implements ResponseInterface */ public function isInformational() { - return $this->getStatusCode() >= 100 && $this->getStatusCode() < 200; + return $this->getStatusCode() >= StatusCode::HTTP_CONTINUE && $this->getStatusCode() < StatusCode::HTTP_OK; } /** @@ -393,7 +402,7 @@ class Response extends Message implements ResponseInterface */ public function isOk() { - return $this->getStatusCode() === 200; + return $this->getStatusCode() === StatusCode::HTTP_OK; } /** @@ -405,7 +414,8 @@ class Response extends Message implements ResponseInterface */ public function isSuccessful() { - return $this->getStatusCode() >= 200 && $this->getStatusCode() < 300; + return $this->getStatusCode() >= StatusCode::HTTP_OK && + $this->getStatusCode() < StatusCode::HTTP_MULTIPLE_CHOICES; } /** @@ -417,7 +427,16 @@ class Response extends Message implements ResponseInterface */ public function isRedirect() { - return in_array($this->getStatusCode(), [301, 302, 303, 307]); + return in_array( + $this->getStatusCode(), + [ + StatusCode::HTTP_MOVED_PERMANENTLY, + StatusCode::HTTP_FOUND, + StatusCode::HTTP_SEE_OTHER, + StatusCode::HTTP_TEMPORARY_REDIRECT, + StatusCode::HTTP_PERMANENT_REDIRECT + ] + ); } /** @@ -429,7 +448,8 @@ class Response extends Message implements ResponseInterface */ public function isRedirection() { - return $this->getStatusCode() >= 300 && $this->getStatusCode() < 400; + return $this->getStatusCode() >= StatusCode::HTTP_MULTIPLE_CHOICES && + $this->getStatusCode() < StatusCode::HTTP_BAD_REQUEST; } /** @@ -442,7 +462,7 @@ class Response extends Message implements ResponseInterface */ public function isForbidden() { - return $this->getStatusCode() === 403; + return $this->getStatusCode() === StatusCode::HTTP_FORBIDDEN; } /** @@ -454,7 +474,7 @@ class Response extends Message implements ResponseInterface */ public function isNotFound() { - return $this->getStatusCode() === 404; + return $this->getStatusCode() === StatusCode::HTTP_NOT_FOUND; } /** @@ -466,7 +486,8 @@ class Response extends Message implements ResponseInterface */ public function isClientError() { - return $this->getStatusCode() >= 400 && $this->getStatusCode() < 500; + return $this->getStatusCode() >= StatusCode::HTTP_BAD_REQUEST && + $this->getStatusCode() < StatusCode::HTTP_INTERNAL_SERVER_ERROR; } /** @@ -478,7 +499,7 @@ class Response extends Message implements ResponseInterface */ public function isServerError() { - return $this->getStatusCode() >= 500 && $this->getStatusCode() < 600; + return $this->getStatusCode() >= StatusCode::HTTP_INTERNAL_SERVER_ERROR && $this->getStatusCode() < 600; } /** diff --git a/vendor/slim/slim/Slim/Http/UploadedFile.php b/vendor/slim/slim/Slim/Http/UploadedFile.php index ae5dfb65e593c491afe3e8e495143b869bdda62d..431ef2d3faf24c5b198609c28db4df66b3560e96 100644 --- a/vendor/slim/slim/Slim/Http/UploadedFile.php +++ b/vendor/slim/slim/Slim/Http/UploadedFile.php @@ -177,7 +177,7 @@ class UploadedFile implements UploadedFileInterface public function getStream() { if ($this->moved) { - throw new \RuntimeException(sprintf('Uploaded file %1s has already been moved', $this->name)); + throw new \RuntimeException(sprintf('Uploaded file %s has already been moved', $this->name)); } if ($this->stream === null) { $this->stream = new Stream(fopen($this->file, 'r')); @@ -233,22 +233,22 @@ class UploadedFile implements UploadedFileInterface if ($targetIsStream) { if (!copy($this->file, $targetPath)) { - throw new RuntimeException(sprintf('Error moving uploaded file %1s to %2s', $this->name, $targetPath)); + throw new RuntimeException(sprintf('Error moving uploaded file %s to %s', $this->name, $targetPath)); } if (!unlink($this->file)) { - throw new RuntimeException(sprintf('Error removing uploaded file %1s', $this->name)); + throw new RuntimeException(sprintf('Error removing uploaded file %s', $this->name)); } } elseif ($this->sapi) { if (!is_uploaded_file($this->file)) { - throw new RuntimeException(sprintf('%1s is not a valid uploaded file', $this->file)); + throw new RuntimeException(sprintf('%s is not a valid uploaded file', $this->file)); } if (!move_uploaded_file($this->file, $targetPath)) { - throw new RuntimeException(sprintf('Error moving uploaded file %1s to %2s', $this->name, $targetPath)); + throw new RuntimeException(sprintf('Error moving uploaded file %s to %s', $this->name, $targetPath)); } } else { if (!rename($this->file, $targetPath)) { - throw new RuntimeException(sprintf('Error moving uploaded file %1s to %2s', $this->name, $targetPath)); + throw new RuntimeException(sprintf('Error moving uploaded file %s to %s', $this->name, $targetPath)); } } diff --git a/vendor/slim/slim/Slim/Http/Uri.php b/vendor/slim/slim/Slim/Http/Uri.php index fb0f04b5c3e9de7440b0342343bc693bc1d23a20..7e168a66013327f78cc5e0ef81390a899125660f 100644 --- a/vendor/slim/slim/Slim/Http/Uri.php +++ b/vendor/slim/slim/Slim/Http/Uri.php @@ -173,15 +173,17 @@ class Uri implements UriInterface $username = $env->get('PHP_AUTH_USER', ''); $password = $env->get('PHP_AUTH_PW', ''); - // Authority: Host + // Authority: Host and Port if ($env->has('HTTP_HOST')) { $host = $env->get('HTTP_HOST'); + // set a port default + $port = null; } else { $host = $env->get('SERVER_NAME'); + // set a port default + $port = (int)$env->get('SERVER_PORT', 80); } - // Authority: Port - $port = (int)$env->get('SERVER_PORT', 80); if (preg_match('/^(\[[a-fA-F0-9:.]+\])(:\d+)?\z/', $host, $matches)) { $host = $matches[1]; @@ -338,7 +340,7 @@ class Uri implements UriInterface $host = $this->getHost(); $port = $this->getPort(); - return ($userInfo ? $userInfo . '@' : '') . $host . ($port !== null ? ':' . $port : ''); + return ($userInfo !== '' ? $userInfo . '@' : '') . $host . ($port !== null ? ':' . $port : ''); } /** @@ -358,7 +360,7 @@ class Uri implements UriInterface */ public function getUserInfo() { - return $this->user . ($this->password ? ':' . $this->password : ''); + return $this->user . ($this->password !== '' ? ':' . $this->password : ''); } /** @@ -379,8 +381,8 @@ class Uri implements UriInterface { $clone = clone $this; $clone->user = $this->filterUserInfo($user); - if ($clone->user) { - $clone->password = $password ? $this->filterUserInfo($password) : ''; + if ('' !== $clone->user) { + $clone->password = !in_array($password, [null, ''], true) ? $this->filterUserInfo($password) : ''; } else { $clone->password = ''; } @@ -812,11 +814,11 @@ class Uri implements UriInterface $path = $basePath . '/' . ltrim($path, '/'); - return ($scheme ? $scheme . ':' : '') - . ($authority ? '//' . $authority : '') + return ($scheme !== '' ? $scheme . ':' : '') + . ($authority !== '' ? '//' . $authority : '') . $path - . ($query ? '?' . $query : '') - . ($fragment ? '#' . $fragment : ''); + . ($query !== '' ? '?' . $query : '') + . ($fragment !== '' ? '#' . $fragment : ''); } /** @@ -834,11 +836,11 @@ class Uri implements UriInterface $authority = $this->getAuthority(); $basePath = $this->getBasePath(); - if ($authority && substr($basePath, 0, 1) !== '/') { + if ($authority !== '' && substr($basePath, 0, 1) !== '/') { $basePath = $basePath . '/' . $basePath; } - return ($scheme ? $scheme . ':' : '') + return ($scheme !== '' ? $scheme . ':' : '') . ($authority ? '//' . $authority : '') . rtrim($basePath, '/'); } diff --git a/vendor/slim/slim/Slim/Route.php b/vendor/slim/slim/Slim/Route.php index fa8be4e44688acbc2e62682c6565f06c1925030d..117c0998397492c8a296d24e92457af40364e9fd 100644 --- a/vendor/slim/slim/Slim/Route.php +++ b/vendor/slim/slim/Slim/Route.php @@ -68,6 +68,13 @@ class Route extends Routable implements RouteInterface */ protected $arguments = []; + /** + * Route arguments parameters + * + * @var null|array + */ + protected $savedArguments = []; + /** * The callable payload * @@ -193,6 +200,8 @@ class Route extends Routable implements RouteInterface * * @param boolean|string $mode * + * @return self + * * @throws InvalidArgumentException If an unknown buffering mode is specified */ public function setOutputBuffering($mode) @@ -201,6 +210,7 @@ class Route extends Routable implements RouteInterface throw new InvalidArgumentException('Unknown output buffering mode'); } $this->outputBuffering = $mode; + return $this; } /** @@ -226,11 +236,15 @@ class Route extends Routable implements RouteInterface * * @param string $name * @param string $value + * @param bool $includeInSavedArguments * * @return self */ - public function setArgument($name, $value) + public function setArgument($name, $value, $includeInSavedArguments = true) { + if ($includeInSavedArguments) { + $this->savedArguments[$name] = $value; + } $this->arguments[$name] = $value; return $this; } @@ -239,11 +253,15 @@ class Route extends Routable implements RouteInterface * Replace route arguments * * @param array $arguments + * @param bool $includeInSavedArguments * * @return self */ - public function setArguments(array $arguments) + public function setArguments(array $arguments, $includeInSavedArguments = true) { + if ($includeInSavedArguments) { + $this->savedArguments = $arguments; + } $this->arguments = $arguments; return $this; } @@ -286,9 +304,12 @@ class Route extends Routable implements RouteInterface */ public function prepare(ServerRequestInterface $request, array $arguments) { - // Add the arguments + // Remove temp arguments + $this->setArguments($this->savedArguments); + + // Add the route arguments foreach ($arguments as $k => $v) { - $this->setArgument($k, $v); + $this->setArgument($k, $v, false); } } diff --git a/vendor/slim/slim/composer.json b/vendor/slim/slim/composer.json index 554a838a95d5d15008f1196743205a01c3922ab3..db3a11a974045159eba743ff7d1856668f6f023e 100644 --- a/vendor/slim/slim/composer.json +++ b/vendor/slim/slim/composer.json @@ -47,12 +47,15 @@ "Slim\\": "Slim" } }, + "autoload-dev": { + "files": [ + "tests/Assets/HeaderFunctions.php" + ] + }, "scripts": { "test": [ - "@phpunit", - "@phpcs" - ], - "phpunit": "php vendor/bin/phpunit", - "phpcs": "php vendor/bin/phpcs" + "phpunit", + "phpcs" + ] } } diff --git a/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php b/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php index 60317243e9c4f937e6f181f079c0eda0cdb1ef93..dca9cb496b24125ad579bb68a8b79cc2c92b86be 100644 --- a/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php +++ b/vendor/symfony/options-resolver/Debug/OptionsResolverIntrospector.php @@ -41,62 +41,50 @@ class OptionsResolverIntrospector } /** - * @param string $option - * * @return mixed * * @throws NoConfigurationException on no configured value */ - public function getDefault($option) + public function getDefault(string $option) { - return call_user_func($this->get, 'defaults', $option, sprintf('No default value was set for the "%s" option.', $option)); + return \call_user_func($this->get, 'defaults', $option, sprintf('No default value was set for the "%s" option.', $option)); } /** - * @param string $option - * * @return \Closure[] * * @throws NoConfigurationException on no configured closures */ - public function getLazyClosures($option) + public function getLazyClosures(string $option): array { - return call_user_func($this->get, 'lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option)); + return \call_user_func($this->get, 'lazy', $option, sprintf('No lazy closures were set for the "%s" option.', $option)); } /** - * @param string $option - * * @return string[] * * @throws NoConfigurationException on no configured types */ - public function getAllowedTypes($option) + public function getAllowedTypes(string $option): array { - return call_user_func($this->get, 'allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option)); + return \call_user_func($this->get, 'allowedTypes', $option, sprintf('No allowed types were set for the "%s" option.', $option)); } /** - * @param string $option - * * @return mixed[] * * @throws NoConfigurationException on no configured values */ - public function getAllowedValues($option) + public function getAllowedValues(string $option): array { - return call_user_func($this->get, 'allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option)); + return \call_user_func($this->get, 'allowedValues', $option, sprintf('No allowed values were set for the "%s" option.', $option)); } /** - * @param string $option - * - * @return \Closure - * * @throws NoConfigurationException on no configured normalizer */ - public function getNormalizer($option) + public function getNormalizer(string $option): \Closure { - return call_user_func($this->get, 'normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option)); + return \call_user_func($this->get, 'normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option)); } } diff --git a/vendor/symfony/options-resolver/OptionsResolver.php b/vendor/symfony/options-resolver/OptionsResolver.php index a58f45c0a65888ecd7692afddc862674f17fa034..5dd026f7a0f80b44839faa0858e88dea2d860960 100644 --- a/vendor/symfony/options-resolver/OptionsResolver.php +++ b/vendor/symfony/options-resolver/OptionsResolver.php @@ -353,11 +353,9 @@ class OptionsResolver implements Options * * The normalizer should be a closure with the following signature: * - * ```php - * function (Options $options, $value) { - * // ... - * } - * ``` + * function (Options $options, $value) { + * // ... + * } * * The closure is invoked when {@link resolve()} is called. The closure * has access to the resolved values of other options through the passed @@ -383,11 +381,7 @@ class OptionsResolver implements Options } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } $this->normalizers[$option] = $normalizer; @@ -426,11 +420,7 @@ class OptionsResolver implements Options } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } $this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : array($allowedValues); @@ -471,14 +461,10 @@ class OptionsResolver implements Options } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } - if (!is_array($allowedValues)) { + if (!\is_array($allowedValues)) { $allowedValues = array($allowedValues); } @@ -516,11 +502,7 @@ class OptionsResolver implements Options } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } $this->allowedTypes[$option] = (array) $allowedTypes; @@ -555,11 +537,7 @@ class OptionsResolver implements Options } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } if (!isset($this->allowedTypes[$option])) { @@ -660,15 +638,11 @@ class OptionsResolver implements Options // Make sure that no unknown options are passed $diff = array_diff_key($options, $clone->defined); - if (count($diff) > 0) { + if (\count($diff) > 0) { ksort($clone->defined); ksort($diff); - throw new UndefinedOptionsException(sprintf( - (count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', - implode('", "', array_keys($diff)), - implode('", "', array_keys($clone->defined)) - )); + throw new UndefinedOptionsException(sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', implode('", "', array_keys($diff)), implode('", "', array_keys($clone->defined)))); } // Override options set by the user @@ -680,13 +654,10 @@ class OptionsResolver implements Options // Check whether any required option is missing $diff = array_diff_key($clone->required, $clone->defaults); - if (count($diff) > 0) { + if (\count($diff) > 0) { ksort($diff); - throw new MissingOptionsException(sprintf( - count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', - implode('", "', array_keys($diff)) - )); + throw new MissingOptionsException(sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', implode('", "', array_keys($diff)))); } // Lock the container @@ -730,17 +701,10 @@ class OptionsResolver implements Options // Check whether the option is set at all if (!array_key_exists($option, $this->defaults)) { if (!isset($this->defined[$option])) { - throw new NoSuchOptionException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new NoSuchOptionException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } - throw new NoSuchOptionException(sprintf( - 'The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', - $option - )); + throw new NoSuchOptionException(sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $option)); } $value = $this->defaults[$option]; @@ -750,10 +714,7 @@ class OptionsResolver implements Options // If the closure is already being called, we have a cyclic // dependency if (isset($this->calling[$option])) { - throw new OptionDefinitionException(sprintf( - 'The options "%s" have a cyclic dependency.', - implode('", "', array_keys($this->calling)) - )); + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } // The following section must be protected from cyclic @@ -809,7 +770,9 @@ class OptionsResolver implements Options // Don't include closures in the exception message continue; - } elseif ($value === $allowedValue) { + } + + if ($value === $allowedValue) { $success = true; break; } @@ -824,7 +787,7 @@ class OptionsResolver implements Options $this->formatValue($value) ); - if (count($printableAllowedValues) > 0) { + if (\count($printableAllowedValues) > 0) { $message .= sprintf( ' Accepted values are: %s.', $this->formatValues($printableAllowedValues) @@ -840,10 +803,7 @@ class OptionsResolver implements Options // If the closure is already being called, we have a cyclic // dependency if (isset($this->calling[$option])) { - throw new OptionDefinitionException(sprintf( - 'The options "%s" have a cyclic dependency.', - implode('", "', array_keys($this->calling)) - )); + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } $normalizer = $this->normalizers[$option]; @@ -867,14 +827,7 @@ class OptionsResolver implements Options return $value; } - /** - * @param string $type - * @param mixed $value - * @param array &$invalidTypes - * - * @return bool - */ - private function verifyTypes($type, $value, array &$invalidTypes) + private function verifyTypes(string $type, $value, array &$invalidTypes): bool { if (\is_array($value) && '[]' === substr($type, -2)) { return $this->verifyArrayType($type, $value, $invalidTypes); @@ -891,10 +844,7 @@ class OptionsResolver implements Options return false; } - /** - * @return bool - */ - private function verifyArrayType($type, array $value, array &$invalidTypes, $level = 0) + private function verifyArrayType(string $type, array $value, array &$invalidTypes, int $level = 0): bool { $type = substr($type, 0, -2); @@ -988,7 +938,7 @@ class OptionsResolver implements Options throw new AccessException('Counting is only supported within closures of lazy options and normalizers.'); } - return count($this->defaults); + return \count($this->defaults); } /** @@ -999,16 +949,13 @@ class OptionsResolver implements Options * parameters should usually not be included in messages aimed at * non-technical people. * - * @param mixed $value The value to return the type of - * @param string $type - * - * @return string The type of the value + * @param mixed $value The value to return the type of */ - private function formatTypeOf($value, $type) + private function formatTypeOf($value, ?string $type): string { $suffix = ''; - if ('[]' === substr($type, -2)) { + if (null !== $type && '[]' === substr($type, -2)) { $suffix = '[]'; $type = substr($type, 0, -2); while ('[]' === substr($type, -2)) { @@ -1030,7 +977,7 @@ class OptionsResolver implements Options } } - return (\is_object($value) ? get_class($value) : gettype($value)).$suffix; + return (\is_object($value) ? \get_class($value) : \gettype($value)).$suffix; } /** @@ -1041,13 +988,11 @@ class OptionsResolver implements Options * in double quotes ("). * * @param mixed $value The value to format as string - * - * @return string The string representation of the passed value */ - private function formatValue($value) + private function formatValue($value): string { if (\is_object($value)) { - return get_class($value); + return \get_class($value); } if (\is_array($value)) { @@ -1083,13 +1028,9 @@ class OptionsResolver implements Options * Each of the values is converted to a string using * {@link formatValue()}. The values are then concatenated with commas. * - * @param array $values A list of values - * - * @return string The string representation of the value list - * * @see formatValue() */ - private function formatValues(array $values) + private function formatValues(array $values): string { foreach ($values as $key => $value) { $values[$key] = $this->formatValue($value); @@ -1098,24 +1039,8 @@ class OptionsResolver implements Options return implode(', ', $values); } - private static function isValueValidType($type, $value) - { - return (function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type; - } - - /** - * @return array - */ - private function getInvalidValues(array $arrayValues, $type) + private static function isValueValidType(string $type, $value): bool { - $invalidValues = array(); - - foreach ($arrayValues as $key => $value) { - if (!self::isValueValidType($type, $value)) { - $invalidValues[$key] = $value; - } - } - - return $invalidValues; + return (\function_exists($isFunction = 'is_'.$type) && $isFunction($value)) || $value instanceof $type; } } diff --git a/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php b/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php index ac129844476042b609648f551b7b7019b47b1cec..449a53f6eb5e5ee2aba4ef78c7ca81dd1fad1257 100644 --- a/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php +++ b/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php @@ -1584,7 +1584,7 @@ class OptionsResolverTest extends TestCase $this->resolver->setDefined('bar'); $this->resolver->setDefault('lazy1', function () {}); - count($this->resolver); + \count($this->resolver); } public function testNestedArrays() diff --git a/vendor/symfony/options-resolver/composer.json b/vendor/symfony/options-resolver/composer.json index 895847ea5add7aaa90fac5fe7ed6e7841b484066..e78b66f25c1056066fd1206a5e45cfc53241f3e2 100644 --- a/vendor/symfony/options-resolver/composer.json +++ b/vendor/symfony/options-resolver/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "autoload": { "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" }, @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.1-dev" } } } diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php index 4bd326e5f6e89c2ca7df31ab3247fd0a63d8bc7c..a5e4a8fde4bdee4cd0036a1bf85490c6fdb9d789 100644 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ b/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -44,7 +44,7 @@ namespace Symfony\Polyfill\Mbstring; * - mb_strrchr - Finds the last occurrence of a character in a string within another * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive - * - mb_strstr - Finds first occurrence of a string within anothers + * - mb_strstr - Finds first occurrence of a string within another * - mb_strwidth - Return width of string * - mb_substr_count - Count the number of substring occurrences * @@ -72,8 +72,8 @@ final class Mbstring private static $language = 'neutral'; private static $internalEncoding = 'UTF-8'; private static $caseFold = array( - array('µ','Å¿',"\xCD\x85",'Ï‚',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"), - array('μ','s','ι', 'σ','β', 'θ', 'φ', 'Ï€', 'κ', 'Ï', 'ε', "\xE1\xB9\xA1",'ι'), + array('µ', 'Å¿', "\xCD\x85", 'Ï‚', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"), + array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'Ï€', 'κ', 'Ï', 'ε', "\xE1\xB9\xA1", 'ι'), ); public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) @@ -141,7 +141,8 @@ final class Mbstring public static function mb_decode_numericentity($s, $convmap, $encoding = null) { if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING); + return null; } @@ -150,7 +151,8 @@ final class Mbstring } if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); + return ''; // Instead of null (cf. mb_encode_numericentity). } @@ -185,6 +187,7 @@ final class Mbstring return Mbstring::mb_chr($c - $convmap[$i + 2]); } } + return $m[0]; }, $s); @@ -198,7 +201,8 @@ final class Mbstring public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) { if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING); + return null; } @@ -207,12 +211,14 @@ final class Mbstring } if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); + return null; // Instead of '' (cf. mb_decode_numericentity). } if (null !== $is_hex && !\is_scalar($is_hex)) { - trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING); + return null; } @@ -281,8 +287,11 @@ final class Mbstring } if (MB_CASE_TITLE == $mode) { - $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s); - $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s); + static $titleRegexp = null; + if (null === $titleRegexp) { + $titleRegexp = self::getData('titleCaseRegexp'); + } + $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s); } else { if (MB_CASE_UPPER == $mode) { static $upper = null; @@ -324,7 +333,7 @@ final class Mbstring } else { $s = substr_replace($s, $uchr, $i - $ulen, $ulen); $len += $nlen - $ulen; - $i += $nlen - $ulen; + $i += $nlen - $ulen; } } } @@ -452,6 +461,7 @@ final class Mbstring if (strncmp($enc, 'ISO-8859-', 9)) { return false; } + // no break case 'ASCII': case 'UTF8': case 'UTF-8': @@ -701,6 +711,10 @@ final class Mbstring $s = mb_convert_encoding($s, 'UTF-8', $encoding); } + if (1 === \strlen($s)) { + return \ord($s); + } + $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; if (0xF0 <= $code) { return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; @@ -752,14 +766,9 @@ final class Mbstring return $entities; } - private static function title_case_lower(array $s) - { - return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8'); - } - - private static function title_case_upper(array $s) + private static function title_case(array $s) { - return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8'); + return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8'); } private static function getData($file) diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php index 3ca16416a82580b15bd446ba5cf75dc3d87fa922..e6fbfa64e6215a3e572d3d99f794cc6a85ea8af8 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php @@ -1,6 +1,6 @@ <?php -static $data = array ( +return array( 'A' => 'a', 'B' => 'b', 'C' => 'c', @@ -1094,8 +1094,3 @@ static $data = array ( 'ð‘¢¾' => '𑣞', '𑢿' => '𑣟', ); - -$result =& $data; -unset($data); - -return $result; diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php index ec9422121cae73c8baa8d0cfc695897a5c091961..b8103b2e808dd0a670c04868f20edcc969ea7e70 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.php @@ -1,6 +1,6 @@ <?php -static $data = array ( +return array( 'a' => 'A', 'b' => 'B', 'c' => 'C', @@ -1102,8 +1102,3 @@ static $data = array ( '𑣞' => 'ð‘¢¾', '𑣟' => '𑢿', ); - -$result =& $data; -unset($data); - -return $result; diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index 49b720dd81e2c2286cd0faf81182dfca43e7776d..50ea12f1bbb09226c9ee9abc9c3c33d8655af2b2 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -28,7 +28,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } } } diff --git a/vendor/tecnickcom/tcpdf/CHANGELOG.TXT b/vendor/tecnickcom/tcpdf/CHANGELOG.TXT index d6e4cf05e91a428a21c8fdf4719dd13b08339ac6..3bdae3e2450c604e1ad4bc8bd82af16ab0068f6a 100644 --- a/vendor/tecnickcom/tcpdf/CHANGELOG.TXT +++ b/vendor/tecnickcom/tcpdf/CHANGELOG.TXT @@ -1,5 +1,17 @@ -Unreleased - - fix Undesired mouseover effect on links in PDF on Chrome Pdf Viewer +6.2.25 + - Fix support for image URLs. + +6.2.24 + - Support remote urls when checking if file exists. + +6.2.23 + - Simplify file_exists function. + +6.2.22 + - Fix for security vulnerability: Using the phar:// wrapper it was possible to trigger the unserialization of user provided data. + +6.2.19 + - Merge various fixes for PHP 7.3 compatibility and security. 6.2.13 (2016-06-10) - IMPORTANT: A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this version will not receive any additional development or support. This version should be considered obsolete, new projects should use the new version as soon it will become stable. diff --git a/vendor/tecnickcom/tcpdf/composer.json b/vendor/tecnickcom/tcpdf/composer.json index 83ffd67b8b6cfb1898b82b1f4220ddfa5b619664..1f19dfd86412e341a3ed189c6c44462b6bfab3b8 100644 --- a/vendor/tecnickcom/tcpdf/composer.json +++ b/vendor/tecnickcom/tcpdf/composer.json @@ -1,6 +1,6 @@ { "name": "tecnickcom/tcpdf", - "version": "6.2.17", + "version": "6.2.26", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", diff --git a/vendor/tecnickcom/tcpdf/include/sRGB.icc b/vendor/tecnickcom/tcpdf/include/sRGB.icc index 71e33830223c4c05c61002462e13df02bb30ae02..1d8f7419c3bf2c6a3dd78f2c679fdefbda1776a3 100644 Binary files a/vendor/tecnickcom/tcpdf/include/sRGB.icc and b/vendor/tecnickcom/tcpdf/include/sRGB.icc differ diff --git a/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php b/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php index ba89c7cfbededee98f6d55380e72c409cae61102..9242ca4bfdb5290c47f0a10f8694bbd4673e51df 100644 --- a/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php +++ b/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php @@ -70,7 +70,7 @@ class TCPDF_FONTS { * @public static */ public static function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $outpath='', $platid=3, $encid=1, $addcbbox=false, $link=false) { - if (!file_exists($fontfile)) { + if (!TCPDF_STATIC::file_exists($fontfile)) { // Could not find file return false; } @@ -95,7 +95,7 @@ class TCPDF_FONTS { $outpath = self::_getfontpath(); } // check if this font already exist - if (@file_exists($outpath.$font_name.'.php')) { + if (@TCPDF_STATIC::file_exists($outpath.$font_name.'.php')) { // this font already exist (delete it from fonts folder to rebuild it) return $font_name; } @@ -1543,11 +1543,11 @@ class TCPDF_FONTS { public static function getFontFullPath($file, $fontdir=false) { $fontfile = ''; // search files on various directories - if (($fontdir !== false) AND @file_exists($fontdir.$file)) { + if (($fontdir !== false) AND @TCPDF_STATIC::file_exists($fontdir.$file)) { $fontfile = $fontdir.$file; - } elseif (@file_exists(self::_getfontpath().$file)) { + } elseif (@TCPDF_STATIC::file_exists(self::_getfontpath().$file)) { $fontfile = self::_getfontpath().$file; - } elseif (@file_exists($file)) { + } elseif (@TCPDF_STATIC::file_exists($file)) { $fontfile = $file; } return $fontfile; @@ -2003,7 +2003,11 @@ class TCPDF_FONTS { $chars = str_split($str); $carr = array_map('ord', $chars); } - $currentfont['subsetchars'] += array_fill_keys($carr, true); + if (is_array($currentfont['subsetchars']) && is_array($carr)) { + $currentfont['subsetchars'] += array_fill_keys($carr, true); + } else { + $currentfont['subsetchars'] = array_merge($currentfont['subsetchars'], $carr); + } return $carr; } diff --git a/vendor/tecnickcom/tcpdf/include/tcpdf_images.php b/vendor/tecnickcom/tcpdf/include/tcpdf_images.php index c2e3c36f9305814184940f7adc689dcf32c74d77..86b3c20dbd8b55321c12fffb04f39b8923a248ca 100644 --- a/vendor/tecnickcom/tcpdf/include/tcpdf_images.php +++ b/vendor/tecnickcom/tcpdf/include/tcpdf_images.php @@ -161,12 +161,8 @@ class TCPDF_IMAGES { */ public static function _parsejpeg($file) { // check if is a local file - if (!@file_exists($file)) { - // try to encode spaces on filename - $tfile = str_replace(' ', '%20', $file); - if (@file_exists($tfile)) { - $file = $tfile; - } + if (!@TCPDF_STATIC::file_exists($file)) { + return false; } $a = getimagesize($file); if (empty($a)) { diff --git a/vendor/tecnickcom/tcpdf/include/tcpdf_static.php b/vendor/tecnickcom/tcpdf/include/tcpdf_static.php index aa42c850a27454f7bc1d5173b1afbbd5ae52d6bf..df1b28e1ef87467a9f3bee38b58556802d488fc6 100644 --- a/vendor/tecnickcom/tcpdf/include/tcpdf_static.php +++ b/vendor/tecnickcom/tcpdf/include/tcpdf_static.php @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.2.17'; + private static $tcpdf_version = '6.2.26'; /** * String alias for total number of pages. @@ -1774,39 +1774,6 @@ class TCPDF_STATIC { return $angle; } - - - - - - - - - - - - - - - - -// ==================================================================================================================== -// REIMPLEMENTED -// ==================================================================================================================== - - - - - - - - - - - - - - /** * Split string by a regular expression. * This is a wrapper for the preg_split function to avoid the bug: https://bugs.php.net/bug.php?id=45850 @@ -1854,6 +1821,49 @@ class TCPDF_STATIC { return fopen($filename, $mode); } + /** + * Check if the URL exist. + * @param url (string) URL to check. + * @return Returns TRUE if the URL exists; FALSE otherwise. + * @public static + */ + public static function url_exists($url) { + $crs = curl_init(); + 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_exec($crs); + $code = curl_getinfo($crs, CURLINFO_HTTP_CODE); + curl_close($crs); + return ($code == 200); + } + + /** + * Wrapper for file_exists. + * Checks whether a file or directory exists. + * Only allows some protocols and local files. + * @param filename (string) Path to the file or directory. + * @return Returns TRUE if the file or directory specified by filename exists; FALSE otherwise. + * @public static + */ + public static function file_exists($filename) { + if (preg_match('|^https?://|', $filename) == 1) { + return self::url_exists($filename); + } + if (strpos($filename, '://')) { + return false; // only support http and https wrappers for security reasons + } + return @file_exists($filename); + } + /** * Reads entire file into a string. * The file can be also an URL. @@ -1914,8 +1924,10 @@ class TCPDF_STATIC { } // $alt = array_unique($alt); - //var_dump($alt);exit;//DEBUG foreach ($alt as $path) { + if (!self::file_exists($path)) { + return false; + } $ret = @file_get_contents($path); if ($ret !== false) { return $ret; @@ -1949,8 +1961,6 @@ class TCPDF_STATIC { return false; } - - /** * Get ULONG from string (Big Endian 32-bit unsigned integer). * @param $str (string) string from where to extract value diff --git a/vendor/tecnickcom/tcpdf/tcpdf.php b/vendor/tecnickcom/tcpdf/tcpdf.php index ef411a17dee3a16cdb369e76e45b8e449ed0e089..24ef434ab8a58523e06289e1a46b3647f69c2ac8 100644 --- a/vendor/tecnickcom/tcpdf/tcpdf.php +++ b/vendor/tecnickcom/tcpdf/tcpdf.php @@ -1,13 +1,13 @@ <?php //============================================================+ // File name : tcpdf.php -// Version : 6.2.13 +// Version : 6.2.26 // Begin : 2002-08-03 -// Last Update : 2015-06-18 +// Last Update : 2018-09-14 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // ------------------------------------------------------------------- -// Copyright (C) 2002-2015 Nicola Asuni - Tecnick.com LTD +// Copyright (C) 2002-2018 Nicola Asuni - Tecnick.com LTD // // This file is part of TCPDF software library. // @@ -104,7 +104,7 @@ * Tools to encode your unicode fonts are on fonts/utils directory.</p> * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.2.8 + * @version 6.2.26 */ // TCPDF configuration @@ -128,8 +128,11 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php'); * 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.<br> * @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 6.2.8 + * @version 6.2.26 * @author Nicola Asuni - info@tecnick.com + * @IgnoreAnnotation("protected") + * @IgnoreAnnotation("public") + * @IgnoreAnnotation("pre") */ class TCPDF { @@ -1994,10 +1997,6 @@ class TCPDF { * @since 1.53.0.TC016 */ public function __destruct() { - // restore internal encoding - if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) { - mb_internal_encoding($this->internal_encoding); - } // cleanup $this->_destroy(true); } @@ -4257,7 +4256,7 @@ class TCPDF { // true when the font style variation is missing $missing_style = false; // search and include font file - if (TCPDF_STATIC::empty_string($fontfile) OR (!@file_exists($fontfile))) { + if (TCPDF_STATIC::empty_string($fontfile) OR (!@TCPDF_STATIC::file_exists($fontfile))) { // build a standard filenames for specified font $tmp_fontfile = str_replace(' ', '', $family).strtolower($style).'.php'; $fontfile = TCPDF_FONTS::getFontFullPath($tmp_fontfile, $fontdir); @@ -4269,7 +4268,7 @@ class TCPDF { } } // include font file - if (!TCPDF_STATIC::empty_string($fontfile) AND (@file_exists($fontfile))) { + if (!TCPDF_STATIC::empty_string($fontfile) AND (@TCPDF_STATIC::file_exists($fontfile))) { include($fontfile); } else { $this->Error('Could not include font definition file: '.$family.''); @@ -4453,6 +4452,7 @@ class TCPDF { * @see SetFont() */ public function SetFontSize($size, $out=true) { + $size = (float)$size; // font size in points $this->FontSizePt = $size; // font size in user units @@ -4809,19 +4809,19 @@ class TCPDF { $this->PageAnnots[$page][] = array('n' => ++$this->n, 'x' => $x, 'y' => $y, 'w' => $w, 'h' => $h, 'txt' => $text, 'opt' => $opt, 'numspaces' => $spaces); if (!$this->pdfa_mode) { if ((($opt['Subtype'] == 'FileAttachment') OR ($opt['Subtype'] == 'Sound')) AND (!TCPDF_STATIC::empty_string($opt['FS'])) - AND (@file_exists($opt['FS']) OR TCPDF_STATIC::isValidURL($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']); } } // Add widgets annotation's icons - if (isset($opt['mk']['i']) AND @file_exists($opt['mk']['i'])) { + if (isset($opt['mk']['i']) AND @TCPDF_STATIC::file_exists($opt['mk']['i'])) { $this->Image($opt['mk']['i'], '', '', 10, 10, '', '', '', false, 300, '', false, false, 0, false, true); } - if (isset($opt['mk']['ri']) AND @file_exists($opt['mk']['ri'])) { + if (isset($opt['mk']['ri']) AND @TCPDF_STATIC::file_exists($opt['mk']['ri'])) { $this->Image($opt['mk']['ri'], '', '', 0, 0, '', '', '', false, 300, '', false, false, 0, false, true); } - if (isset($opt['mk']['ix']) AND @file_exists($opt['mk']['ix'])) { + if (isset($opt['mk']['ix']) AND @TCPDF_STATIC::file_exists($opt['mk']['ix'])) { $this->Image($opt['mk']['ix'], '', '', 0, 0, '', '', '', false, 300, '', false, false, 0, false, true); } } @@ -5769,10 +5769,9 @@ class TCPDF { $this->resetLastH(); } if (!TCPDF_STATIC::empty_string($y)) { - $this->SetY($y); - } else { - $y = $this->GetY(); + $this->SetY($y); // set y in order to convert negative y values to positive ones } + $y = $this->GetY(); $resth = 0; if (($h > 0) AND $this->inPageBody() AND (($y + $h + $mc_margin['T'] + $mc_margin['B']) > $this->PageBreakTrigger)) { // spit cell in more pages/columns @@ -6845,13 +6844,9 @@ class TCPDF { $file = substr($file, 1); $exurl = $file; } - // check if is a local file - if (!@file_exists($file)) { - // try to encode spaces on filename - $tfile = str_replace(' ', '%20', $file); - if (@file_exists($tfile)) { - $file = $tfile; - } + // check if file exist and it is valid + if (!@TCPDF_STATIC::file_exists($file)) { + return false; } if (($imsize = @getimagesize($file)) === FALSE) { if (in_array($file, $this->imagekeys)) { @@ -7750,6 +7745,10 @@ class TCPDF { * @since 4.5.016 (2009-02-24) */ public function _destroy($destroyall=false, $preserve_objcopy=false) { + // restore internal encoding + if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) { + mb_internal_encoding($this->internal_encoding); + } if ($destroyall AND !$preserve_objcopy) { // remove all temporary files $tmpfiles = glob(K_PATH_CACHE.'__tcpdf_'.$this->file_id.'_*'); @@ -9648,7 +9647,7 @@ class TCPDF { protected function _putcatalog() { // put XMP $xmpobj = $this->_putXMP(); - // if required, add standard sRGB_IEC61966-2.1 blackscaled ICC colour profile + // if required, add standard sRGB ICC colour profile if ($this->pdfa_mode OR $this->force_srgb) { $iccobj = $this->_newobj(); $icc = file_get_contents(dirname(__FILE__).'/include/sRGB.icc'); @@ -17783,7 +17782,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // justify block if (!TCPDF_STATIC::empty_string($this->lispacer)) { $this->lispacer = ''; - continue; + break; } preg_match('/([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]('.$strpiece[1][0].')[\s](re)([\s]*)/x', $pmid, $xmatches); if (!isset($xmatches[1])) { @@ -18318,7 +18317,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } // text $this->htmlvspace = 0; - if ((!$this->premode) AND $this->isRTLTextDir()) { + $isRTLString = preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_RTL, $dom[$key]['value']) || preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_ARABIC, $dom[$key]['value']); + if ((!$this->premode) AND $this->isRTLTextDir() AND !$isRTLString) { // reverse spaces order $lsp = ''; // left spaces $rsp = ''; // right spaces @@ -18333,7 +18333,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($newline) { if (!$this->premode) { $prelen = strlen($dom[$key]['value']); - if ($this->isRTLTextDir()) { + if ($this->isRTLTextDir() AND !$isRTLString) { // right trim except non-breaking space $dom[$key]['value'] = $this->stringRightTrim($dom[$key]['value']); } else { @@ -18817,100 +18817,122 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'img': { - if (!empty($tag['attribute']['src'])) { - if ($tag['attribute']['src'][0] === '@') { - // data stream - $tag['attribute']['src'] = '@'.base64_decode(substr($tag['attribute']['src'], 1)); - $type = ''; - } else { - // get image type - $type = TCPDF_IMAGES::getImageFileType($tag['attribute']['src']); - } - if (!isset($tag['width'])) { - $tag['width'] = 0; - } - if (!isset($tag['height'])) { - $tag['height'] = 0; - } - //if (!isset($tag['attribute']['align'])) { - // the only alignment supported is "bottom" - // further development is required for other modes. - $tag['attribute']['align'] = 'bottom'; - //} - switch($tag['attribute']['align']) { - case 'top': { - $align = 'T'; - break; - } - case 'middle': { - $align = 'M'; - break; - } - case 'bottom': { - $align = 'B'; - break; + if (empty($tag['attribute']['src'])) { + break; + } + $imgsrc = $tag['attribute']['src']; + if ($imgsrc[0] === '@') { + // data stream + $imgsrc = '@'.base64_decode(substr($imgsrc, 1)); + $type = ''; + } else { + if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + // fix image path + $findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']); + if (($findroot === false) OR ($findroot > 1)) { + if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') { + $imgsrc = substr($_SERVER['DOCUMENT_ROOT'], 0, -1).$imgsrc; + } else { + $imgsrc = $_SERVER['DOCUMENT_ROOT'].$imgsrc; + } } - default: { - $align = 'B'; - break; + $imgsrc = urldecode($imgsrc); + $testscrtype = @parse_url($imgsrc); + if (empty($testscrtype['query'])) { + // convert URL to server path + $imgsrc = str_replace(K_PATH_URL, K_PATH_MAIN, $imgsrc); + } elseif (preg_match('|^https?://|', $imgsrc) !== 1) { + // convert URL to server path + $imgsrc = str_replace(K_PATH_MAIN, K_PATH_URL, $imgsrc); } } - $prevy = $this->y; - $xpos = $this->x; - $imglink = ''; - if (isset($this->HREF['url']) AND !TCPDF_STATIC::empty_string($this->HREF['url'])) { - $imglink = $this->HREF['url']; - if ($imglink[0] == '#') { - // convert url to internal link - $lnkdata = explode(',', $imglink); - if (isset($lnkdata[0])) { - $page = intval(substr($lnkdata[0], 1)); - if (empty($page) OR ($page <= 0)) { - $page = $this->page; - } - if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) { - $lnky = floatval($lnkdata[1]); - } else { - $lnky = 0; - } - $imglink = $this->AddLink(); - $this->SetLink($imglink, $lnky, $page); + // get image type + $type = TCPDF_IMAGES::getImageFileType($imgsrc); + } + if (!isset($tag['width'])) { + $tag['width'] = 0; + } + if (!isset($tag['height'])) { + $tag['height'] = 0; + } + //if (!isset($tag['attribute']['align'])) { + // the only alignment supported is "bottom" + // further development is required for other modes. + $tag['attribute']['align'] = 'bottom'; + //} + switch($tag['attribute']['align']) { + case 'top': { + $align = 'T'; + break; + } + case 'middle': { + $align = 'M'; + break; + } + case 'bottom': { + $align = 'B'; + break; + } + default: { + $align = 'B'; + break; + } + } + $prevy = $this->y; + $xpos = $this->x; + $imglink = ''; + if (isset($this->HREF['url']) AND !TCPDF_STATIC::empty_string($this->HREF['url'])) { + $imglink = $this->HREF['url']; + if ($imglink[0] == '#') { + // convert url to internal link + $lnkdata = explode(',', $imglink); + if (isset($lnkdata[0])) { + $page = intval(substr($lnkdata[0], 1)); + if (empty($page) OR ($page <= 0)) { + $page = $this->page; + } + if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) { + $lnky = floatval($lnkdata[1]); + } else { + $lnky = 0; } + $imglink = $this->AddLink(); + $this->SetLink($imglink, $lnky, $page); } } - $border = 0; - if (isset($tag['border']) AND !empty($tag['border'])) { - // currently only support 1 (frame) or a combination of 'LTRB' - $border = $tag['border']; - } - $iw = ''; - if (isset($tag['width'])) { - $iw = $this->getHTMLUnitToUnits($tag['width'], ($tag['fontsize'] / $this->k), 'px', false); - } - $ih = ''; - if (isset($tag['height'])) { - $ih = $this->getHTMLUnitToUnits($tag['height'], ($tag['fontsize'] / $this->k), 'px', false); - } - if (($type == 'eps') OR ($type == 'ai')) { - $this->ImageEps($tag['attribute']['src'], $xpos, $this->y, $iw, $ih, $imglink, true, $align, '', $border, true); - } elseif ($type == 'svg') { - $this->ImageSVG($tag['attribute']['src'], $xpos, $this->y, $iw, $ih, $imglink, $align, '', $border, true); - } else { - $this->Image($tag['attribute']['src'], $xpos, $this->y, $iw, $ih, '', $imglink, $align, false, 300, '', false, false, $border, false, false, true); + } + $border = 0; + if (isset($tag['border']) AND !empty($tag['border'])) { + // currently only support 1 (frame) or a combination of 'LTRB' + $border = $tag['border']; + } + $iw = ''; + if (isset($tag['width'])) { + $iw = $this->getHTMLUnitToUnits($tag['width'], ($tag['fontsize'] / $this->k), 'px', false); + } + $ih = ''; + if (isset($tag['height'])) { + $ih = $this->getHTMLUnitToUnits($tag['height'], ($tag['fontsize'] / $this->k), 'px', false); + } + if (($type == 'eps') OR ($type == 'ai')) { + $this->ImageEps($imgsrc, $xpos, $this->y, $iw, $ih, $imglink, true, $align, '', $border, true); + } elseif ($type == 'svg') { + $this->ImageSVG($imgsrc, $xpos, $this->y, $iw, $ih, $imglink, $align, '', $border, true); + } else { + $this->Image($imgsrc, $xpos, $this->y, $iw, $ih, '', $imglink, $align, false, 300, '', false, false, $border, false, false, true); + } + switch($align) { + case 'T': { + $this->y = $prevy; + break; } - switch($align) { - case 'T': { - $this->y = $prevy; - break; - } - case 'M': { - $this->y = (($this->img_rb_y + $prevy - ($this->getCellHeight($tag['fontsize'] / $this->k))) / 2); - break; - } - case 'B': { - $this->y = $this->img_rb_y - ($this->getCellHeight($tag['fontsize'] / $this->k) - ($this->getFontDescent($tag['fontname'], $tag['fontstyle'], $tag['fontsize']) * $this->cell_height_ratio)); - break; - } + case 'M': { + $this->y = (($this->img_rb_y + $prevy - ($this->getCellHeight($tag['fontsize'] / $this->k))) / 2); + break; + } + case 'B': { + $this->y = $this->img_rb_y - ($this->getCellHeight($tag['fontsize'] / $this->k) - ($this->getFontDescent($tag['fontname'], $tag['fontstyle'], $tag['fontsize']) * $this->cell_height_ratio)); + break; } } break; @@ -24206,9 +24228,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } $img = urldecode($img); $testscrtype = @parse_url($img); - if (!isset($testscrtype['query']) OR empty($testscrtype['query'])) { + if (empty($testscrtype['query'])) { // convert URL to server path $img = str_replace(K_PATH_URL, K_PATH_MAIN, $img); + } elseif (preg_match('|^https?://|', $img) !== 1) { + // convert server path to URL + $img = str_replace(K_PATH_MAIN, K_PATH_URL, $img); } } // get image type