From 3fd785654372d493c031d9b541ab33a881023a32 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 26 Feb 2021 19:16:17 +0300 Subject: * switch to composer for qrcode and otp dependencies * move most OTP-related stuff into userhelper * remove old phpqrcode and otphp libraries --- vendor/OTPHP/Base32.php | 85 - vendor/OTPHP/HOTP.php | 74 - vendor/OTPHP/LICENCE | 20 - vendor/OTPHP/OTP.php | 120 - vendor/OTPHP/OTPHP.php | 27 - vendor/OTPHP/TOTP.php | 106 - vendor/Psr/Log/AbstractLogger.php | 128 - vendor/Psr/Log/InvalidArgumentException.php | 7 - vendor/Psr/Log/LogLevel.php | 18 - vendor/Psr/Log/LoggerAwareInterface.php | 18 - vendor/Psr/Log/LoggerAwareTrait.php | 26 - vendor/Psr/Log/LoggerInterface.php | 123 - vendor/Psr/Log/LoggerTrait.php | 140 - vendor/Psr/Log/NullLogger.php | 28 - vendor/Psr/Log/Test/LoggerInterfaceTest.php | 140 - vendor/autoload.php | 7 + vendor/beberlei/assert/LICENSE | 11 + vendor/beberlei/assert/composer.json | 63 + vendor/beberlei/assert/lib/Assert/Assert.php | 96 + vendor/beberlei/assert/lib/Assert/Assertion.php | 2825 ++++++++++++++++++ .../beberlei/assert/lib/Assert/AssertionChain.php | 254 ++ .../assert/lib/Assert/AssertionFailedException.php | 35 + .../assert/lib/Assert/InvalidArgumentException.php | 76 + .../beberlei/assert/lib/Assert/LazyAssertion.php | 230 ++ .../assert/lib/Assert/LazyAssertionException.php | 55 + vendor/beberlei/assert/lib/Assert/functions.php | 80 + vendor/beberlei/assert/phpstan-code.neon | 10 + vendor/beberlei/assert/phpstan-tests.neon | 10 + vendor/chillerlan/php-qrcode/.github/FUNDING.yml | 1 + .../php-qrcode/.github/workflows/tests.yml | 55 + vendor/chillerlan/php-qrcode/.gitignore | 5 + vendor/chillerlan/php-qrcode/.scrutinizer.yml | 5 + vendor/chillerlan/php-qrcode/.travis.yml | 19 + vendor/chillerlan/php-qrcode/LICENSE | 21 + vendor/chillerlan/php-qrcode/README.md | 392 +++ vendor/chillerlan/php-qrcode/composer.json | 51 + .../php-qrcode/examples/MyCustomOutput.php | 36 + .../php-qrcode/examples/QRImageWithLogo.php | 81 + .../php-qrcode/examples/QRImageWithText.php | 104 + .../php-qrcode/examples/custom_output.php | 38 + .../php-qrcode/examples/example_image.png | Bin 0 -> 2279 bytes .../chillerlan/php-qrcode/examples/example_svg.png | Bin 0 -> 15925 bytes vendor/chillerlan/php-qrcode/examples/fpdf.php | 47 + vendor/chillerlan/php-qrcode/examples/html.php | 102 + vendor/chillerlan/php-qrcode/examples/image.php | 60 + .../php-qrcode/examples/imageWithLogo.php | 44 + .../php-qrcode/examples/imageWithText.php | 33 + vendor/chillerlan/php-qrcode/examples/imagick.php | 59 + vendor/chillerlan/php-qrcode/examples/octocat.png | Bin 0 -> 2468 bytes vendor/chillerlan/php-qrcode/examples/svg.php | 77 + vendor/chillerlan/php-qrcode/examples/text.php | 68 + vendor/chillerlan/php-qrcode/phpdoc.xml | 15 + vendor/chillerlan/php-qrcode/phpmd.xml | 34 + vendor/chillerlan/php-qrcode/phpunit.xml | 23 + vendor/chillerlan/php-qrcode/public/index.html | 163 + vendor/chillerlan/php-qrcode/public/qrcode.php | 97 + vendor/chillerlan/php-qrcode/src/Data/AlphaNum.php | 65 + vendor/chillerlan/php-qrcode/src/Data/Byte.php | 47 + vendor/chillerlan/php-qrcode/src/Data/Kanji.php | 70 + .../php-qrcode/src/Data/MaskPatternTester.php | 203 ++ vendor/chillerlan/php-qrcode/src/Data/Number.php | 82 + .../php-qrcode/src/Data/QRCodeDataException.php | 17 + .../php-qrcode/src/Data/QRDataAbstract.php | 351 +++ .../php-qrcode/src/Data/QRDataInterface.php | 187 ++ vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php | 733 +++++ .../php-qrcode/src/Helpers/BitBuffer.php | 75 + .../php-qrcode/src/Helpers/Polynomial.php | 184 ++ .../src/Output/QRCodeOutputException.php | 17 + vendor/chillerlan/php-qrcode/src/Output/QRFpdf.php | 112 + .../chillerlan/php-qrcode/src/Output/QRImage.php | 208 ++ .../chillerlan/php-qrcode/src/Output/QRImagick.php | 123 + .../chillerlan/php-qrcode/src/Output/QRMarkup.php | 151 + .../php-qrcode/src/Output/QROutputAbstract.php | 130 + .../php-qrcode/src/Output/QROutputInterface.php | 55 + .../chillerlan/php-qrcode/src/Output/QRString.php | 76 + vendor/chillerlan/php-qrcode/src/QRCode.php | 310 ++ .../chillerlan/php-qrcode/src/QRCodeException.php | 15 + vendor/chillerlan/php-qrcode/src/QROptions.php | 61 + .../chillerlan/php-qrcode/src/QROptionsTrait.php | 408 +++ .../php-qrcode/tests/Data/AlphaNumTest.php | 44 + .../chillerlan/php-qrcode/tests/Data/ByteTest.php | 38 + .../tests/Data/DatainterfaceTestAbstract.php | 65 + .../chillerlan/php-qrcode/tests/Data/KanjiTest.php | 50 + .../tests/Data/MaskPatternTesterTest.php | 29 + .../php-qrcode/tests/Data/NumberTest.php | 44 + .../php-qrcode/tests/Data/QRMatrixTest.php | 260 ++ .../php-qrcode/tests/Helpers/BitBufferTest.php | 53 + .../php-qrcode/tests/Helpers/PolynomialTest.php | 42 + .../php-qrcode/tests/Output/QRFpdfTest.php | 83 + .../php-qrcode/tests/Output/QRImageTest.php | 69 + .../php-qrcode/tests/Output/QRImagickTest.php | 66 + .../php-qrcode/tests/Output/QRMarkupTest.php | 79 + .../tests/Output/QROutputTestAbstract.php | 71 + .../php-qrcode/tests/Output/QRStringTest.php | 56 + vendor/chillerlan/php-qrcode/tests/QRCodeTest.php | 140 + .../chillerlan/php-qrcode/tests/QROptionsTest.php | 80 + .../chillerlan/php-qrcode/tests/QRTestAbstract.php | 72 + .../chillerlan/php-settings-container/.gitignore | 4 + .../php-settings-container/.scrutinizer.yml | 5 + .../chillerlan/php-settings-container/.travis.yml | 18 + vendor/chillerlan/php-settings-container/LICENSE | 21 + vendor/chillerlan/php-settings-container/README.md | 153 + .../php-settings-container/composer.json | 40 + .../php-settings-container/examples/advanced.php | 46 + .../php-settings-container/examples/simple.php | 30 + vendor/chillerlan/php-settings-container/phpmd.xml | 35 + .../chillerlan/php-settings-container/phpunit.xml | 22 + .../src/SettingsContainerAbstract.php | 172 ++ .../src/SettingsContainerInterface.php | 104 + .../php-settings-container/tests/ContainerTest.php | 105 + .../php-settings-container/tests/TestContainer.php | 29 + .../tests/TestOptionsTrait.php | 42 + vendor/composer/ClassLoader.php | 479 +++ vendor/composer/InstalledVersions.php | 337 +++ vendor/composer/LICENSE | 21 + vendor/composer/autoload_classmap.php | 10 + vendor/composer/autoload_files.php | 99 + vendor/composer/autoload_namespaces.php | 9 + vendor/composer/autoload_psr4.php | 15 + vendor/composer/autoload_real.php | 75 + vendor/composer/autoload_static.php | 168 ++ vendor/composer/installed.json | 500 ++++ vendor/composer/installed.php | 78 + vendor/composer/platform_check.php | 26 + vendor/paragonie/constant_time_encoding/.gitignore | 2 + .../paragonie/constant_time_encoding/.travis.yml | 24 + .../paragonie/constant_time_encoding/LICENSE.txt | 48 + vendor/paragonie/constant_time_encoding/README.md | 84 + .../paragonie/constant_time_encoding/composer.json | 51 + .../constant_time_encoding/phpunit.xml.dist | 13 + vendor/paragonie/constant_time_encoding/psalm.xml | 9 + .../constant_time_encoding/src/Base32.php | 471 +++ .../constant_time_encoding/src/Base32Hex.php | 111 + .../constant_time_encoding/src/Base64.php | 271 ++ .../constant_time_encoding/src/Base64DotSlash.php | 88 + .../src/Base64DotSlashOrdered.php | 82 + .../constant_time_encoding/src/Base64UrlSafe.php | 95 + .../constant_time_encoding/src/Binary.php | 85 + .../src/EncoderInterface.php | 52 + .../constant_time_encoding/src/Encoding.php | 260 ++ .../paragonie/constant_time_encoding/src/Hex.php | 159 + .../constant_time_encoding/src/RFC4648.php | 175 ++ .../constant_time_encoding/tests/Base32HexTest.php | 49 + .../constant_time_encoding/tests/Base32Test.php | 50 + .../tests/Base64DotSlashOrderedTest.php | 34 + .../tests/Base64DotSlashTest.php | 34 + .../constant_time_encoding/tests/Base64Test.php | 79 + .../tests/Base64UrlSafeTest.php | 58 + .../constant_time_encoding/tests/EncodingTest.php | 307 ++ .../constant_time_encoding/tests/HexTest.php | 39 + .../constant_time_encoding/tests/RFC4648Test.php | 84 + vendor/spomky-labs/otphp/.github/CONTRIBUTING.md | 25 + vendor/spomky-labs/otphp/.github/ISSUE_TEMPLATE.md | 16 + .../otphp/.github/PULL_REQUEST_TEMPLATE.md | 21 + vendor/spomky-labs/otphp/.github/stale.yml | 17 + vendor/spomky-labs/otphp/.php_cs.dist | 61 + vendor/spomky-labs/otphp/CODE_OF_CONDUCT.md | 46 + vendor/spomky-labs/otphp/LICENSE | 20 + vendor/spomky-labs/otphp/composer.json | 50 + vendor/spomky-labs/otphp/phpstan.neon | 13 + vendor/spomky-labs/otphp/src/Factory.php | 115 + vendor/spomky-labs/otphp/src/FactoryInterface.php | 23 + vendor/spomky-labs/otphp/src/HOTP.php | 103 + vendor/spomky-labs/otphp/src/HOTPInterface.php | 29 + vendor/spomky-labs/otphp/src/OTP.php | 114 + vendor/spomky-labs/otphp/src/OTPInterface.php | 97 + vendor/spomky-labs/otphp/src/ParameterTrait.php | 196 ++ vendor/spomky-labs/otphp/src/TOTP.php | 159 + vendor/spomky-labs/otphp/src/TOTPInterface.php | 36 + vendor/thecodingmachine/safe/LICENSE | 21 + vendor/thecodingmachine/safe/README.md | 178 ++ vendor/thecodingmachine/safe/composer.json | 123 + .../safe/deprecated/Exceptions/ApcException.php | 11 + .../deprecated/Exceptions/LibeventException.php | 11 + .../safe/deprecated/Exceptions/MssqlException.php | 11 + .../safe/deprecated/Exceptions/StatsException.php | 11 + vendor/thecodingmachine/safe/deprecated/apc.php | 238 ++ .../safe/deprecated/functionsList.php | 56 + .../thecodingmachine/safe/deprecated/libevent.php | 496 +++ vendor/thecodingmachine/safe/deprecated/mssql.php | 426 +++ vendor/thecodingmachine/safe/deprecated/stats.php | 108 + .../safe/generated/Exceptions/.gitkeep | 0 .../safe/generated/Exceptions/ApacheException.php | 11 + .../safe/generated/Exceptions/ApcuException.php | 11 + .../safe/generated/Exceptions/ArrayException.php | 11 + .../safe/generated/Exceptions/Bzip2Exception.php | 11 + .../generated/Exceptions/CalendarException.php | 11 + .../generated/Exceptions/ClassobjException.php | 11 + .../safe/generated/Exceptions/ComException.php | 11 + .../safe/generated/Exceptions/CubridException.php | 11 + .../generated/Exceptions/DatetimeException.php | 11 + .../safe/generated/Exceptions/DirException.php | 11 + .../safe/generated/Exceptions/EioException.php | 11 + .../generated/Exceptions/ErrorfuncException.php | 11 + .../safe/generated/Exceptions/ExecException.php | 11 + .../generated/Exceptions/FileinfoException.php | 11 + .../generated/Exceptions/FilesystemException.php | 11 + .../safe/generated/Exceptions/FilterException.php | 11 + .../safe/generated/Exceptions/FpmException.php | 11 + .../safe/generated/Exceptions/FtpException.php | 11 + .../generated/Exceptions/FunchandException.php | 11 + .../safe/generated/Exceptions/GmpException.php | 11 + .../safe/generated/Exceptions/GnupgException.php | 11 + .../safe/generated/Exceptions/HashException.php | 11 + .../safe/generated/Exceptions/IbaseException.php | 11 + .../safe/generated/Exceptions/IbmDb2Exception.php | 11 + .../safe/generated/Exceptions/IconvException.php | 11 + .../safe/generated/Exceptions/ImageException.php | 11 + .../safe/generated/Exceptions/ImapException.php | 11 + .../safe/generated/Exceptions/InfoException.php | 11 + .../generated/Exceptions/IngresiiException.php | 11 + .../safe/generated/Exceptions/InotifyException.php | 11 + .../safe/generated/Exceptions/LdapException.php | 11 + .../safe/generated/Exceptions/LibxmlException.php | 11 + .../safe/generated/Exceptions/LzfException.php | 11 + .../generated/Exceptions/MailparseException.php | 11 + .../generated/Exceptions/MbstringException.php | 11 + .../safe/generated/Exceptions/MiscException.php | 11 + .../safe/generated/Exceptions/MsqlException.php | 11 + .../safe/generated/Exceptions/MysqlException.php | 11 + .../safe/generated/Exceptions/MysqliException.php | 11 + .../generated/Exceptions/MysqlndMsException.php | 11 + .../generated/Exceptions/MysqlndQcException.php | 11 + .../safe/generated/Exceptions/NetworkException.php | 11 + .../safe/generated/Exceptions/Oci8Exception.php | 11 + .../safe/generated/Exceptions/OpcacheException.php | 11 + .../generated/Exceptions/OutcontrolException.php | 11 + .../generated/Exceptions/PasswordException.php | 11 + .../safe/generated/Exceptions/PcntlException.php | 11 + .../safe/generated/Exceptions/PdfException.php | 11 + .../safe/generated/Exceptions/PgsqlException.php | 11 + .../safe/generated/Exceptions/PosixException.php | 11 + .../safe/generated/Exceptions/PsException.php | 11 + .../safe/generated/Exceptions/PspellException.php | 11 + .../generated/Exceptions/ReadlineException.php | 11 + .../safe/generated/Exceptions/RpminfoException.php | 11 + .../safe/generated/Exceptions/RrdException.php | 11 + .../safe/generated/Exceptions/SemException.php | 11 + .../safe/generated/Exceptions/SessionException.php | 11 + .../safe/generated/Exceptions/ShmopException.php | 11 + .../generated/Exceptions/SimplexmlException.php | 11 + .../safe/generated/Exceptions/SocketsException.php | 11 + .../safe/generated/Exceptions/SodiumException.php | 11 + .../safe/generated/Exceptions/SolrException.php | 11 + .../safe/generated/Exceptions/SplException.php | 11 + .../safe/generated/Exceptions/SqlsrvException.php | 11 + .../safe/generated/Exceptions/SsdeepException.php | 11 + .../safe/generated/Exceptions/Ssh2Exception.php | 11 + .../safe/generated/Exceptions/StreamException.php | 11 + .../safe/generated/Exceptions/StringsException.php | 11 + .../safe/generated/Exceptions/SwooleException.php | 11 + .../safe/generated/Exceptions/UodbcException.php | 11 + .../safe/generated/Exceptions/UopzException.php | 11 + .../safe/generated/Exceptions/UrlException.php | 11 + .../safe/generated/Exceptions/VarException.php | 11 + .../safe/generated/Exceptions/XdiffException.php | 11 + .../safe/generated/Exceptions/XmlException.php | 11 + .../safe/generated/Exceptions/XmlrpcException.php | 11 + .../safe/generated/Exceptions/YamlException.php | 11 + .../safe/generated/Exceptions/YazException.php | 11 + .../safe/generated/Exceptions/ZipException.php | 11 + .../safe/generated/Exceptions/ZlibException.php | 11 + vendor/thecodingmachine/safe/generated/apache.php | 177 ++ vendor/thecodingmachine/safe/generated/apcu.php | 112 + vendor/thecodingmachine/safe/generated/array.php | 464 +++ vendor/thecodingmachine/safe/generated/bzip2.php | 96 + .../thecodingmachine/safe/generated/calendar.php | 27 + .../thecodingmachine/safe/generated/classobj.php | 25 + vendor/thecodingmachine/safe/generated/com.php | 127 + vendor/thecodingmachine/safe/generated/cubrid.php | 395 +++ vendor/thecodingmachine/safe/generated/curl.php | 3156 ++++++++++++++++++++ .../thecodingmachine/safe/generated/datetime.php | 631 ++++ vendor/thecodingmachine/safe/generated/dir.php | 157 + vendor/thecodingmachine/safe/generated/eio.php | 2071 +++++++++++++ .../thecodingmachine/safe/generated/errorfunc.php | 82 + vendor/thecodingmachine/safe/generated/exec.php | 159 + .../thecodingmachine/safe/generated/fileinfo.php | 75 + .../thecodingmachine/safe/generated/filesystem.php | 1488 +++++++++ vendor/thecodingmachine/safe/generated/filter.php | 93 + vendor/thecodingmachine/safe/generated/fpm.php | 22 + vendor/thecodingmachine/safe/generated/ftp.php | 496 +++ .../thecodingmachine/safe/generated/funchand.php | 47 + .../safe/generated/functionsList.php | 1070 +++++++ vendor/thecodingmachine/safe/generated/gmp.php | 87 + vendor/thecodingmachine/safe/generated/gnupg.php | 168 ++ vendor/thecodingmachine/safe/generated/hash.php | 61 + vendor/thecodingmachine/safe/generated/ibase.php | 633 ++++ vendor/thecodingmachine/safe/generated/ibmDb2.php | 1221 ++++++++ vendor/thecodingmachine/safe/generated/iconv.php | 96 + vendor/thecodingmachine/safe/generated/image.php | 2704 +++++++++++++++++ vendor/thecodingmachine/safe/generated/imap.php | 1481 +++++++++ vendor/thecodingmachine/safe/generated/info.php | 511 ++++ .../thecodingmachine/safe/generated/ingres-ii.php | 720 +++++ vendor/thecodingmachine/safe/generated/inotify.php | 44 + vendor/thecodingmachine/safe/generated/json.php | 73 + vendor/thecodingmachine/safe/generated/ldap.php | 1603 ++++++++++ vendor/thecodingmachine/safe/generated/libxml.php | 43 + vendor/thecodingmachine/safe/generated/lzf.php | 44 + .../thecodingmachine/safe/generated/mailparse.php | 127 + .../thecodingmachine/safe/generated/mbstring.php | 526 ++++ vendor/thecodingmachine/safe/generated/misc.php | 464 +++ vendor/thecodingmachine/safe/generated/msql.php | 443 +++ vendor/thecodingmachine/safe/generated/mysql.php | 938 ++++++ vendor/thecodingmachine/safe/generated/mysqli.php | 42 + .../thecodingmachine/safe/generated/mysqlndMs.php | 119 + .../thecodingmachine/safe/generated/mysqlndQc.php | 103 + vendor/thecodingmachine/safe/generated/network.php | 639 ++++ vendor/thecodingmachine/safe/generated/oci8.php | 1721 +++++++++++ vendor/thecodingmachine/safe/generated/opcache.php | 42 + vendor/thecodingmachine/safe/generated/openssl.php | 1088 +++++++ .../thecodingmachine/safe/generated/outcontrol.php | 100 + .../thecodingmachine/safe/generated/password.php | 126 + vendor/thecodingmachine/safe/generated/pcntl.php | 166 + vendor/thecodingmachine/safe/generated/pcre.php | 659 ++++ vendor/thecodingmachine/safe/generated/pdf.php | 1553 ++++++++++ vendor/thecodingmachine/safe/generated/pgsql.php | 1878 ++++++++++++ vendor/thecodingmachine/safe/generated/posix.php | 329 ++ vendor/thecodingmachine/safe/generated/ps.php | 1812 +++++++++++ vendor/thecodingmachine/safe/generated/pspell.php | 451 +++ .../thecodingmachine/safe/generated/readline.php | 157 + vendor/thecodingmachine/safe/generated/rpminfo.php | 21 + vendor/thecodingmachine/safe/generated/rrd.php | 23 + vendor/thecodingmachine/safe/generated/sem.php | 367 +++ vendor/thecodingmachine/safe/generated/session.php | 153 + vendor/thecodingmachine/safe/generated/shmop.php | 68 + .../thecodingmachine/safe/generated/simplexml.php | 94 + vendor/thecodingmachine/safe/generated/sockets.php | 813 +++++ vendor/thecodingmachine/safe/generated/sodium.php | 58 + vendor/thecodingmachine/safe/generated/solr.php | 22 + vendor/thecodingmachine/safe/generated/spl.php | 139 + vendor/thecodingmachine/safe/generated/sqlsrv.php | 429 +++ vendor/thecodingmachine/safe/generated/ssdeep.php | 70 + vendor/thecodingmachine/safe/generated/ssh2.php | 641 ++++ vendor/thecodingmachine/safe/generated/stream.php | 609 ++++ vendor/thecodingmachine/safe/generated/strings.php | 846 ++++++ vendor/thecodingmachine/safe/generated/swoole.php | 108 + vendor/thecodingmachine/safe/generated/uodbc.php | 1009 +++++++ vendor/thecodingmachine/safe/generated/uopz.php | 40 + vendor/thecodingmachine/safe/generated/url.php | 144 + vendor/thecodingmachine/safe/generated/var.php | 60 + vendor/thecodingmachine/safe/generated/xdiff.php | 236 ++ vendor/thecodingmachine/safe/generated/xml.php | 95 + vendor/thecodingmachine/safe/generated/xmlrpc.php | 22 + vendor/thecodingmachine/safe/generated/yaml.php | 97 + vendor/thecodingmachine/safe/generated/yaz.php | 438 +++ vendor/thecodingmachine/safe/generated/zip.php | 71 + vendor/thecodingmachine/safe/generated/zlib.php | 611 ++++ vendor/thecodingmachine/safe/lib/DateTime.php | 81 + .../safe/lib/DateTimeImmutable.php | 262 ++ .../safe/lib/Exceptions/CurlException.php | 15 + .../safe/lib/Exceptions/JsonException.php | 12 + .../safe/lib/Exceptions/OpensslException.php | 12 + .../safe/lib/Exceptions/PcreException.php | 21 + .../safe/lib/Exceptions/SafeExceptionInterface.php | 9 + vendor/thecodingmachine/safe/lib/special_cases.php | 241 ++ .../thecodingmachine/safe/rector-migrate-0.7.php | 1081 +++++++ 356 files changed, 62531 insertions(+), 1060 deletions(-) delete mode 100644 vendor/OTPHP/Base32.php delete mode 100644 vendor/OTPHP/HOTP.php delete mode 100644 vendor/OTPHP/LICENCE delete mode 100644 vendor/OTPHP/OTP.php delete mode 100644 vendor/OTPHP/OTPHP.php delete mode 100644 vendor/OTPHP/TOTP.php delete mode 100644 vendor/Psr/Log/AbstractLogger.php delete mode 100644 vendor/Psr/Log/InvalidArgumentException.php delete mode 100644 vendor/Psr/Log/LogLevel.php delete mode 100644 vendor/Psr/Log/LoggerAwareInterface.php delete mode 100644 vendor/Psr/Log/LoggerAwareTrait.php delete mode 100644 vendor/Psr/Log/LoggerInterface.php delete mode 100644 vendor/Psr/Log/LoggerTrait.php delete mode 100644 vendor/Psr/Log/NullLogger.php delete mode 100644 vendor/Psr/Log/Test/LoggerInterfaceTest.php create mode 100644 vendor/autoload.php create mode 100644 vendor/beberlei/assert/LICENSE create mode 100644 vendor/beberlei/assert/composer.json create mode 100644 vendor/beberlei/assert/lib/Assert/Assert.php create mode 100644 vendor/beberlei/assert/lib/Assert/Assertion.php create mode 100644 vendor/beberlei/assert/lib/Assert/AssertionChain.php create mode 100644 vendor/beberlei/assert/lib/Assert/AssertionFailedException.php create mode 100644 vendor/beberlei/assert/lib/Assert/InvalidArgumentException.php create mode 100644 vendor/beberlei/assert/lib/Assert/LazyAssertion.php create mode 100644 vendor/beberlei/assert/lib/Assert/LazyAssertionException.php create mode 100644 vendor/beberlei/assert/lib/Assert/functions.php create mode 100644 vendor/beberlei/assert/phpstan-code.neon create mode 100644 vendor/beberlei/assert/phpstan-tests.neon create mode 100644 vendor/chillerlan/php-qrcode/.github/FUNDING.yml create mode 100644 vendor/chillerlan/php-qrcode/.github/workflows/tests.yml create mode 100644 vendor/chillerlan/php-qrcode/.gitignore create mode 100644 vendor/chillerlan/php-qrcode/.scrutinizer.yml create mode 100644 vendor/chillerlan/php-qrcode/.travis.yml create mode 100644 vendor/chillerlan/php-qrcode/LICENSE create mode 100644 vendor/chillerlan/php-qrcode/README.md create mode 100644 vendor/chillerlan/php-qrcode/composer.json create mode 100644 vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php create mode 100644 vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php create mode 100644 vendor/chillerlan/php-qrcode/examples/QRImageWithText.php create mode 100644 vendor/chillerlan/php-qrcode/examples/custom_output.php create mode 100644 vendor/chillerlan/php-qrcode/examples/example_image.png create mode 100644 vendor/chillerlan/php-qrcode/examples/example_svg.png create mode 100644 vendor/chillerlan/php-qrcode/examples/fpdf.php create mode 100644 vendor/chillerlan/php-qrcode/examples/html.php create mode 100644 vendor/chillerlan/php-qrcode/examples/image.php create mode 100644 vendor/chillerlan/php-qrcode/examples/imageWithLogo.php create mode 100644 vendor/chillerlan/php-qrcode/examples/imageWithText.php create mode 100644 vendor/chillerlan/php-qrcode/examples/imagick.php create mode 100644 vendor/chillerlan/php-qrcode/examples/octocat.png create mode 100644 vendor/chillerlan/php-qrcode/examples/svg.php create mode 100644 vendor/chillerlan/php-qrcode/examples/text.php create mode 100644 vendor/chillerlan/php-qrcode/phpdoc.xml create mode 100644 vendor/chillerlan/php-qrcode/phpmd.xml create mode 100644 vendor/chillerlan/php-qrcode/phpunit.xml create mode 100644 vendor/chillerlan/php-qrcode/public/index.html create mode 100644 vendor/chillerlan/php-qrcode/public/qrcode.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/AlphaNum.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/Byte.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/Kanji.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/MaskPatternTester.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/Number.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/QRCodeDataException.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/QRDataAbstract.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/QRDataInterface.php create mode 100644 vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php create mode 100644 vendor/chillerlan/php-qrcode/src/Helpers/BitBuffer.php create mode 100644 vendor/chillerlan/php-qrcode/src/Helpers/Polynomial.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRCodeOutputException.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRFpdf.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRImage.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRImagick.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRMarkup.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QROutputAbstract.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QROutputInterface.php create mode 100644 vendor/chillerlan/php-qrcode/src/Output/QRString.php create mode 100644 vendor/chillerlan/php-qrcode/src/QRCode.php create mode 100644 vendor/chillerlan/php-qrcode/src/QRCodeException.php create mode 100644 vendor/chillerlan/php-qrcode/src/QROptions.php create mode 100644 vendor/chillerlan/php-qrcode/src/QROptionsTrait.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/AlphaNumTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/ByteTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/DatainterfaceTestAbstract.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/KanjiTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/MaskPatternTesterTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/NumberTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Data/QRMatrixTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Helpers/BitBufferTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Helpers/PolynomialTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRFpdfTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRImagickTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRMarkupTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QROutputTestAbstract.php create mode 100644 vendor/chillerlan/php-qrcode/tests/Output/QRStringTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/QRCodeTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/QROptionsTest.php create mode 100644 vendor/chillerlan/php-qrcode/tests/QRTestAbstract.php create mode 100644 vendor/chillerlan/php-settings-container/.gitignore create mode 100644 vendor/chillerlan/php-settings-container/.scrutinizer.yml create mode 100644 vendor/chillerlan/php-settings-container/.travis.yml create mode 100644 vendor/chillerlan/php-settings-container/LICENSE create mode 100644 vendor/chillerlan/php-settings-container/README.md create mode 100644 vendor/chillerlan/php-settings-container/composer.json create mode 100644 vendor/chillerlan/php-settings-container/examples/advanced.php create mode 100644 vendor/chillerlan/php-settings-container/examples/simple.php create mode 100644 vendor/chillerlan/php-settings-container/phpmd.xml create mode 100644 vendor/chillerlan/php-settings-container/phpunit.xml create mode 100644 vendor/chillerlan/php-settings-container/src/SettingsContainerAbstract.php create mode 100644 vendor/chillerlan/php-settings-container/src/SettingsContainerInterface.php create mode 100644 vendor/chillerlan/php-settings-container/tests/ContainerTest.php create mode 100644 vendor/chillerlan/php-settings-container/tests/TestContainer.php create mode 100644 vendor/chillerlan/php-settings-container/tests/TestOptionsTrait.php create mode 100644 vendor/composer/ClassLoader.php create mode 100644 vendor/composer/InstalledVersions.php create mode 100644 vendor/composer/LICENSE create mode 100644 vendor/composer/autoload_classmap.php create mode 100644 vendor/composer/autoload_files.php create mode 100644 vendor/composer/autoload_namespaces.php create mode 100644 vendor/composer/autoload_psr4.php create mode 100644 vendor/composer/autoload_real.php create mode 100644 vendor/composer/autoload_static.php create mode 100644 vendor/composer/installed.json create mode 100644 vendor/composer/installed.php create mode 100644 vendor/composer/platform_check.php create mode 100644 vendor/paragonie/constant_time_encoding/.gitignore create mode 100644 vendor/paragonie/constant_time_encoding/.travis.yml create mode 100644 vendor/paragonie/constant_time_encoding/LICENSE.txt create mode 100644 vendor/paragonie/constant_time_encoding/README.md create mode 100644 vendor/paragonie/constant_time_encoding/composer.json create mode 100644 vendor/paragonie/constant_time_encoding/phpunit.xml.dist create mode 100644 vendor/paragonie/constant_time_encoding/psalm.xml create mode 100644 vendor/paragonie/constant_time_encoding/src/Base32.php create mode 100644 vendor/paragonie/constant_time_encoding/src/Base32Hex.php create mode 100644 vendor/paragonie/constant_time_encoding/src/Base64.php create mode 100644 vendor/paragonie/constant_time_encoding/src/Base64DotSlash.php create mode 100644 vendor/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php create mode 100644 vendor/paragonie/constant_time_encoding/src/Base64UrlSafe.php create mode 100644 vendor/paragonie/constant_time_encoding/src/Binary.php create mode 100644 vendor/paragonie/constant_time_encoding/src/EncoderInterface.php create mode 100644 vendor/paragonie/constant_time_encoding/src/Encoding.php create mode 100644 vendor/paragonie/constant_time_encoding/src/Hex.php create mode 100644 vendor/paragonie/constant_time_encoding/src/RFC4648.php create mode 100644 vendor/paragonie/constant_time_encoding/tests/Base32HexTest.php create mode 100644 vendor/paragonie/constant_time_encoding/tests/Base32Test.php create mode 100644 vendor/paragonie/constant_time_encoding/tests/Base64DotSlashOrderedTest.php create mode 100644 vendor/paragonie/constant_time_encoding/tests/Base64DotSlashTest.php create mode 100644 vendor/paragonie/constant_time_encoding/tests/Base64Test.php create mode 100644 vendor/paragonie/constant_time_encoding/tests/Base64UrlSafeTest.php create mode 100644 vendor/paragonie/constant_time_encoding/tests/EncodingTest.php create mode 100644 vendor/paragonie/constant_time_encoding/tests/HexTest.php create mode 100644 vendor/paragonie/constant_time_encoding/tests/RFC4648Test.php create mode 100644 vendor/spomky-labs/otphp/.github/CONTRIBUTING.md create mode 100644 vendor/spomky-labs/otphp/.github/ISSUE_TEMPLATE.md create mode 100644 vendor/spomky-labs/otphp/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 vendor/spomky-labs/otphp/.github/stale.yml create mode 100644 vendor/spomky-labs/otphp/.php_cs.dist create mode 100644 vendor/spomky-labs/otphp/CODE_OF_CONDUCT.md create mode 100644 vendor/spomky-labs/otphp/LICENSE create mode 100644 vendor/spomky-labs/otphp/composer.json create mode 100644 vendor/spomky-labs/otphp/phpstan.neon create mode 100644 vendor/spomky-labs/otphp/src/Factory.php create mode 100644 vendor/spomky-labs/otphp/src/FactoryInterface.php create mode 100644 vendor/spomky-labs/otphp/src/HOTP.php create mode 100644 vendor/spomky-labs/otphp/src/HOTPInterface.php create mode 100644 vendor/spomky-labs/otphp/src/OTP.php create mode 100644 vendor/spomky-labs/otphp/src/OTPInterface.php create mode 100644 vendor/spomky-labs/otphp/src/ParameterTrait.php create mode 100644 vendor/spomky-labs/otphp/src/TOTP.php create mode 100644 vendor/spomky-labs/otphp/src/TOTPInterface.php create mode 100644 vendor/thecodingmachine/safe/LICENSE create mode 100644 vendor/thecodingmachine/safe/README.md create mode 100644 vendor/thecodingmachine/safe/composer.json create mode 100644 vendor/thecodingmachine/safe/deprecated/Exceptions/ApcException.php create mode 100644 vendor/thecodingmachine/safe/deprecated/Exceptions/LibeventException.php create mode 100644 vendor/thecodingmachine/safe/deprecated/Exceptions/MssqlException.php create mode 100644 vendor/thecodingmachine/safe/deprecated/Exceptions/StatsException.php create mode 100644 vendor/thecodingmachine/safe/deprecated/apc.php create mode 100644 vendor/thecodingmachine/safe/deprecated/functionsList.php create mode 100644 vendor/thecodingmachine/safe/deprecated/libevent.php create mode 100644 vendor/thecodingmachine/safe/deprecated/mssql.php create mode 100644 vendor/thecodingmachine/safe/deprecated/stats.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/.gitkeep create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ApacheException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ApcuException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ArrayException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/Bzip2Exception.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/CalendarException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ClassobjException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ComException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/CubridException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/DatetimeException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/DirException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/EioException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ErrorfuncException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ExecException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/FileinfoException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/FilesystemException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/FilterException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/FpmException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/FtpException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/FunchandException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/GmpException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/GnupgException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/HashException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/IbaseException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/IbmDb2Exception.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/IconvException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ImageException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ImapException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/InfoException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/IngresiiException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/InotifyException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/LdapException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/LibxmlException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/LzfException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/MailparseException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/MbstringException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/MiscException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/MsqlException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/MysqlException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/MysqliException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/MysqlndMsException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/MysqlndQcException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/NetworkException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/Oci8Exception.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/OpcacheException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/OutcontrolException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/PasswordException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/PcntlException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/PdfException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/PgsqlException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/PosixException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/PsException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/PspellException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ReadlineException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/RpminfoException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/RrdException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SemException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SessionException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ShmopException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SimplexmlException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SocketsException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SodiumException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SolrException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SplException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SqlsrvException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SsdeepException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/Ssh2Exception.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/StreamException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/StringsException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/SwooleException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/UodbcException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/UopzException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/UrlException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/VarException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/XdiffException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/XmlException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/XmlrpcException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/YamlException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/YazException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ZipException.php create mode 100644 vendor/thecodingmachine/safe/generated/Exceptions/ZlibException.php create mode 100644 vendor/thecodingmachine/safe/generated/apache.php create mode 100644 vendor/thecodingmachine/safe/generated/apcu.php create mode 100644 vendor/thecodingmachine/safe/generated/array.php create mode 100644 vendor/thecodingmachine/safe/generated/bzip2.php create mode 100644 vendor/thecodingmachine/safe/generated/calendar.php create mode 100644 vendor/thecodingmachine/safe/generated/classobj.php create mode 100644 vendor/thecodingmachine/safe/generated/com.php create mode 100644 vendor/thecodingmachine/safe/generated/cubrid.php create mode 100644 vendor/thecodingmachine/safe/generated/curl.php create mode 100644 vendor/thecodingmachine/safe/generated/datetime.php create mode 100644 vendor/thecodingmachine/safe/generated/dir.php create mode 100644 vendor/thecodingmachine/safe/generated/eio.php create mode 100644 vendor/thecodingmachine/safe/generated/errorfunc.php create mode 100644 vendor/thecodingmachine/safe/generated/exec.php create mode 100644 vendor/thecodingmachine/safe/generated/fileinfo.php create mode 100644 vendor/thecodingmachine/safe/generated/filesystem.php create mode 100644 vendor/thecodingmachine/safe/generated/filter.php create mode 100644 vendor/thecodingmachine/safe/generated/fpm.php create mode 100644 vendor/thecodingmachine/safe/generated/ftp.php create mode 100644 vendor/thecodingmachine/safe/generated/funchand.php create mode 100644 vendor/thecodingmachine/safe/generated/functionsList.php create mode 100644 vendor/thecodingmachine/safe/generated/gmp.php create mode 100644 vendor/thecodingmachine/safe/generated/gnupg.php create mode 100644 vendor/thecodingmachine/safe/generated/hash.php create mode 100644 vendor/thecodingmachine/safe/generated/ibase.php create mode 100644 vendor/thecodingmachine/safe/generated/ibmDb2.php create mode 100644 vendor/thecodingmachine/safe/generated/iconv.php create mode 100644 vendor/thecodingmachine/safe/generated/image.php create mode 100644 vendor/thecodingmachine/safe/generated/imap.php create mode 100644 vendor/thecodingmachine/safe/generated/info.php create mode 100644 vendor/thecodingmachine/safe/generated/ingres-ii.php create mode 100644 vendor/thecodingmachine/safe/generated/inotify.php create mode 100644 vendor/thecodingmachine/safe/generated/json.php create mode 100644 vendor/thecodingmachine/safe/generated/ldap.php create mode 100644 vendor/thecodingmachine/safe/generated/libxml.php create mode 100644 vendor/thecodingmachine/safe/generated/lzf.php create mode 100644 vendor/thecodingmachine/safe/generated/mailparse.php create mode 100644 vendor/thecodingmachine/safe/generated/mbstring.php create mode 100644 vendor/thecodingmachine/safe/generated/misc.php create mode 100644 vendor/thecodingmachine/safe/generated/msql.php create mode 100644 vendor/thecodingmachine/safe/generated/mysql.php create mode 100644 vendor/thecodingmachine/safe/generated/mysqli.php create mode 100644 vendor/thecodingmachine/safe/generated/mysqlndMs.php create mode 100644 vendor/thecodingmachine/safe/generated/mysqlndQc.php create mode 100644 vendor/thecodingmachine/safe/generated/network.php create mode 100644 vendor/thecodingmachine/safe/generated/oci8.php create mode 100644 vendor/thecodingmachine/safe/generated/opcache.php create mode 100644 vendor/thecodingmachine/safe/generated/openssl.php create mode 100644 vendor/thecodingmachine/safe/generated/outcontrol.php create mode 100644 vendor/thecodingmachine/safe/generated/password.php create mode 100644 vendor/thecodingmachine/safe/generated/pcntl.php create mode 100644 vendor/thecodingmachine/safe/generated/pcre.php create mode 100644 vendor/thecodingmachine/safe/generated/pdf.php create mode 100644 vendor/thecodingmachine/safe/generated/pgsql.php create mode 100644 vendor/thecodingmachine/safe/generated/posix.php create mode 100644 vendor/thecodingmachine/safe/generated/ps.php create mode 100644 vendor/thecodingmachine/safe/generated/pspell.php create mode 100644 vendor/thecodingmachine/safe/generated/readline.php create mode 100644 vendor/thecodingmachine/safe/generated/rpminfo.php create mode 100644 vendor/thecodingmachine/safe/generated/rrd.php create mode 100644 vendor/thecodingmachine/safe/generated/sem.php create mode 100644 vendor/thecodingmachine/safe/generated/session.php create mode 100644 vendor/thecodingmachine/safe/generated/shmop.php create mode 100644 vendor/thecodingmachine/safe/generated/simplexml.php create mode 100644 vendor/thecodingmachine/safe/generated/sockets.php create mode 100644 vendor/thecodingmachine/safe/generated/sodium.php create mode 100644 vendor/thecodingmachine/safe/generated/solr.php create mode 100644 vendor/thecodingmachine/safe/generated/spl.php create mode 100644 vendor/thecodingmachine/safe/generated/sqlsrv.php create mode 100644 vendor/thecodingmachine/safe/generated/ssdeep.php create mode 100644 vendor/thecodingmachine/safe/generated/ssh2.php create mode 100644 vendor/thecodingmachine/safe/generated/stream.php create mode 100644 vendor/thecodingmachine/safe/generated/strings.php create mode 100644 vendor/thecodingmachine/safe/generated/swoole.php create mode 100644 vendor/thecodingmachine/safe/generated/uodbc.php create mode 100644 vendor/thecodingmachine/safe/generated/uopz.php create mode 100644 vendor/thecodingmachine/safe/generated/url.php create mode 100644 vendor/thecodingmachine/safe/generated/var.php create mode 100644 vendor/thecodingmachine/safe/generated/xdiff.php create mode 100644 vendor/thecodingmachine/safe/generated/xml.php create mode 100644 vendor/thecodingmachine/safe/generated/xmlrpc.php create mode 100644 vendor/thecodingmachine/safe/generated/yaml.php create mode 100644 vendor/thecodingmachine/safe/generated/yaz.php create mode 100644 vendor/thecodingmachine/safe/generated/zip.php create mode 100644 vendor/thecodingmachine/safe/generated/zlib.php create mode 100644 vendor/thecodingmachine/safe/lib/DateTime.php create mode 100644 vendor/thecodingmachine/safe/lib/DateTimeImmutable.php create mode 100644 vendor/thecodingmachine/safe/lib/Exceptions/CurlException.php create mode 100644 vendor/thecodingmachine/safe/lib/Exceptions/JsonException.php create mode 100644 vendor/thecodingmachine/safe/lib/Exceptions/OpensslException.php create mode 100644 vendor/thecodingmachine/safe/lib/Exceptions/PcreException.php create mode 100644 vendor/thecodingmachine/safe/lib/Exceptions/SafeExceptionInterface.php create mode 100644 vendor/thecodingmachine/safe/lib/special_cases.php create mode 100644 vendor/thecodingmachine/safe/rector-migrate-0.7.php (limited to 'vendor') diff --git a/vendor/OTPHP/Base32.php b/vendor/OTPHP/Base32.php deleted file mode 100644 index f0dc2f16b..000000000 --- a/vendor/OTPHP/Base32.php +++ /dev/null @@ -1,85 +0,0 @@ -'0', 'B'=>'1', 'C'=>'2', 'D'=>'3', 'E'=>'4', 'F'=>'5', 'G'=>'6', 'H'=>'7', - 'I'=>'8', 'J'=>'9', 'K'=>'10', 'L'=>'11', 'M'=>'12', 'N'=>'13', 'O'=>'14', 'P'=>'15', - 'Q'=>'16', 'R'=>'17', 'S'=>'18', 'T'=>'19', 'U'=>'20', 'V'=>'21', 'W'=>'22', 'X'=>'23', - 'Y'=>'24', 'Z'=>'25', '2'=>'26', '3'=>'27', '4'=>'28', '5'=>'29', '6'=>'30', '7'=>'31' - ); - - /** - * Use padding false when encoding for urls - * - * @return base32 encoded string - * @author Bryan Ruiz - **/ - public static function encode($input, $padding = true) { - if(empty($input)) return ""; - $input = str_split($input); - $binaryString = ""; - for($i = 0; $i < count($input); $i++) { - $binaryString .= str_pad(base_convert(ord($input[$i]), 10, 2), 8, '0', STR_PAD_LEFT); - } - $fiveBitBinaryArray = str_split($binaryString, 5); - $base32 = ""; - $i=0; - while($i < count($fiveBitBinaryArray)) { - $base32 .= self::$map[base_convert(str_pad($fiveBitBinaryArray[$i], 5,'0'), 2, 10)]; - $i++; - } - if($padding && ($x = strlen($binaryString) % 40) != 0) { - if($x == 8) $base32 .= str_repeat(self::$map[32], 6); - else if($x == 16) $base32 .= str_repeat(self::$map[32], 4); - else if($x == 24) $base32 .= str_repeat(self::$map[32], 3); - else if($x == 32) $base32 .= self::$map[32]; - } - return $base32; - } - - public static function decode($input) { - if(empty($input)) return; - $paddingCharCount = substr_count($input, self::$map[32]); - $allowedValues = array(6,4,3,1,0); - if(!in_array($paddingCharCount, $allowedValues)) return false; - for($i=0; $i<4; $i++){ - if($paddingCharCount == $allowedValues[$i] && - substr($input, -($allowedValues[$i])) != str_repeat(self::$map[32], $allowedValues[$i])) return false; - } - $input = str_replace('=','', $input); - $input = str_split($input); - $binaryString = ""; - for($i=0; $i < count($input); $i = $i+8) { - $x = ""; - if(!in_array($input[$i], self::$map)) return false; - for($j=0; $j < 8; $j++) { - $x .= str_pad(base_convert(@self::$flippedMap[@$input[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT); - } - $eightBits = str_split($x, 8); - for($z = 0; $z < count($eightBits); $z++) { - $binaryString .= ( ($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48 ) ? $y:""; - } - } - return $binaryString; - } -} - diff --git a/vendor/OTPHP/HOTP.php b/vendor/OTPHP/HOTP.php deleted file mode 100644 index 7092fd9ff..000000000 --- a/vendor/OTPHP/HOTP.php +++ /dev/null @@ -1,74 +0,0 @@ -generateOTP($count); - } - - - /** - * Verify if a password is valid for a specific counter value - * - * @param integer $otp the one-time password - * @param integer $counter the counter value - * @return bool true if the counter is valid, false otherwise - */ - public function verify($otp, $counter) { - return ($otp == $this->at($counter)); - } - - /** - * Returns the uri for a specific secret for hotp method. - * Can be encoded as a image for simple configuration in - * Google Authenticator. - * - * @param string $name the name of the account / profile - * @param integer $initial_count the initial counter - * @return string the uri for the hmac secret - */ - public function provisioning_uri($name, $initial_count) { - return "otpauth://hotp/".urlencode($name)."?secret={$this->secret}&counter=$initial_count"; - } - } - -} diff --git a/vendor/OTPHP/LICENCE b/vendor/OTPHP/LICENCE deleted file mode 100644 index d14cbc23c..000000000 --- a/vendor/OTPHP/LICENCE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2011 Le Lag - -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/OTPHP/OTP.php b/vendor/OTPHP/OTP.php deleted file mode 100644 index d1995ef99..000000000 --- a/vendor/OTPHP/OTP.php +++ /dev/null @@ -1,120 +0,0 @@ -digits = isset($opt['digits']) ? $opt['digits'] : 6; - $this->digest = isset($opt['digest']) ? $opt['digest'] : 'sha1'; - $this->secret = $secret; - } - - /** - * Generate a one-time password - * - * @param integer $input : number used to seed the hmac hash function. - * This number is usually a counter (HOTP) or calculated based on the current - * timestamp (see TOTP class). - * @return integer the one-time password - */ - public function generateOTP($input) { - $hash = hash_hmac($this->digest, $this->intToBytestring($input), $this->byteSecret()); - foreach(str_split($hash, 2) as $hex) { // stupid PHP has bin2hex but no hex2bin WTF - $hmac[] = hexdec($hex); - } - $offset = $hmac[19] & 0xf; - $code = ($hmac[$offset+0] & 0x7F) << 24 | - ($hmac[$offset + 1] & 0xFF) << 16 | - ($hmac[$offset + 2] & 0xFF) << 8 | - ($hmac[$offset + 3] & 0xFF); - return $code % pow(10, $this->digits); - } - - /** - * Returns the binary value of the base32 encoded secret - * @access private - * This method should be private but was left public for - * phpunit tests to work. - * @return binary secret key - */ - public function byteSecret() { - return Base32::decode($this->secret); - } - - /** - * Turns an integer in a OATH bytestring - * @param integer $int - * @access private - * @return string bytestring - */ - public function intToBytestring($int) { - $result = Array(); - while($int != 0) { - $result[] = chr($int & 0xFF); - $int >>= 8; - } - return str_pad(join(array_reverse($result)), 8, "\000", STR_PAD_LEFT); - } - } -} diff --git a/vendor/OTPHP/OTPHP.php b/vendor/OTPHP/OTPHP.php deleted file mode 100644 index a6c6f8d66..000000000 --- a/vendor/OTPHP/OTPHP.php +++ /dev/null @@ -1,27 +0,0 @@ -interval = isset($opt['interval']) ? $opt['interval'] : 30; - parent::__construct($s, $opt); - } - - /** - * Get the password for a specific timestamp value - * - * @param integer $timestamp the timestamp which is timecoded and - * used to seed the hmac hash function. - * @return integer the One Time Password - */ - public function at($timestamp) { - return $this->generateOTP($this->timecode($timestamp)); - } - - /** - * Get the password for the current timestamp value - * - * @return integer the current One Time Password - */ - public function now() { - return $this->generateOTP($this->timecode(time())); - } - - /** - * Verify if a password is valid for a specific counter value - * - * @param integer $otp the one-time password - * @param integer $timestamp the timestamp for the a given time, defaults to current time. - * @return bool true if the counter is valid, false otherwise - */ - public function verify($otp, $timestamp = null) { - if($timestamp === null) - $timestamp = time(); - return ($otp == $this->at($timestamp)); - } - - /** - * Returns the uri for a specific secret for totp method. - * Can be encoded as a image for simple configuration in - * Google Authenticator. - * - * @param string $name the name of the account / profile - * @return string the uri for the hmac secret - */ - public function provisioning_uri($name) { - return "otpauth://totp/".urlencode($name)."?secret={$this->secret}"; - } - - /** - * Transform a timestamp in a counter based on specified internal - * - * @param integer $timestamp - * @return integer the timecode - */ - protected function timecode($timestamp) { - return (int)( (((int)$timestamp * 1000) / ($this->interval * 1000))); - } - } - -} diff --git a/vendor/Psr/Log/AbstractLogger.php b/vendor/Psr/Log/AbstractLogger.php deleted file mode 100644 index 90e721af2..000000000 --- a/vendor/Psr/Log/AbstractLogger.php +++ /dev/null @@ -1,128 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } -} diff --git a/vendor/Psr/Log/InvalidArgumentException.php b/vendor/Psr/Log/InvalidArgumentException.php deleted file mode 100644 index 67f852d1d..000000000 --- a/vendor/Psr/Log/InvalidArgumentException.php +++ /dev/null @@ -1,7 +0,0 @@ -logger = $logger; - } -} diff --git a/vendor/Psr/Log/LoggerInterface.php b/vendor/Psr/Log/LoggerInterface.php deleted file mode 100644 index 5ea72438b..000000000 --- a/vendor/Psr/Log/LoggerInterface.php +++ /dev/null @@ -1,123 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function alert($message, array $context = array()) - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function critical($message, array $context = array()) - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function error($message, array $context = array()) - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function warning($message, array $context = array()) - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function notice($message, array $context = array()) - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function info($message, array $context = array()) - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string $message - * @param array $context - * - * @return void - */ - public function debug($message, array $context = array()) - { - $this->log(LogLevel::DEBUG, $message, $context); - } - - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void - */ - abstract public function log($level, $message, array $context = array()); -} diff --git a/vendor/Psr/Log/NullLogger.php b/vendor/Psr/Log/NullLogger.php deleted file mode 100644 index d8cd682c8..000000000 --- a/vendor/Psr/Log/NullLogger.php +++ /dev/null @@ -1,28 +0,0 @@ -logger) { }` - * blocks. - */ -class NullLogger extends AbstractLogger -{ - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string $message - * @param array $context - * - * @return void - */ - public function log($level, $message, array $context = array()) - { - // noop - } -} diff --git a/vendor/Psr/Log/Test/LoggerInterfaceTest.php b/vendor/Psr/Log/Test/LoggerInterfaceTest.php deleted file mode 100644 index a0391a52b..000000000 --- a/vendor/Psr/Log/Test/LoggerInterfaceTest.php +++ /dev/null @@ -1,140 +0,0 @@ - ". - * - * Example ->error('Foo') would yield "error Foo". - * - * @return string[] - */ - abstract public function getLogs(); - - public function testImplements() - { - $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger()); - } - - /** - * @dataProvider provideLevelsAndMessages - */ - public function testLogsAtAllLevels($level, $message) - { - $logger = $this->getLogger(); - $logger->{$level}($message, array('user' => 'Bob')); - $logger->log($level, $message, array('user' => 'Bob')); - - $expected = array( - $level.' message of level '.$level.' with context: Bob', - $level.' message of level '.$level.' with context: Bob', - ); - $this->assertEquals($expected, $this->getLogs()); - } - - public function provideLevelsAndMessages() - { - return array( - LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), - LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), - LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), - LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), - LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), - LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), - LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), - LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), - ); - } - - /** - * @expectedException \Psr\Log\InvalidArgumentException - */ - public function testThrowsOnInvalidLevel() - { - $logger = $this->getLogger(); - $logger->log('invalid level', 'Foo'); - } - - public function testContextReplacement() - { - $logger = $this->getLogger(); - $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); - - $expected = array('info {Message {nothing} Bob Bar a}'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testObjectCastToString() - { - if (method_exists($this, 'createPartialMock')) { - $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString')); - } else { - $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString')); - } - $dummy->expects($this->once()) - ->method('__toString') - ->will($this->returnValue('DUMMY')); - - $this->getLogger()->warning($dummy); - - $expected = array('warning DUMMY'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextCanContainAnything() - { - $context = array( - 'bool' => true, - 'null' => null, - 'string' => 'Foo', - 'int' => 0, - 'float' => 0.5, - 'nested' => array('with object' => new DummyTest), - 'object' => new \DateTime, - 'resource' => fopen('php://memory', 'r'), - ); - - $this->getLogger()->warning('Crazy context data', $context); - - $expected = array('warning Crazy context data'); - $this->assertEquals($expected, $this->getLogs()); - } - - public function testContextExceptionKeyCanBeExceptionOrOtherValues() - { - $logger = $this->getLogger(); - $logger->warning('Random message', array('exception' => 'oops')); - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); - - $expected = array( - 'warning Random message', - 'critical Uncaught Exception!' - ); - $this->assertEquals($expected, $this->getLogs()); - } -} - -class DummyTest -{ - public function __toString() - { - } -} diff --git a/vendor/autoload.php b/vendor/autoload.php new file mode 100644 index 000000000..e6e3ad736 --- /dev/null +++ b/vendor/autoload.php @@ -0,0 +1,7 @@ +=6.0.0 <8" + }, + "scripts": { + "assert:generate-docs": "php bin/generate_method_docs.php", + "assert:cs-lint": "php-cs-fixer fix --diff -vvv --dry-run", + "assert:cs-fix": "php-cs-fixer fix . -vvv || true", + "assert:sa-code": "vendor/bin/phpstan analyse --configuration=phpstan-code.neon --no-progress --ansi -l 7 bin lib", + "assert:sa-tests": "vendor/bin/phpstan analyse --configuration=phpstan-tests.neon --no-progress --ansi -l 7 tests" + }, + "suggest": { + "ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles" + } +} diff --git a/vendor/beberlei/assert/lib/Assert/Assert.php b/vendor/beberlei/assert/lib/Assert/Assert.php new file mode 100644 index 000000000..6910258d6 --- /dev/null +++ b/vendor/beberlei/assert/lib/Assert/Assert.php @@ -0,0 +1,96 @@ +notEmpty()->integer(); + * Assert::that($value)->nullOr()->string()->startsWith("Foo"); + * + * The assertion chain can be stateful, that means be careful when you reuse + * it. You should never pass around the chain. + */ + public static function that($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain + { + $assertionChain = new AssertionChain($value, $defaultMessage, $defaultPropertyPath); + + return $assertionChain->setAssertionClassName(static::$assertionClass); + } + + /** + * Start validation on a set of values, returns {@link AssertionChain}. + * + * @param mixed $values + * @param string|callable|null $defaultMessage + * @param string|null $defaultPropertyPath + * + * @return AssertionChain + */ + public static function thatAll($values, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain + { + return static::that($values, $defaultMessage, $defaultPropertyPath)->all(); + } + + /** + * Start validation and allow NULL, returns {@link AssertionChain}. + * + * @param mixed $value + * @param string|callable|null $defaultMessage + * @param string|null $defaultPropertyPath + * + * @return AssertionChain + */ + public static function thatNullOr($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain + { + return static::that($value, $defaultMessage, $defaultPropertyPath)->nullOr(); + } + + /** + * Create a lazy assertion object. + * + * @return LazyAssertion + */ + public static function lazy(): LazyAssertion + { + $lazyAssertion = new LazyAssertion(); + + return $lazyAssertion + ->setAssertClass(\get_called_class()) + ->setExceptionClass(static::$lazyAssertionExceptionClass); + } +} diff --git a/vendor/beberlei/assert/lib/Assert/Assertion.php b/vendor/beberlei/assert/lib/Assert/Assertion.php new file mode 100644 index 000000000..a8b04e529 --- /dev/null +++ b/vendor/beberlei/assert/lib/Assert/Assertion.php @@ -0,0 +1,2825 @@ + + * + * @method static bool allAlnum(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is alphanumeric for all values. + * @method static bool allBase64(string[] $value, string|callable $message = null, string $propertyPath = null) Assert that a constant is defined for all values. + * @method static bool allBetween(mixed[] $value, mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit for all values. + * @method static bool allBetweenExclusive(mixed[] $value, mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater than a lower limit, and less than an upper limit for all values. + * @method static bool allBetweenLength(mixed[] $value, int $minLength, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string length is between min and max lengths for all values. + * @method static bool allBoolean(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is php boolean for all values. + * @method static bool allChoice(mixed[] $value, array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices for all values. + * @method static bool allChoicesNotEmpty(array[] $values, array $choices, string|callable $message = null, string $propertyPath = null) Determines if the values array has every choice as key and that this choice has content for all values. + * @method static bool allClassExists(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that the class exists for all values. + * @method static bool allContains(mixed[] $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string contains a sequence of chars for all values. + * @method static bool allCount(array[]|Countable[]|ResourceBundle[]|SimpleXMLElement[] $countable, int $count, string|callable $message = null, string $propertyPath = null) Assert that the count of countable is equal to count for all values. + * @method static bool allDate(string[] $value, string $format, string|callable $message = null, string $propertyPath = null) Assert that date is valid and corresponds to the given format for all values. + * @method static bool allDefined(mixed[] $constant, string|callable $message = null, string $propertyPath = null) Assert that a constant is defined for all values. + * @method static bool allDigit(mixed[] $value, string|callable $message = null, string $propertyPath = null) Validates if an integer or integerish is a digit for all values. + * @method static bool allDirectory(string[] $value, string|callable $message = null, string $propertyPath = null) Assert that a directory exists for all values. + * @method static bool allE164(string[] $value, string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid E164 Phone Number for all values. + * @method static bool allEmail(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL) for all values. + * @method static bool allEndsWith(mixed[] $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string ends with a sequence of chars for all values. + * @method static bool allEq(mixed[] $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are equal (using ==) for all values. + * @method static bool allEqArraySubset(mixed[] $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that the array contains the subset for all values. + * @method static bool allExtensionLoaded(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded for all values. + * @method static bool allExtensionVersion(string[] $extension, string $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded and a specific version is installed for all values. + * @method static bool allFalse(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that the value is boolean False for all values. + * @method static bool allFile(string[] $value, string|callable $message = null, string $propertyPath = null) Assert that a file exists for all values. + * @method static bool allFloat(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is a php float for all values. + * @method static bool allGreaterOrEqualThan(mixed[] $value, mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater or equal than given limit for all values. + * @method static bool allGreaterThan(mixed[] $value, mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater than given limit for all values. + * @method static bool allImplementsInterface(mixed[] $class, string $interfaceName, string|callable $message = null, string $propertyPath = null) Assert that the class implements the interface for all values. + * @method static bool allInArray(mixed[] $value, array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. This is an alias of Assertion::choice() for all values. + * @method static bool allInteger(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is a php integer for all values. + * @method static bool allIntegerish(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is a php integer'ish for all values. + * @method static bool allInterfaceExists(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that the interface exists for all values. + * @method static bool allIp(string[] $value, int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 or IPv6 address for all values. + * @method static bool allIpv4(string[] $value, int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 address for all values. + * @method static bool allIpv6(string[] $value, int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv6 address for all values. + * @method static bool allIsArray(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is an array for all values. + * @method static bool allIsArrayAccessible(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is an array or an array-accessible object for all values. + * @method static bool allIsCallable(mixed[] $value, string|callable $message = null, string $propertyPath = null) Determines that the provided value is callable for all values. + * @method static bool allIsCountable(array[]|Countable[]|ResourceBundle[]|SimpleXMLElement[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is countable for all values. + * @method static bool allIsInstanceOf(mixed[] $value, string $className, string|callable $message = null, string $propertyPath = null) Assert that value is instance of given class-name for all values. + * @method static bool allIsJsonString(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid json string for all values. + * @method static bool allIsObject(mixed[] $value, string|callable $message = null, string $propertyPath = null) Determines that the provided value is an object for all values. + * @method static bool allIsResource(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is a resource for all values. + * @method static bool allIsTraversable(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is an array or a traversable object for all values. + * @method static bool allKeyExists(mixed[] $value, string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array for all values. + * @method static bool allKeyIsset(mixed[] $value, string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object using isset() for all values. + * @method static bool allKeyNotExists(mixed[] $value, string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key does not exist in an array for all values. + * @method static bool allLength(mixed[] $value, int $length, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string has a given length for all values. + * @method static bool allLessOrEqualThan(mixed[] $value, mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less or equal than given limit for all values. + * @method static bool allLessThan(mixed[] $value, mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less than given limit for all values. + * @method static bool allMax(mixed[] $value, mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that a number is smaller as a given limit for all values. + * @method static bool allMaxCount(array[]|Countable[]|ResourceBundle[]|SimpleXMLElement[] $countable, int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at most $count elements for all values. + * @method static bool allMaxLength(mixed[] $value, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string value is not longer than $maxLength chars for all values. + * @method static bool allMethodExists(string[] $value, mixed $object, string|callable $message = null, string $propertyPath = null) Determines that the named method is defined in the provided object for all values. + * @method static bool allMin(mixed[] $value, mixed $minValue, string|callable $message = null, string $propertyPath = null) Assert that a value is at least as big as a given limit for all values. + * @method static bool allMinCount(array[]|Countable[]|ResourceBundle[]|SimpleXMLElement[] $countable, int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at least $count elements for all values. + * @method static bool allMinLength(mixed[] $value, int $minLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that a string is at least $minLength chars long for all values. + * @method static bool allNoContent(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is empty for all values. + * @method static bool allNotBlank(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is not blank for all values. + * @method static bool allNotContains(mixed[] $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string does not contains a sequence of chars for all values. + * @method static bool allNotEmpty(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is not empty for all values. + * @method static bool allNotEmptyKey(mixed[] $value, string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object and its value is not empty for all values. + * @method static bool allNotEq(mixed[] $value1, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not equal (using ==) for all values. + * @method static bool allNotInArray(mixed[] $value, array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is not in array of choices for all values. + * @method static bool allNotIsInstanceOf(mixed[] $value, string $className, string|callable $message = null, string $propertyPath = null) Assert that value is not instance of given class-name for all values. + * @method static bool allNotNull(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is not null for all values. + * @method static bool allNotRegex(mixed[] $value, string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value does not match a regex for all values. + * @method static bool allNotSame(mixed[] $value1, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not the same (using ===) for all values. + * @method static bool allNull(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is null for all values. + * @method static bool allNumeric(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is numeric for all values. + * @method static bool allObjectOrClass(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that the value is an object, or a class that exists for all values. + * @method static bool allPhpVersion(string[] $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert on PHP version for all values. + * @method static bool allPropertiesExist(mixed[] $value, array $properties, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the properties all exist for all values. + * @method static bool allPropertyExists(mixed[] $value, string $property, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the property exists for all values. + * @method static bool allRange(mixed[] $value, mixed $minValue, mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that value is in range of numbers for all values. + * @method static bool allReadable(string[] $value, string|callable $message = null, string $propertyPath = null) Assert that the value is something readable for all values. + * @method static bool allRegex(mixed[] $value, string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value matches a regex for all values. + * @method static bool allSame(mixed[] $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are the same (using ===) for all values. + * @method static bool allSatisfy(mixed[] $value, callable $callback, string|callable $message = null, string $propertyPath = null) Assert that the provided value is valid according to a callback for all values. + * @method static bool allScalar(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is a PHP scalar for all values. + * @method static bool allStartsWith(mixed[] $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string starts with a sequence of chars for all values. + * @method static bool allString(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is a string for all values. + * @method static bool allSubclassOf(mixed[] $value, string $className, string|callable $message = null, string $propertyPath = null) Assert that value is subclass of given class-name for all values. + * @method static bool allTrue(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that the value is boolean True for all values. + * @method static bool allUrl(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is an URL for all values. + * @method static bool allUuid(string[] $value, string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid UUID for all values. + * @method static bool allVersion(string[] $version1, string $operator, string $version2, string|callable $message = null, string $propertyPath = null) Assert comparison of two versions for all values. + * @method static bool allWriteable(string[] $value, string|callable $message = null, string $propertyPath = null) Assert that the value is something writeable for all values. + * @method static bool nullOrAlnum(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is alphanumeric or that the value is null. + * @method static bool nullOrBase64(string|null $value, string|callable $message = null, string $propertyPath = null) Assert that a constant is defined or that the value is null. + * @method static bool nullOrBetween(mixed|null $value, mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit or that the value is null. + * @method static bool nullOrBetweenExclusive(mixed|null $value, mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater than a lower limit, and less than an upper limit or that the value is null. + * @method static bool nullOrBetweenLength(mixed|null $value, int $minLength, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string length is between min and max lengths or that the value is null. + * @method static bool nullOrBoolean(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is php boolean or that the value is null. + * @method static bool nullOrChoice(mixed|null $value, array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices or that the value is null. + * @method static bool nullOrChoicesNotEmpty(array|null $values, array $choices, string|callable $message = null, string $propertyPath = null) Determines if the values array has every choice as key and that this choice has content or that the value is null. + * @method static bool nullOrClassExists(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that the class exists or that the value is null. + * @method static bool nullOrContains(mixed|null $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string contains a sequence of chars or that the value is null. + * @method static bool nullOrCount(array|Countable|ResourceBundle|SimpleXMLElement|null $countable, int $count, string|callable $message = null, string $propertyPath = null) Assert that the count of countable is equal to count or that the value is null. + * @method static bool nullOrDate(string|null $value, string $format, string|callable $message = null, string $propertyPath = null) Assert that date is valid and corresponds to the given format or that the value is null. + * @method static bool nullOrDefined(mixed|null $constant, string|callable $message = null, string $propertyPath = null) Assert that a constant is defined or that the value is null. + * @method static bool nullOrDigit(mixed|null $value, string|callable $message = null, string $propertyPath = null) Validates if an integer or integerish is a digit or that the value is null. + * @method static bool nullOrDirectory(string|null $value, string|callable $message = null, string $propertyPath = null) Assert that a directory exists or that the value is null. + * @method static bool nullOrE164(string|null $value, string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid E164 Phone Number or that the value is null. + * @method static bool nullOrEmail(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL) or that the value is null. + * @method static bool nullOrEndsWith(mixed|null $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string ends with a sequence of chars or that the value is null. + * @method static bool nullOrEq(mixed|null $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are equal (using ==) or that the value is null. + * @method static bool nullOrEqArraySubset(mixed|null $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that the array contains the subset or that the value is null. + * @method static bool nullOrExtensionLoaded(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded or that the value is null. + * @method static bool nullOrExtensionVersion(string|null $extension, string $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded and a specific version is installed or that the value is null. + * @method static bool nullOrFalse(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that the value is boolean False or that the value is null. + * @method static bool nullOrFile(string|null $value, string|callable $message = null, string $propertyPath = null) Assert that a file exists or that the value is null. + * @method static bool nullOrFloat(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is a php float or that the value is null. + * @method static bool nullOrGreaterOrEqualThan(mixed|null $value, mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater or equal than given limit or that the value is null. + * @method static bool nullOrGreaterThan(mixed|null $value, mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater than given limit or that the value is null. + * @method static bool nullOrImplementsInterface(mixed|null $class, string $interfaceName, string|callable $message = null, string $propertyPath = null) Assert that the class implements the interface or that the value is null. + * @method static bool nullOrInArray(mixed|null $value, array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. This is an alias of Assertion::choice() or that the value is null. + * @method static bool nullOrInteger(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is a php integer or that the value is null. + * @method static bool nullOrIntegerish(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is a php integer'ish or that the value is null. + * @method static bool nullOrInterfaceExists(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that the interface exists or that the value is null. + * @method static bool nullOrIp(string|null $value, int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 or IPv6 address or that the value is null. + * @method static bool nullOrIpv4(string|null $value, int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 address or that the value is null. + * @method static bool nullOrIpv6(string|null $value, int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv6 address or that the value is null. + * @method static bool nullOrIsArray(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is an array or that the value is null. + * @method static bool nullOrIsArrayAccessible(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is an array or an array-accessible object or that the value is null. + * @method static bool nullOrIsCallable(mixed|null $value, string|callable $message = null, string $propertyPath = null) Determines that the provided value is callable or that the value is null. + * @method static bool nullOrIsCountable(array|Countable|ResourceBundle|SimpleXMLElement|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is countable or that the value is null. + * @method static bool nullOrIsInstanceOf(mixed|null $value, string $className, string|callable $message = null, string $propertyPath = null) Assert that value is instance of given class-name or that the value is null. + * @method static bool nullOrIsJsonString(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid json string or that the value is null. + * @method static bool nullOrIsObject(mixed|null $value, string|callable $message = null, string $propertyPath = null) Determines that the provided value is an object or that the value is null. + * @method static bool nullOrIsResource(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is a resource or that the value is null. + * @method static bool nullOrIsTraversable(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is an array or a traversable object or that the value is null. + * @method static bool nullOrKeyExists(mixed|null $value, string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array or that the value is null. + * @method static bool nullOrKeyIsset(mixed|null $value, string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object using isset() or that the value is null. + * @method static bool nullOrKeyNotExists(mixed|null $value, string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key does not exist in an array or that the value is null. + * @method static bool nullOrLength(mixed|null $value, int $length, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string has a given length or that the value is null. + * @method static bool nullOrLessOrEqualThan(mixed|null $value, mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less or equal than given limit or that the value is null. + * @method static bool nullOrLessThan(mixed|null $value, mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less than given limit or that the value is null. + * @method static bool nullOrMax(mixed|null $value, mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that a number is smaller as a given limit or that the value is null. + * @method static bool nullOrMaxCount(array|Countable|ResourceBundle|SimpleXMLElement|null $countable, int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at most $count elements or that the value is null. + * @method static bool nullOrMaxLength(mixed|null $value, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string value is not longer than $maxLength chars or that the value is null. + * @method static bool nullOrMethodExists(string|null $value, mixed $object, string|callable $message = null, string $propertyPath = null) Determines that the named method is defined in the provided object or that the value is null. + * @method static bool nullOrMin(mixed|null $value, mixed $minValue, string|callable $message = null, string $propertyPath = null) Assert that a value is at least as big as a given limit or that the value is null. + * @method static bool nullOrMinCount(array|Countable|ResourceBundle|SimpleXMLElement|null $countable, int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at least $count elements or that the value is null. + * @method static bool nullOrMinLength(mixed|null $value, int $minLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that a string is at least $minLength chars long or that the value is null. + * @method static bool nullOrNoContent(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is empty or that the value is null. + * @method static bool nullOrNotBlank(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is not blank or that the value is null. + * @method static bool nullOrNotContains(mixed|null $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string does not contains a sequence of chars or that the value is null. + * @method static bool nullOrNotEmpty(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is not empty or that the value is null. + * @method static bool nullOrNotEmptyKey(mixed|null $value, string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object and its value is not empty or that the value is null. + * @method static bool nullOrNotEq(mixed|null $value1, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not equal (using ==) or that the value is null. + * @method static bool nullOrNotInArray(mixed|null $value, array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is not in array of choices or that the value is null. + * @method static bool nullOrNotIsInstanceOf(mixed|null $value, string $className, string|callable $message = null, string $propertyPath = null) Assert that value is not instance of given class-name or that the value is null. + * @method static bool nullOrNotNull(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is not null or that the value is null. + * @method static bool nullOrNotRegex(mixed|null $value, string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value does not match a regex or that the value is null. + * @method static bool nullOrNotSame(mixed|null $value1, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not the same (using ===) or that the value is null. + * @method static bool nullOrNull(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is null or that the value is null. + * @method static bool nullOrNumeric(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is numeric or that the value is null. + * @method static bool nullOrObjectOrClass(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that the value is an object, or a class that exists or that the value is null. + * @method static bool nullOrPhpVersion(string|null $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert on PHP version or that the value is null. + * @method static bool nullOrPropertiesExist(mixed|null $value, array $properties, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the properties all exist or that the value is null. + * @method static bool nullOrPropertyExists(mixed|null $value, string $property, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the property exists or that the value is null. + * @method static bool nullOrRange(mixed|null $value, mixed $minValue, mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that value is in range of numbers or that the value is null. + * @method static bool nullOrReadable(string|null $value, string|callable $message = null, string $propertyPath = null) Assert that the value is something readable or that the value is null. + * @method static bool nullOrRegex(mixed|null $value, string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value matches a regex or that the value is null. + * @method static bool nullOrSame(mixed|null $value, mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are the same (using ===) or that the value is null. + * @method static bool nullOrSatisfy(mixed|null $value, callable $callback, string|callable $message = null, string $propertyPath = null) Assert that the provided value is valid according to a callback or that the value is null. + * @method static bool nullOrScalar(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is a PHP scalar or that the value is null. + * @method static bool nullOrStartsWith(mixed|null $string, string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string starts with a sequence of chars or that the value is null. + * @method static bool nullOrString(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is a string or that the value is null. + * @method static bool nullOrSubclassOf(mixed|null $value, string $className, string|callable $message = null, string $propertyPath = null) Assert that value is subclass of given class-name or that the value is null. + * @method static bool nullOrTrue(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that the value is boolean True or that the value is null. + * @method static bool nullOrUrl(mixed|null $value, string|callable $message = null, string $propertyPath = null) Assert that value is an URL or that the value is null. + * @method static bool nullOrUuid(string|null $value, string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid UUID or that the value is null. + * @method static bool nullOrVersion(string|null $version1, string $operator, string $version2, string|callable $message = null, string $propertyPath = null) Assert comparison of two versions or that the value is null. + * @method static bool nullOrWriteable(string|null $value, string|callable $message = null, string $propertyPath = null) Assert that the value is something writeable or that the value is null. + */ +class Assertion +{ + const INVALID_FLOAT = 9; + const INVALID_INTEGER = 10; + const INVALID_DIGIT = 11; + const INVALID_INTEGERISH = 12; + const INVALID_BOOLEAN = 13; + const VALUE_EMPTY = 14; + const VALUE_NULL = 15; + const VALUE_NOT_NULL = 25; + const INVALID_STRING = 16; + const INVALID_REGEX = 17; + const INVALID_MIN_LENGTH = 18; + const INVALID_MAX_LENGTH = 19; + const INVALID_STRING_START = 20; + const INVALID_STRING_CONTAINS = 21; + const INVALID_CHOICE = 22; + const INVALID_NUMERIC = 23; + const INVALID_ARRAY = 24; + const INVALID_KEY_EXISTS = 26; + const INVALID_NOT_BLANK = 27; + const INVALID_INSTANCE_OF = 28; + const INVALID_SUBCLASS_OF = 29; + const INVALID_RANGE = 30; + const INVALID_ALNUM = 31; + const INVALID_TRUE = 32; + const INVALID_EQ = 33; + const INVALID_SAME = 34; + const INVALID_MIN = 35; + const INVALID_MAX = 36; + const INVALID_LENGTH = 37; + const INVALID_FALSE = 38; + const INVALID_STRING_END = 39; + const INVALID_UUID = 40; + const INVALID_COUNT = 41; + const INVALID_NOT_EQ = 42; + const INVALID_NOT_SAME = 43; + const INVALID_TRAVERSABLE = 44; + const INVALID_ARRAY_ACCESSIBLE = 45; + const INVALID_KEY_ISSET = 46; + const INVALID_VALUE_IN_ARRAY = 47; + const INVALID_E164 = 48; + const INVALID_BASE64 = 49; + const INVALID_NOT_REGEX = 50; + const INVALID_DIRECTORY = 101; + const INVALID_FILE = 102; + const INVALID_READABLE = 103; + const INVALID_WRITEABLE = 104; + const INVALID_CLASS = 105; + const INVALID_INTERFACE = 106; + const INVALID_FILE_NOT_EXISTS = 107; + const INVALID_EMAIL = 201; + const INTERFACE_NOT_IMPLEMENTED = 202; + const INVALID_URL = 203; + const INVALID_NOT_INSTANCE_OF = 204; + const VALUE_NOT_EMPTY = 205; + const INVALID_JSON_STRING = 206; + const INVALID_OBJECT = 207; + const INVALID_METHOD = 208; + const INVALID_SCALAR = 209; + const INVALID_LESS = 210; + const INVALID_LESS_OR_EQUAL = 211; + const INVALID_GREATER = 212; + const INVALID_GREATER_OR_EQUAL = 213; + const INVALID_DATE = 214; + const INVALID_CALLABLE = 215; + const INVALID_KEY_NOT_EXISTS = 216; + const INVALID_SATISFY = 217; + const INVALID_IP = 218; + const INVALID_BETWEEN = 219; + const INVALID_BETWEEN_EXCLUSIVE = 220; + const INVALID_EXTENSION = 222; + const INVALID_CONSTANT = 221; + const INVALID_VERSION = 223; + const INVALID_PROPERTY = 224; + const INVALID_RESOURCE = 225; + const INVALID_COUNTABLE = 226; + const INVALID_MIN_COUNT = 227; + const INVALID_MAX_COUNT = 228; + const INVALID_STRING_NOT_CONTAINS = 229; + + /** + * Exception to throw when an assertion failed. + * + * @var string + */ + protected static $exceptionClass = InvalidArgumentException::class; + + /** + * Assert that two values are equal (using ==). + * + * @param mixed $value + * @param mixed $value2 + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function eq($value, $value2, $message = null, string $propertyPath = null): bool + { + if ($value != $value2) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" does not equal expected value "%s".'), + static::stringify($value), + static::stringify($value2) + ); + + throw static::createException($value, $message, static::INVALID_EQ, $propertyPath, ['expected' => $value2]); + } + + return true; + } + + /** + * Assert that the array contains the subset. + * + * @param mixed $value + * @param mixed $value2 + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function eqArraySubset($value, $value2, $message = null, string $propertyPath = null): bool + { + static::isArray($value, $message, $propertyPath); + static::isArray($value2, $message, $propertyPath); + + $patched = \array_replace_recursive($value, $value2); + static::eq($patched, $value, $message, $propertyPath); + + return true; + } + + /** + * Assert that two values are the same (using ===). + * + * @param mixed $value + * @param mixed $value2 + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function same($value, $value2, $message = null, string $propertyPath = null): bool + { + if ($value !== $value2) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not the same as expected value "%s".'), + static::stringify($value), + static::stringify($value2) + ); + + throw static::createException($value, $message, static::INVALID_SAME, $propertyPath, ['expected' => $value2]); + } + + return true; + } + + /** + * Assert that two values are not equal (using ==). + * + * @param mixed $value1 + * @param mixed $value2 + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notEq($value1, $value2, $message = null, string $propertyPath = null): bool + { + if ($value1 == $value2) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" was not expected to be equal to value "%s".'), + static::stringify($value1), + static::stringify($value2) + ); + throw static::createException($value1, $message, static::INVALID_NOT_EQ, $propertyPath, ['expected' => $value2]); + } + + return true; + } + + /** + * Assert that two values are not the same (using ===). + * + * @param mixed $value1 + * @param mixed $value2 + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notSame($value1, $value2, $message = null, string $propertyPath = null): bool + { + if ($value1 === $value2) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" was not expected to be the same as value "%s".'), + static::stringify($value1), + static::stringify($value2) + ); + throw static::createException($value1, $message, static::INVALID_NOT_SAME, $propertyPath, ['expected' => $value2]); + } + + return true; + } + + /** + * Assert that value is not in array of choices. + * + * @param mixed $value + * @param array $choices + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notInArray($value, array $choices, $message = null, string $propertyPath = null): bool + { + if (true === \in_array($value, $choices)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" was not expected to be an element of the values: %s'), + static::stringify($value), + static::stringify($choices) + ); + throw static::createException($value, $message, static::INVALID_VALUE_IN_ARRAY, $propertyPath, ['choices' => $choices]); + } + + return true; + } + + /** + * Assert that value is a php integer. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function integer($value, $message = null, string $propertyPath = null): bool + { + if (!\is_int($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not an integer.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_INTEGER, $propertyPath); + } + + return true; + } + + /** + * Assert that value is a php float. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function float($value, $message = null, string $propertyPath = null): bool + { + if (!\is_float($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not a float.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_FLOAT, $propertyPath); + } + + return true; + } + + /** + * Validates if an integer or integerish is a digit. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function digit($value, $message = null, string $propertyPath = null): bool + { + if (!\ctype_digit((string)$value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not a digit.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_DIGIT, $propertyPath); + } + + return true; + } + + /** + * Assert that value is a php integer'ish. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function integerish($value, $message = null, string $propertyPath = null): bool + { + if ( + \is_resource($value) || + \is_object($value) || + \is_bool($value) || + \is_null($value) || + \is_array($value) || + (\is_string($value) && '' == $value) || + ( + \strval(\intval($value)) !== \strval($value) && + \strval(\intval($value)) !== \strval(\ltrim($value, '0')) && + '' !== \strval(\intval($value)) && + '' !== \strval(\ltrim($value, '0')) + ) + ) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not an integer or a number castable to integer.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_INTEGERISH, $propertyPath); + } + + return true; + } + + /** + * Assert that value is php boolean. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function boolean($value, $message = null, string $propertyPath = null): bool + { + if (!\is_bool($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not a boolean.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_BOOLEAN, $propertyPath); + } + + return true; + } + + /** + * Assert that value is a PHP scalar. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function scalar($value, $message = null, string $propertyPath = null): bool + { + if (!\is_scalar($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not a scalar.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_SCALAR, $propertyPath); + } + + return true; + } + + /** + * Assert that value is not empty. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notEmpty($value, $message = null, string $propertyPath = null): bool + { + if (empty($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is empty, but non empty value was expected.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::VALUE_EMPTY, $propertyPath); + } + + return true; + } + + /** + * Assert that value is empty. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function noContent($value, $message = null, string $propertyPath = null): bool + { + if (!empty($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not empty, but empty value was expected.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::VALUE_NOT_EMPTY, $propertyPath); + } + + return true; + } + + /** + * Assert that value is null. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + */ + public static function null($value, $message = null, string $propertyPath = null): bool + { + if (null !== $value) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not null, but null value was expected.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::VALUE_NOT_NULL, $propertyPath); + } + + return true; + } + + /** + * Assert that value is not null. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notNull($value, $message = null, string $propertyPath = null): bool + { + if (null === $value) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is null, but non null value was expected.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::VALUE_NULL, $propertyPath); + } + + return true; + } + + /** + * Assert that value is a string. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function string($value, $message = null, string $propertyPath = null) + { + if (!\is_string($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" expected to be string, type %s given.'), + static::stringify($value), + \gettype($value) + ); + + throw static::createException($value, $message, static::INVALID_STRING, $propertyPath); + } + + return true; + } + + /** + * Assert that value matches a regex. + * + * @param mixed $value + * @param string $pattern + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function regex($value, $pattern, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + + if (!\preg_match($pattern, $value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" does not match expression.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_REGEX, $propertyPath, ['pattern' => $pattern]); + } + + return true; + } + + /** + * Assert that value does not match a regex. + * + * @param mixed $value + * @param string $pattern + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notRegex($value, $pattern, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + + if (\preg_match($pattern, $value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" matches expression.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_NOT_REGEX, $propertyPath, ['pattern' => $pattern]); + } + + return true; + } + + /** + * Assert that string has a given length. + * + * @param mixed $value + * @param int $length + * @param string|callable|null $message + * @param string|null $propertyPath + * @param string $encoding + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function length($value, $length, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool + { + static::string($value, $message, $propertyPath); + + if (\mb_strlen($value, $encoding) !== $length) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" has to be %d exactly characters long, but length is %d.'), + static::stringify($value), + $length, + \mb_strlen($value, $encoding) + ); + + throw static::createException($value, $message, static::INVALID_LENGTH, $propertyPath, ['length' => $length, 'encoding' => $encoding]); + } + + return true; + } + + /** + * Assert that a string is at least $minLength chars long. + * + * @param mixed $value + * @param int $minLength + * @param string|callable|null $message + * @param string|null $propertyPath + * @param string $encoding + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function minLength($value, $minLength, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool + { + static::string($value, $message, $propertyPath); + + if (\mb_strlen($value, $encoding) < $minLength) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is too short, it should have at least %d characters, but only has %d characters.'), + static::stringify($value), + $minLength, + \mb_strlen($value, $encoding) + ); + + throw static::createException($value, $message, static::INVALID_MIN_LENGTH, $propertyPath, ['min_length' => $minLength, 'encoding' => $encoding]); + } + + return true; + } + + /** + * Assert that string value is not longer than $maxLength chars. + * + * @param mixed $value + * @param int $maxLength + * @param string|callable|null $message + * @param string|null $propertyPath + * @param string $encoding + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function maxLength($value, $maxLength, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool + { + static::string($value, $message, $propertyPath); + + if (\mb_strlen($value, $encoding) > $maxLength) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is too long, it should have no more than %d characters, but has %d characters.'), + static::stringify($value), + $maxLength, + \mb_strlen($value, $encoding) + ); + + throw static::createException($value, $message, static::INVALID_MAX_LENGTH, $propertyPath, ['max_length' => $maxLength, 'encoding' => $encoding]); + } + + return true; + } + + /** + * Assert that string length is between min and max lengths. + * + * @param mixed $value + * @param int $minLength + * @param int $maxLength + * @param string|callable|null $message + * @param string|null $propertyPath + * @param string $encoding + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function betweenLength($value, $minLength, $maxLength, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool + { + static::string($value, $message, $propertyPath); + static::minLength($value, $minLength, $message, $propertyPath, $encoding); + static::maxLength($value, $maxLength, $message, $propertyPath, $encoding); + + return true; + } + + /** + * Assert that string starts with a sequence of chars. + * + * @param mixed $string + * @param string $needle + * @param string|callable|null $message + * @param string|null $propertyPath + * @param string $encoding + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function startsWith($string, $needle, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool + { + static::string($string, $message, $propertyPath); + + if (0 !== \mb_strpos($string, $needle, null, $encoding)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" does not start with "%s".'), + static::stringify($string), + static::stringify($needle) + ); + + throw static::createException($string, $message, static::INVALID_STRING_START, $propertyPath, ['needle' => $needle, 'encoding' => $encoding]); + } + + return true; + } + + /** + * Assert that string ends with a sequence of chars. + * + * @param mixed $string + * @param string $needle + * @param string|callable|null $message + * @param string|null $propertyPath + * @param string $encoding + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function endsWith($string, $needle, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool + { + static::string($string, $message, $propertyPath); + + $stringPosition = \mb_strlen($string, $encoding) - \mb_strlen($needle, $encoding); + + if (\mb_strripos($string, $needle, null, $encoding) !== $stringPosition) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" does not end with "%s".'), + static::stringify($string), + static::stringify($needle) + ); + + throw static::createException($string, $message, static::INVALID_STRING_END, $propertyPath, ['needle' => $needle, 'encoding' => $encoding]); + } + + return true; + } + + /** + * Assert that string contains a sequence of chars. + * + * @param mixed $string + * @param string $needle + * @param string|callable|null $message + * @param string|null $propertyPath + * @param string $encoding + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function contains($string, $needle, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool + { + static::string($string, $message, $propertyPath); + + if (false === \mb_strpos($string, $needle, null, $encoding)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" does not contain "%s".'), + static::stringify($string), + static::stringify($needle) + ); + + throw static::createException($string, $message, static::INVALID_STRING_CONTAINS, $propertyPath, ['needle' => $needle, 'encoding' => $encoding]); + } + + return true; + } + + /** + * Assert that string does not contains a sequence of chars. + * + * @param mixed $string + * @param string $needle + * @param string|callable|null $message + * @param string|null $propertyPath + * @param string $encoding + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notContains($string, $needle, $message = null, string $propertyPath = null, $encoding = 'utf8'): bool + { + static::string($string, $message, $propertyPath); + + if (false !== \mb_strpos($string, $needle, null, $encoding)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" contains "%s".'), + static::stringify($string), + static::stringify($needle) + ); + + throw static::createException($string, $message, static::INVALID_STRING_NOT_CONTAINS, $propertyPath, ['needle' => $needle, 'encoding' => $encoding]); + } + + return true; + } + + /** + * Assert that value is in array of choices. + * + * @param mixed $value + * @param array $choices + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function choice($value, array $choices, $message = null, string $propertyPath = null): bool + { + if (!\in_array($value, $choices, true)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not an element of the valid values: %s'), + static::stringify($value), + \implode(', ', \array_map([\get_called_class(), 'stringify'], $choices)) + ); + + throw static::createException($value, $message, static::INVALID_CHOICE, $propertyPath, ['choices' => $choices]); + } + + return true; + } + + /** + * Assert that value is in array of choices. + * + * This is an alias of {@see choice()}. + * + * @param mixed $value + * @param array $choices + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function inArray($value, array $choices, $message = null, string $propertyPath = null): bool + { + return static::choice($value, $choices, $message, $propertyPath); + } + + /** + * Assert that value is numeric. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function numeric($value, $message = null, string $propertyPath = null): bool + { + if (!\is_numeric($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not numeric.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_NUMERIC, $propertyPath); + } + + return true; + } + + /** + * Assert that value is a resource. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + */ + public static function isResource($value, $message = null, string $propertyPath = null): bool + { + if (!\is_resource($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not a resource.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_RESOURCE, $propertyPath); + } + + return true; + } + + /** + * Assert that value is an array. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function isArray($value, $message = null, string $propertyPath = null): bool + { + if (!\is_array($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not an array.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_ARRAY, $propertyPath); + } + + return true; + } + + /** + * Assert that value is an array or a traversable object. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function isTraversable($value, $message = null, string $propertyPath = null): bool + { + if (!\is_array($value) && !$value instanceof Traversable) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not an array and does not implement Traversable.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_TRAVERSABLE, $propertyPath); + } + + return true; + } + + /** + * Assert that value is an array or an array-accessible object. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function isArrayAccessible($value, $message = null, string $propertyPath = null): bool + { + if (!\is_array($value) && !$value instanceof ArrayAccess) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not an array and does not implement ArrayAccess.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_ARRAY_ACCESSIBLE, $propertyPath); + } + + return true; + } + + /** + * Assert that value is countable. + * + * @param array|Countable|ResourceBundle|SimpleXMLElement $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function isCountable($value, $message = null, string $propertyPath = null): bool + { + if (\function_exists('is_countable')) { + $assert = \is_countable($value); + } else { + $assert = \is_array($value) || $value instanceof Countable || $value instanceof ResourceBundle || $value instanceof SimpleXMLElement; + } + + if (!$assert) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not an array and does not implement Countable.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_COUNTABLE, $propertyPath); + } + + return true; + } + + /** + * Assert that key exists in an array. + * + * @param mixed $value + * @param string|int $key + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function keyExists($value, $key, $message = null, string $propertyPath = null): bool + { + static::isArray($value, $message, $propertyPath); + + if (!\array_key_exists($key, $value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Array does not contain an element with key "%s"'), + static::stringify($key) + ); + + throw static::createException($value, $message, static::INVALID_KEY_EXISTS, $propertyPath, ['key' => $key]); + } + + return true; + } + + /** + * Assert that key does not exist in an array. + * + * @param mixed $value + * @param string|int $key + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function keyNotExists($value, $key, $message = null, string $propertyPath = null): bool + { + static::isArray($value, $message, $propertyPath); + + if (\array_key_exists($key, $value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Array contains an element with key "%s"'), + static::stringify($key) + ); + + throw static::createException($value, $message, static::INVALID_KEY_NOT_EXISTS, $propertyPath, ['key' => $key]); + } + + return true; + } + + /** + * Assert that key exists in an array/array-accessible object using isset(). + * + * @param mixed $value + * @param string|int $key + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function keyIsset($value, $key, $message = null, string $propertyPath = null): bool + { + static::isArrayAccessible($value, $message, $propertyPath); + + if (!isset($value[$key])) { + $message = \sprintf( + static::generateMessage($message ?: 'The element with key "%s" was not found'), + static::stringify($key) + ); + + throw static::createException($value, $message, static::INVALID_KEY_ISSET, $propertyPath, ['key' => $key]); + } + + return true; + } + + /** + * Assert that key exists in an array/array-accessible object and its value is not empty. + * + * @param mixed $value + * @param string|int $key + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notEmptyKey($value, $key, $message = null, string $propertyPath = null): bool + { + static::keyIsset($value, $key, $message, $propertyPath); + static::notEmpty($value[$key], $message, $propertyPath); + + return true; + } + + /** + * Assert that value is not blank. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notBlank($value, $message = null, string $propertyPath = null): bool + { + if (false === $value || (empty($value) && '0' != $value) || (\is_string($value) && '' === \trim($value))) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is blank, but was expected to contain a value.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_NOT_BLANK, $propertyPath); + } + + return true; + } + + /** + * Assert that value is instance of given class-name. + * + * @param mixed $value + * @param string $className + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function isInstanceOf($value, $className, $message = null, string $propertyPath = null): bool + { + if (!($value instanceof $className)) { + $message = \sprintf( + static::generateMessage($message ?: 'Class "%s" was expected to be instanceof of "%s" but is not.'), + static::stringify($value), + $className + ); + + throw static::createException($value, $message, static::INVALID_INSTANCE_OF, $propertyPath, ['class' => $className]); + } + + return true; + } + + /** + * Assert that value is not instance of given class-name. + * + * @param mixed $value + * @param string $className + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function notIsInstanceOf($value, $className, $message = null, string $propertyPath = null): bool + { + if ($value instanceof $className) { + $message = \sprintf( + static::generateMessage($message ?: 'Class "%s" was not expected to be instanceof of "%s".'), + static::stringify($value), + $className + ); + + throw static::createException($value, $message, static::INVALID_NOT_INSTANCE_OF, $propertyPath, ['class' => $className]); + } + + return true; + } + + /** + * Assert that value is subclass of given class-name. + * + * @param mixed $value + * @param string $className + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function subclassOf($value, $className, $message = null, string $propertyPath = null): bool + { + if (!\is_subclass_of($value, $className)) { + $message = \sprintf( + static::generateMessage($message ?: 'Class "%s" was expected to be subclass of "%s".'), + static::stringify($value), + $className + ); + + throw static::createException($value, $message, static::INVALID_SUBCLASS_OF, $propertyPath, ['class' => $className]); + } + + return true; + } + + /** + * Assert that value is in range of numbers. + * + * @param mixed $value + * @param mixed $minValue + * @param mixed $maxValue + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function range($value, $minValue, $maxValue, $message = null, string $propertyPath = null): bool + { + static::numeric($value, $message, $propertyPath); + + if ($value < $minValue || $value > $maxValue) { + $message = \sprintf( + static::generateMessage($message ?: 'Number "%s" was expected to be at least "%d" and at most "%d".'), + static::stringify($value), + static::stringify($minValue), + static::stringify($maxValue) + ); + + throw static::createException($value, $message, static::INVALID_RANGE, $propertyPath, ['min' => $minValue, 'max' => $maxValue]); + } + + return true; + } + + /** + * Assert that a value is at least as big as a given limit. + * + * @param mixed $value + * @param mixed $minValue + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function min($value, $minValue, $message = null, string $propertyPath = null): bool + { + static::numeric($value, $message, $propertyPath); + + if ($value < $minValue) { + $message = \sprintf( + static::generateMessage($message ?: 'Number "%s" was expected to be at least "%s".'), + static::stringify($value), + static::stringify($minValue) + ); + + throw static::createException($value, $message, static::INVALID_MIN, $propertyPath, ['min' => $minValue]); + } + + return true; + } + + /** + * Assert that a number is smaller as a given limit. + * + * @param mixed $value + * @param mixed $maxValue + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function max($value, $maxValue, $message = null, string $propertyPath = null): bool + { + static::numeric($value, $message, $propertyPath); + + if ($value > $maxValue) { + $message = \sprintf( + static::generateMessage($message ?: 'Number "%s" was expected to be at most "%s".'), + static::stringify($value), + static::stringify($maxValue) + ); + + throw static::createException($value, $message, static::INVALID_MAX, $propertyPath, ['max' => $maxValue]); + } + + return true; + } + + /** + * Assert that a file exists. + * + * @param string $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function file($value, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + static::notEmpty($value, $message, $propertyPath); + + if (!\is_file($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'File "%s" was expected to exist.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_FILE, $propertyPath); + } + + return true; + } + + /** + * Assert that a directory exists. + * + * @param string $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function directory($value, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + + if (!\is_dir($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Path "%s" was expected to be a directory.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_DIRECTORY, $propertyPath); + } + + return true; + } + + /** + * Assert that the value is something readable. + * + * @param string $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function readable($value, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + + if (!\is_readable($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Path "%s" was expected to be readable.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_READABLE, $propertyPath); + } + + return true; + } + + /** + * Assert that the value is something writeable. + * + * @param string $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function writeable($value, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + + if (!\is_writable($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Path "%s" was expected to be writeable.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_WRITEABLE, $propertyPath); + } + + return true; + } + + /** + * Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL). + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function email($value, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + + if (!\filter_var($value, FILTER_VALIDATE_EMAIL)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" was expected to be a valid e-mail address.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_EMAIL, $propertyPath); + } + + return true; + } + + /** + * Assert that value is an URL. + * + * This code snipped was taken from the Symfony project and modified to the special demands of this method. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + * + * @see https://github.com/symfony/Validator/blob/master/Constraints/UrlValidator.php + * @see https://github.com/symfony/Validator/blob/master/Constraints/Url.php + */ + public static function url($value, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + + $protocols = ['http', 'https']; + + $pattern = '~^ + (%s):// # protocol + (([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth + ( + ([\pL\pN\pS\-\.])+(\.?([\pL\pN]|xn\-\-[\pL\pN-]+)+\.?) # a domain name + | # or + \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address + | # or + \[ + (?:(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-f]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,1}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,2}(?:(?:[0-9a-f]{1,4})))?::(?:(?:(?:[0-9a-f]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,3}(?:(?:[0-9a-f]{1,4})))?::(?:(?:[0-9a-f]{1,4})):)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,4}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-f]{1,4})):(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,5}(?:(?:[0-9a-f]{1,4})))?::)(?:(?:[0-9a-f]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-f]{1,4})):){0,6}(?:(?:[0-9a-f]{1,4})))?::)))) + \] # an IPv6 address + ) + (:[0-9]+)? # a port (optional) + (?:/ (?:[\pL\pN\-._\~!$&\'()*+,;=:@]|%%[0-9A-Fa-f]{2})* )* # a path + (?:\? (?:[\pL\pN\-._\~!$&\'\[\]()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a query (optional) + (?:\# (?:[\pL\pN\-._\~!$&\'()*+,;=:@/?]|%%[0-9A-Fa-f]{2})* )? # a fragment (optional) + $~ixu'; + + $pattern = \sprintf($pattern, \implode('|', $protocols)); + + if (!\preg_match($pattern, $value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" was expected to be a valid URL starting with http or https'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_URL, $propertyPath); + } + + return true; + } + + /** + * Assert that value is alphanumeric. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function alnum($value, $message = null, string $propertyPath = null): bool + { + try { + static::regex($value, '(^([a-zA-Z]{1}[a-zA-Z0-9]*)$)', $message, $propertyPath); + } catch (Throwable $e) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not alphanumeric, starting with letters and containing only letters and numbers.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_ALNUM, $propertyPath); + } + + return true; + } + + /** + * Assert that the value is boolean True. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function true($value, $message = null, string $propertyPath = null): bool + { + if (true !== $value) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not TRUE.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_TRUE, $propertyPath); + } + + return true; + } + + /** + * Assert that the value is boolean False. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function false($value, $message = null, string $propertyPath = null): bool + { + if (false !== $value) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not FALSE.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_FALSE, $propertyPath); + } + + return true; + } + + /** + * Assert that the class exists. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function classExists($value, $message = null, string $propertyPath = null): bool + { + if (!\class_exists($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Class "%s" does not exist.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_CLASS, $propertyPath); + } + + return true; + } + + /** + * Assert that the interface exists. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function interfaceExists($value, $message = null, string $propertyPath = null): bool + { + if (!\interface_exists($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Interface "%s" does not exist.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_INTERFACE, $propertyPath); + } + + return true; + } + + /** + * Assert that the class implements the interface. + * + * @param mixed $class + * @param string $interfaceName + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function implementsInterface($class, $interfaceName, $message = null, string $propertyPath = null): bool + { + try { + $reflection = new ReflectionClass($class); + if (!$reflection->implementsInterface($interfaceName)) { + $message = \sprintf( + static::generateMessage($message ?: 'Class "%s" does not implement interface "%s".'), + static::stringify($class), + static::stringify($interfaceName) + ); + + throw static::createException($class, $message, static::INTERFACE_NOT_IMPLEMENTED, $propertyPath, ['interface' => $interfaceName]); + } + } catch (ReflectionException $e) { + $message = \sprintf( + static::generateMessage($message ?: 'Class "%s" failed reflection.'), + static::stringify($class) + ); + throw static::createException($class, $message, static::INTERFACE_NOT_IMPLEMENTED, $propertyPath, ['interface' => $interfaceName]); + } + + return true; + } + + /** + * Assert that the given string is a valid json string. + * + * NOTICE: + * Since this does a json_decode to determine its validity + * you probably should consider, when using the variable + * content afterwards, just to decode and check for yourself instead + * of using this assertion. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function isJsonString($value, $message = null, string $propertyPath = null): bool + { + if (null === \json_decode($value) && JSON_ERROR_NONE !== \json_last_error()) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not a valid JSON string.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_JSON_STRING, $propertyPath); + } + + return true; + } + + /** + * Assert that the given string is a valid UUID. + * + * Uses code from {@link https://github.com/ramsey/uuid} that is MIT licensed. + * + * @param string $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function uuid($value, $message = null, string $propertyPath = null): bool + { + $value = \str_replace(['urn:', 'uuid:', '{', '}'], '', $value); + + if ('00000000-0000-0000-0000-000000000000' === $value) { + return true; + } + + if (!\preg_match('/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/', $value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not a valid UUID.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_UUID, $propertyPath); + } + + return true; + } + + /** + * Assert that the given string is a valid E164 Phone Number. + * + * @see https://en.wikipedia.org/wiki/E.164 + * + * @param string $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function e164($value, $message = null, string $propertyPath = null): bool + { + if (!\preg_match('/^\+?[1-9]\d{1,14}$/', $value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" is not a valid E164.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_E164, $propertyPath); + } + + return true; + } + + /** + * Assert that the count of countable is equal to count. + * + * @param array|Countable|ResourceBundle|SimpleXMLElement $countable + * @param int $count + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function count($countable, $count, $message = null, string $propertyPath = null): bool + { + if ($count !== \count($countable)) { + $message = \sprintf( + static::generateMessage($message ?: 'List does not contain exactly %d elements (%d given).'), + static::stringify($count), + static::stringify(\count($countable)) + ); + + throw static::createException($countable, $message, static::INVALID_COUNT, $propertyPath, ['count' => $count]); + } + + return true; + } + + /** + * Assert that the countable have at least $count elements. + * + * @param array|Countable|ResourceBundle|SimpleXMLElement $countable + * @param int $count + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function minCount($countable, $count, $message = null, string $propertyPath = null): bool + { + if ($count > \count($countable)) { + $message = \sprintf( + static::generateMessage($message ?: 'List should have at least %d elements, but has %d elements.'), + static::stringify($count), + static::stringify(\count($countable)) + ); + + throw static::createException($countable, $message, static::INVALID_MIN_COUNT, $propertyPath, ['count' => $count]); + } + + return true; + } + + /** + * Assert that the countable have at most $count elements. + * + * @param array|Countable|ResourceBundle|SimpleXMLElement $countable + * @param int $count + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function maxCount($countable, $count, $message = null, string $propertyPath = null): bool + { + if ($count < \count($countable)) { + $message = \sprintf( + static::generateMessage($message ?: 'List should have at most %d elements, but has %d elements.'), + static::stringify($count), + static::stringify(\count($countable)) + ); + + throw static::createException($countable, $message, static::INVALID_MAX_COUNT, $propertyPath, ['count' => $count]); + } + + return true; + } + + /** + * static call handler to implement: + * - "null or assertion" delegation + * - "all" delegation. + * + * @param string $method + * @param array $args + * + * @return bool|mixed + * + * @throws AssertionFailedException + */ + public static function __callStatic($method, $args) + { + if (0 === \strpos($method, 'nullOr')) { + if (!\array_key_exists(0, $args)) { + throw new BadMethodCallException('Missing the first argument.'); + } + + if (null === $args[0]) { + return true; + } + + $method = \substr($method, 6); + + return \call_user_func_array([\get_called_class(), $method], $args); + } + + if (0 === \strpos($method, 'all')) { + if (!\array_key_exists(0, $args)) { + throw new BadMethodCallException('Missing the first argument.'); + } + + static::isTraversable($args[0]); + + $method = \substr($method, 3); + $values = \array_shift($args); + $calledClass = \get_called_class(); + + foreach ($values as $value) { + \call_user_func_array([$calledClass, $method], \array_merge([$value], $args)); + } + + return true; + } + + throw new BadMethodCallException('No assertion Assertion#'.$method.' exists.'); + } + + /** + * Determines if the values array has every choice as key and that this choice has content. + * + * @param array $values + * @param array $choices + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function choicesNotEmpty(array $values, array $choices, $message = null, string $propertyPath = null): bool + { + static::notEmpty($values, $message, $propertyPath); + + foreach ($choices as $choice) { + static::notEmptyKey($values, $choice, $message, $propertyPath); + } + + return true; + } + + /** + * Determines that the named method is defined in the provided object. + * + * @param string $value + * @param mixed $object + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function methodExists($value, $object, $message = null, string $propertyPath = null): bool + { + static::isObject($object, $message, $propertyPath); + + if (!\method_exists($object, $value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Expected "%s" does not exist in provided object.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_METHOD, $propertyPath, ['object' => \get_class($object)]); + } + + return true; + } + + /** + * Determines that the provided value is an object. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function isObject($value, $message = null, string $propertyPath = null): bool + { + if (!\is_object($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Provided "%s" is not a valid object.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_OBJECT, $propertyPath); + } + + return true; + } + + /** + * Determines if the value is less than given limit. + * + * @param mixed $value + * @param mixed $limit + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function lessThan($value, $limit, $message = null, string $propertyPath = null): bool + { + if ($value >= $limit) { + $message = \sprintf( + static::generateMessage($message ?: 'Provided "%s" is not less than "%s".'), + static::stringify($value), + static::stringify($limit) + ); + + throw static::createException($value, $message, static::INVALID_LESS, $propertyPath, ['limit' => $limit]); + } + + return true; + } + + /** + * Determines if the value is less or equal than given limit. + * + * @param mixed $value + * @param mixed $limit + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function lessOrEqualThan($value, $limit, $message = null, string $propertyPath = null): bool + { + if ($value > $limit) { + $message = \sprintf( + static::generateMessage($message ?: 'Provided "%s" is not less or equal than "%s".'), + static::stringify($value), + static::stringify($limit) + ); + + throw static::createException($value, $message, static::INVALID_LESS_OR_EQUAL, $propertyPath, ['limit' => $limit]); + } + + return true; + } + + /** + * Determines if the value is greater than given limit. + * + * @param mixed $value + * @param mixed $limit + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function greaterThan($value, $limit, $message = null, string $propertyPath = null): bool + { + if ($value <= $limit) { + $message = \sprintf( + static::generateMessage($message ?: 'Provided "%s" is not greater than "%s".'), + static::stringify($value), + static::stringify($limit) + ); + + throw static::createException($value, $message, static::INVALID_GREATER, $propertyPath, ['limit' => $limit]); + } + + return true; + } + + /** + * Determines if the value is greater or equal than given limit. + * + * @param mixed $value + * @param mixed $limit + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function greaterOrEqualThan($value, $limit, $message = null, string $propertyPath = null): bool + { + if ($value < $limit) { + $message = \sprintf( + static::generateMessage($message ?: 'Provided "%s" is not greater or equal than "%s".'), + static::stringify($value), + static::stringify($limit) + ); + + throw static::createException($value, $message, static::INVALID_GREATER_OR_EQUAL, $propertyPath, ['limit' => $limit]); + } + + return true; + } + + /** + * Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit. + * + * @param mixed $value + * @param mixed $lowerLimit + * @param mixed $upperLimit + * @param string|callable|null $message + * @param string $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function between($value, $lowerLimit, $upperLimit, $message = null, string $propertyPath = null): bool + { + if ($lowerLimit > $value || $value > $upperLimit) { + $message = \sprintf( + static::generateMessage($message ?: 'Provided "%s" is neither greater than or equal to "%s" nor less than or equal to "%s".'), + static::stringify($value), + static::stringify($lowerLimit), + static::stringify($upperLimit) + ); + + throw static::createException($value, $message, static::INVALID_BETWEEN, $propertyPath, ['lower' => $lowerLimit, 'upper' => $upperLimit]); + } + + return true; + } + + /** + * Assert that a value is greater than a lower limit, and less than an upper limit. + * + * @param mixed $value + * @param mixed $lowerLimit + * @param mixed $upperLimit + * @param string|callable|null $message + * @param string $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function betweenExclusive($value, $lowerLimit, $upperLimit, $message = null, string $propertyPath = null): bool + { + if ($lowerLimit >= $value || $value >= $upperLimit) { + $message = \sprintf( + static::generateMessage($message ?: 'Provided "%s" is neither greater than "%s" nor less than "%s".'), + static::stringify($value), + static::stringify($lowerLimit), + static::stringify($upperLimit) + ); + + throw static::createException($value, $message, static::INVALID_BETWEEN_EXCLUSIVE, $propertyPath, ['lower' => $lowerLimit, 'upper' => $upperLimit]); + } + + return true; + } + + /** + * Assert that extension is loaded. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function extensionLoaded($value, $message = null, string $propertyPath = null): bool + { + if (!\extension_loaded($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Extension "%s" is required.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_EXTENSION, $propertyPath); + } + + return true; + } + + /** + * Assert that date is valid and corresponds to the given format. + * + * @param string $value + * @param string $format supports all of the options date(), except for the following: + * N, w, W, t, L, o, B, a, A, g, h, I, O, P, Z, c, r + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + * + * @see http://php.net/manual/function.date.php#refsect1-function.date-parameters + */ + public static function date($value, $format, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + static::string($format, $message, $propertyPath); + + $dateTime = DateTime::createFromFormat('!'.$format, $value); + + if (false === $dateTime || $value !== $dateTime->format($format)) { + $message = \sprintf( + static::generateMessage($message ?: 'Date "%s" is invalid or does not match format "%s".'), + static::stringify($value), + static::stringify($format) + ); + + throw static::createException($value, $message, static::INVALID_DATE, $propertyPath, ['format' => $format]); + } + + return true; + } + + /** + * Assert that the value is an object, or a class that exists. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function objectOrClass($value, $message = null, string $propertyPath = null): bool + { + if (!\is_object($value)) { + static::classExists($value, $message, $propertyPath); + } + + return true; + } + + /** + * Assert that the value is an object or class, and that the property exists. + * + * @param mixed $value + * @param string $property + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function propertyExists($value, $property, $message = null, string $propertyPath = null): bool + { + static::objectOrClass($value); + + if (!\property_exists($value, $property)) { + $message = \sprintf( + static::generateMessage($message ?: 'Class "%s" does not have property "%s".'), + static::stringify($value), + static::stringify($property) + ); + + throw static::createException($value, $message, static::INVALID_PROPERTY, $propertyPath, ['property' => $property]); + } + + return true; + } + + /** + * Assert that the value is an object or class, and that the properties all exist. + * + * @param mixed $value + * @param array $properties + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function propertiesExist($value, array $properties, $message = null, string $propertyPath = null): bool + { + static::objectOrClass($value); + static::allString($properties, $message, $propertyPath); + + $invalidProperties = []; + foreach ($properties as $property) { + if (!\property_exists($value, $property)) { + $invalidProperties[] = $property; + } + } + + if ($invalidProperties) { + $message = \sprintf( + static::generateMessage($message ?: 'Class "%s" does not have these properties: %s.'), + static::stringify($value), + static::stringify(\implode(', ', $invalidProperties)) + ); + + throw static::createException($value, $message, static::INVALID_PROPERTY, $propertyPath, ['properties' => $properties]); + } + + return true; + } + + /** + * Assert comparison of two versions. + * + * @param string $version1 + * @param string $operator + * @param string $version2 + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function version($version1, $operator, $version2, $message = null, string $propertyPath = null): bool + { + static::notEmpty($operator, 'versionCompare operator is required and cannot be empty.'); + + if (true !== \version_compare($version1, $version2, $operator)) { + $message = \sprintf( + static::generateMessage($message ?: 'Version "%s" is not "%s" version "%s".'), + static::stringify($version1), + static::stringify($operator), + static::stringify($version2) + ); + + throw static::createException($version1, $message, static::INVALID_VERSION, $propertyPath, ['operator' => $operator, 'version' => $version2]); + } + + return true; + } + + /** + * Assert on PHP version. + * + * @param string $operator + * @param mixed $version + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function phpVersion($operator, $version, $message = null, string $propertyPath = null): bool + { + static::defined('PHP_VERSION'); + + return static::version(PHP_VERSION, $operator, $version, $message, $propertyPath); + } + + /** + * Assert that extension is loaded and a specific version is installed. + * + * @param string $extension + * @param string $operator + * @param mixed $version + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function extensionVersion($extension, $operator, $version, $message = null, string $propertyPath = null): bool + { + static::extensionLoaded($extension, $message, $propertyPath); + + return static::version(\phpversion($extension), $operator, $version, $message, $propertyPath); + } + + /** + * Determines that the provided value is callable. + * + * @param mixed $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function isCallable($value, $message = null, string $propertyPath = null): bool + { + if (!\is_callable($value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Provided "%s" is not a callable.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_CALLABLE, $propertyPath); + } + + return true; + } + + /** + * Assert that the provided value is valid according to a callback. + * + * If the callback returns `false` the assertion will fail. + * + * @param mixed $value + * @param callable $callback + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function satisfy($value, $callback, $message = null, string $propertyPath = null): bool + { + static::isCallable($callback); + + if (false === \call_user_func($callback, $value)) { + $message = \sprintf( + static::generateMessage($message ?: 'Provided "%s" is invalid according to custom rule.'), + static::stringify($value) + ); + + throw static::createException($value, $message, static::INVALID_SATISFY, $propertyPath); + } + + return true; + } + + /** + * Assert that value is an IPv4 or IPv6 address + * (using input_filter/FILTER_VALIDATE_IP). + * + * @param string $value + * @param int|null $flag + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + * + * @see http://php.net/manual/filter.filters.flags.php + */ + public static function ip($value, $flag = null, $message = null, string $propertyPath = null): bool + { + static::string($value, $message, $propertyPath); + if (!\filter_var($value, FILTER_VALIDATE_IP, $flag)) { + $message = \sprintf( + static::generateMessage($message ?: 'Value "%s" was expected to be a valid IP address.'), + static::stringify($value) + ); + throw static::createException($value, $message, static::INVALID_IP, $propertyPath, ['flag' => $flag]); + } + + return true; + } + + /** + * Assert that value is an IPv4 address + * (using input_filter/FILTER_VALIDATE_IP). + * + * @param string $value + * @param int|null $flag + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + * + * @see http://php.net/manual/filter.filters.flags.php + */ + public static function ipv4($value, $flag = null, $message = null, string $propertyPath = null): bool + { + static::ip($value, $flag | FILTER_FLAG_IPV4, static::generateMessage($message ?: 'Value "%s" was expected to be a valid IPv4 address.'), $propertyPath); + + return true; + } + + /** + * Assert that value is an IPv6 address + * (using input_filter/FILTER_VALIDATE_IP). + * + * @param string $value + * @param int|null $flag + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + * + * @see http://php.net/manual/filter.filters.flags.php + */ + public static function ipv6($value, $flag = null, $message = null, string $propertyPath = null): bool + { + static::ip($value, $flag | FILTER_FLAG_IPV6, static::generateMessage($message ?: 'Value "%s" was expected to be a valid IPv6 address.'), $propertyPath); + + return true; + } + + /** + * Assert that a constant is defined. + * + * @param mixed $constant + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + */ + public static function defined($constant, $message = null, string $propertyPath = null): bool + { + if (!\defined($constant)) { + $message = \sprintf(static::generateMessage($message ?: 'Value "%s" expected to be a defined constant.'), $constant); + + throw static::createException($constant, $message, static::INVALID_CONSTANT, $propertyPath); + } + + return true; + } + + /** + * Assert that a constant is defined. + * + * @param string $value + * @param string|callable|null $message + * @param string|null $propertyPath + * + * @return bool + * + * @throws AssertionFailedException + */ + public static function base64($value, $message = null, string $propertyPath = null): bool + { + if (false === \base64_decode($value, true)) { + $message = \sprintf(static::generateMessage($message ?: 'Value "%s" is not a valid base64 string.'), $value); + + throw static::createException($value, $message, static::INVALID_BASE64, $propertyPath); + } + + return true; + } + + /** + * Helper method that handles building the assertion failure exceptions. + * They are returned from this method so that the stack trace still shows + * the assertions method. + * + * @param mixed $value + * @param string|callable|null $message + * @param int $code + * @param string|null $propertyPath + * @param array $constraints + * + * @return mixed + */ + protected static function createException($value, $message, $code, $propertyPath = null, array $constraints = []) + { + $exceptionClass = static::$exceptionClass; + + return new $exceptionClass($message, $code, $propertyPath, $value, $constraints); + } + + /** + * Make a string version of a value. + * + * @param mixed $value + * + * @return string + */ + protected static function stringify($value): string + { + $result = \gettype($value); + + if (\is_bool($value)) { + $result = $value ? '' : ''; + } elseif (\is_scalar($value)) { + $val = (string)$value; + + if (\mb_strlen($val) > 100) { + $val = \mb_substr($val, 0, 97).'...'; + } + + $result = $val; + } elseif (\is_array($value)) { + $result = ''; + } elseif (\is_object($value)) { + $result = \get_class($value); + } elseif (\is_resource($value)) { + $result = \get_resource_type($value); + } elseif (null === $value) { + $result = ''; + } + + return $result; + } + + /** + * Generate the message. + * + * @param string|callable|null $message + * + * @return string + */ + protected static function generateMessage($message): string + { + if (\is_callable($message)) { + $traces = \debug_backtrace(0); + + $parameters = []; + + try { + $reflection = new ReflectionClass($traces[1]['class']); + $method = $reflection->getMethod($traces[1]['function']); + foreach ($method->getParameters() as $index => $parameter) { + if ('message' !== $parameter->getName()) { + $parameters[$parameter->getName()] = \array_key_exists($index, $traces[1]['args']) + ? $traces[1]['args'][$index] + : $parameter->getDefaultValue(); + } + } + + $parameters['::assertion'] = \sprintf('%s%s%s', $traces[1]['class'], $traces[1]['type'], $traces[1]['function']); + + $message = \call_user_func_array($message, [$parameters]); + } // @codeCoverageIgnoreStart + catch (Throwable $exception) { + $message = \sprintf('Unable to generate message : %s', $exception->getMessage()); + } // @codeCoverageIgnoreEnd + } + + return (string)$message; + } +} diff --git a/vendor/beberlei/assert/lib/Assert/AssertionChain.php b/vendor/beberlei/assert/lib/Assert/AssertionChain.php new file mode 100644 index 000000000..dbb6e839b --- /dev/null +++ b/vendor/beberlei/assert/lib/Assert/AssertionChain.php @@ -0,0 +1,254 @@ + + * + * @method AssertionChain alnum(string|callable $message = null, string $propertyPath = null) Assert that value is alphanumeric. + * @method AssertionChain base64(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined. + * @method AssertionChain between(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit. + * @method AssertionChain betweenExclusive(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater than a lower limit, and less than an upper limit. + * @method AssertionChain betweenLength(int $minLength, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string length is between min and max lengths. + * @method AssertionChain boolean(string|callable $message = null, string $propertyPath = null) Assert that value is php boolean. + * @method AssertionChain choice(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. + * @method AssertionChain choicesNotEmpty(array $choices, string|callable $message = null, string $propertyPath = null) Determines if the values array has every choice as key and that this choice has content. + * @method AssertionChain classExists(string|callable $message = null, string $propertyPath = null) Assert that the class exists. + * @method AssertionChain contains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string contains a sequence of chars. + * @method AssertionChain count(int $count, string|callable $message = null, string $propertyPath = null) Assert that the count of countable is equal to count. + * @method AssertionChain date(string $format, string|callable $message = null, string $propertyPath = null) Assert that date is valid and corresponds to the given format. + * @method AssertionChain defined(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined. + * @method AssertionChain digit(string|callable $message = null, string $propertyPath = null) Validates if an integer or integerish is a digit. + * @method AssertionChain directory(string|callable $message = null, string $propertyPath = null) Assert that a directory exists. + * @method AssertionChain e164(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid E164 Phone Number. + * @method AssertionChain email(string|callable $message = null, string $propertyPath = null) Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL). + * @method AssertionChain endsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string ends with a sequence of chars. + * @method AssertionChain eq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are equal (using ==). + * @method AssertionChain eqArraySubset(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that the array contains the subset. + * @method AssertionChain extensionLoaded(string|callable $message = null, string $propertyPath = null) Assert that extension is loaded. + * @method AssertionChain extensionVersion(string $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded and a specific version is installed. + * @method AssertionChain false(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean False. + * @method AssertionChain file(string|callable $message = null, string $propertyPath = null) Assert that a file exists. + * @method AssertionChain float(string|callable $message = null, string $propertyPath = null) Assert that value is a php float. + * @method AssertionChain greaterOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater or equal than given limit. + * @method AssertionChain greaterThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater than given limit. + * @method AssertionChain implementsInterface(string $interfaceName, string|callable $message = null, string $propertyPath = null) Assert that the class implements the interface. + * @method AssertionChain inArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. This is an alias of Assertion::choice(). + * @method AssertionChain integer(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer. + * @method AssertionChain integerish(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer'ish. + * @method AssertionChain interfaceExists(string|callable $message = null, string $propertyPath = null) Assert that the interface exists. + * @method AssertionChain ip(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 or IPv6 address. + * @method AssertionChain ipv4(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 address. + * @method AssertionChain ipv6(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv6 address. + * @method AssertionChain isArray(string|callable $message = null, string $propertyPath = null) Assert that value is an array. + * @method AssertionChain isArrayAccessible(string|callable $message = null, string $propertyPath = null) Assert that value is an array or an array-accessible object. + * @method AssertionChain isCallable(string|callable $message = null, string $propertyPath = null) Determines that the provided value is callable. + * @method AssertionChain isCountable(string|callable $message = null, string $propertyPath = null) Assert that value is countable. + * @method AssertionChain isInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is instance of given class-name. + * @method AssertionChain isJsonString(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid json string. + * @method AssertionChain isObject(string|callable $message = null, string $propertyPath = null) Determines that the provided value is an object. + * @method AssertionChain isResource(string|callable $message = null, string $propertyPath = null) Assert that value is a resource. + * @method AssertionChain isTraversable(string|callable $message = null, string $propertyPath = null) Assert that value is an array or a traversable object. + * @method AssertionChain keyExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array. + * @method AssertionChain keyIsset(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object using isset(). + * @method AssertionChain keyNotExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key does not exist in an array. + * @method AssertionChain length(int $length, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string has a given length. + * @method AssertionChain lessOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less or equal than given limit. + * @method AssertionChain lessThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less than given limit. + * @method AssertionChain max(mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that a number is smaller as a given limit. + * @method AssertionChain maxCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at most $count elements. + * @method AssertionChain maxLength(int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string value is not longer than $maxLength chars. + * @method AssertionChain methodExists(mixed $object, string|callable $message = null, string $propertyPath = null) Determines that the named method is defined in the provided object. + * @method AssertionChain min(mixed $minValue, string|callable $message = null, string $propertyPath = null) Assert that a value is at least as big as a given limit. + * @method AssertionChain minCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at least $count elements. + * @method AssertionChain minLength(int $minLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that a string is at least $minLength chars long. + * @method AssertionChain noContent(string|callable $message = null, string $propertyPath = null) Assert that value is empty. + * @method AssertionChain notBlank(string|callable $message = null, string $propertyPath = null) Assert that value is not blank. + * @method AssertionChain notContains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string does not contains a sequence of chars. + * @method AssertionChain notEmpty(string|callable $message = null, string $propertyPath = null) Assert that value is not empty. + * @method AssertionChain notEmptyKey(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object and its value is not empty. + * @method AssertionChain notEq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not equal (using ==). + * @method AssertionChain notInArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is not in array of choices. + * @method AssertionChain notIsInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is not instance of given class-name. + * @method AssertionChain notNull(string|callable $message = null, string $propertyPath = null) Assert that value is not null. + * @method AssertionChain notRegex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value does not match a regex. + * @method AssertionChain notSame(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not the same (using ===). + * @method AssertionChain null(string|callable $message = null, string $propertyPath = null) Assert that value is null. + * @method AssertionChain numeric(string|callable $message = null, string $propertyPath = null) Assert that value is numeric. + * @method AssertionChain objectOrClass(string|callable $message = null, string $propertyPath = null) Assert that the value is an object, or a class that exists. + * @method AssertionChain phpVersion(mixed $version, string|callable $message = null, string $propertyPath = null) Assert on PHP version. + * @method AssertionChain propertiesExist(array $properties, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the properties all exist. + * @method AssertionChain propertyExists(string $property, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the property exists. + * @method AssertionChain range(mixed $minValue, mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that value is in range of numbers. + * @method AssertionChain readable(string|callable $message = null, string $propertyPath = null) Assert that the value is something readable. + * @method AssertionChain regex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value matches a regex. + * @method AssertionChain same(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are the same (using ===). + * @method AssertionChain satisfy(callable $callback, string|callable $message = null, string $propertyPath = null) Assert that the provided value is valid according to a callback. + * @method AssertionChain scalar(string|callable $message = null, string $propertyPath = null) Assert that value is a PHP scalar. + * @method AssertionChain startsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string starts with a sequence of chars. + * @method AssertionChain string(string|callable $message = null, string $propertyPath = null) Assert that value is a string. + * @method AssertionChain subclassOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is subclass of given class-name. + * @method AssertionChain true(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean True. + * @method AssertionChain url(string|callable $message = null, string $propertyPath = null) Assert that value is an URL. + * @method AssertionChain uuid(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid UUID. + * @method AssertionChain version(string $operator, string $version2, string|callable $message = null, string $propertyPath = null) Assert comparison of two versions. + * @method AssertionChain writeable(string|callable $message = null, string $propertyPath = null) Assert that the value is something writeable. + */ +class AssertionChain +{ + /** + * @var mixed + */ + private $value; + + /** + * @var string|callable|null + */ + private $defaultMessage; + + /** + * @var string|null + */ + private $defaultPropertyPath; + + /** + * Return each assertion as always valid. + * + * @var bool + */ + private $alwaysValid = false; + + /** + * Perform assertion on every element of array or traversable. + * + * @var bool + */ + private $all = false; + + /** @var string|Assertion Class to use for assertion calls */ + private $assertionClassName = 'Assert\Assertion'; + + /** + * AssertionChain constructor. + * + * @param mixed $value + * @param string|callable|null $defaultMessage + * @param string|null $defaultPropertyPath + */ + public function __construct($value, $defaultMessage = null, string $defaultPropertyPath = null) + { + $this->value = $value; + $this->defaultMessage = $defaultMessage; + $this->defaultPropertyPath = $defaultPropertyPath; + } + + /** + * Call assertion on the current value in the chain. + * + * @param string $methodName + * @param array $args + * + * @return AssertionChain + */ + public function __call($methodName, $args): AssertionChain + { + if (true === $this->alwaysValid) { + return $this; + } + + if (!\method_exists($this->assertionClassName, $methodName)) { + throw new \RuntimeException("Assertion '".$methodName."' does not exist."); + } + + $reflClass = new ReflectionClass($this->assertionClassName); + $method = $reflClass->getMethod($methodName); + + \array_unshift($args, $this->value); + $params = $method->getParameters(); + + foreach ($params as $idx => $param) { + if (isset($args[$idx])) { + continue; + } + + if ('message' == $param->getName()) { + $args[$idx] = $this->defaultMessage; + } + + if ('propertyPath' == $param->getName()) { + $args[$idx] = $this->defaultPropertyPath; + } + } + + if ($this->all) { + $methodName = 'all'.$methodName; + } + + \call_user_func_array([$this->assertionClassName, $methodName], $args); + + return $this; + } + + /** + * Switch chain into validation mode for an array of values. + * + * @return AssertionChain + */ + public function all(): AssertionChain + { + $this->all = true; + + return $this; + } + + /** + * Switch chain into mode allowing nulls, ignoring further assertions. + * + * @return AssertionChain + */ + public function nullOr(): AssertionChain + { + if (null === $this->value) { + $this->alwaysValid = true; + } + + return $this; + } + + /** + * @param string $className + * + * @return $this + */ + public function setAssertionClassName($className): AssertionChain + { + if (!\is_string($className)) { + throw new LogicException('Exception class name must be passed as a string'); + } + + if (Assertion::class !== $className && !\is_subclass_of($className, Assertion::class)) { + throw new LogicException($className.' is not (a subclass of) '.Assertion::class); + } + + $this->assertionClassName = $className; + + return $this; + } +} diff --git a/vendor/beberlei/assert/lib/Assert/AssertionFailedException.php b/vendor/beberlei/assert/lib/Assert/AssertionFailedException.php new file mode 100644 index 000000000..c18483884 --- /dev/null +++ b/vendor/beberlei/assert/lib/Assert/AssertionFailedException.php @@ -0,0 +1,35 @@ +propertyPath = $propertyPath; + $this->value = $value; + $this->constraints = $constraints; + } + + /** + * User controlled way to define a sub-property causing + * the failure of a currently asserted objects. + * + * Useful to transport information about the nature of the error + * back to higher layers. + * + * @return string|null + */ + public function getPropertyPath() + { + return $this->propertyPath; + } + + /** + * Get the value that caused the assertion to fail. + * + * @return mixed + */ + public function getValue() + { + return $this->value; + } + + /** + * Get the constraints that applied to the failed assertion. + * + * @return array + */ + public function getConstraints(): array + { + return $this->constraints; + } +} diff --git a/vendor/beberlei/assert/lib/Assert/LazyAssertion.php b/vendor/beberlei/assert/lib/Assert/LazyAssertion.php new file mode 100644 index 000000000..6ccd64236 --- /dev/null +++ b/vendor/beberlei/assert/lib/Assert/LazyAssertion.php @@ -0,0 +1,230 @@ + + * + * @method LazyAssertion alnum(string|callable $message = null, string $propertyPath = null) Assert that value is alphanumeric. + * @method LazyAssertion base64(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined. + * @method LazyAssertion between(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit. + * @method LazyAssertion betweenExclusive(mixed $lowerLimit, mixed $upperLimit, string|callable $message = null, string $propertyPath = null) Assert that a value is greater than a lower limit, and less than an upper limit. + * @method LazyAssertion betweenLength(int $minLength, int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string length is between min and max lengths. + * @method LazyAssertion boolean(string|callable $message = null, string $propertyPath = null) Assert that value is php boolean. + * @method LazyAssertion choice(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. + * @method LazyAssertion choicesNotEmpty(array $choices, string|callable $message = null, string $propertyPath = null) Determines if the values array has every choice as key and that this choice has content. + * @method LazyAssertion classExists(string|callable $message = null, string $propertyPath = null) Assert that the class exists. + * @method LazyAssertion contains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string contains a sequence of chars. + * @method LazyAssertion count(int $count, string|callable $message = null, string $propertyPath = null) Assert that the count of countable is equal to count. + * @method LazyAssertion date(string $format, string|callable $message = null, string $propertyPath = null) Assert that date is valid and corresponds to the given format. + * @method LazyAssertion defined(string|callable $message = null, string $propertyPath = null) Assert that a constant is defined. + * @method LazyAssertion digit(string|callable $message = null, string $propertyPath = null) Validates if an integer or integerish is a digit. + * @method LazyAssertion directory(string|callable $message = null, string $propertyPath = null) Assert that a directory exists. + * @method LazyAssertion e164(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid E164 Phone Number. + * @method LazyAssertion email(string|callable $message = null, string $propertyPath = null) Assert that value is an email address (using input_filter/FILTER_VALIDATE_EMAIL). + * @method LazyAssertion endsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string ends with a sequence of chars. + * @method LazyAssertion eq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are equal (using ==). + * @method LazyAssertion eqArraySubset(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that the array contains the subset. + * @method LazyAssertion extensionLoaded(string|callable $message = null, string $propertyPath = null) Assert that extension is loaded. + * @method LazyAssertion extensionVersion(string $operator, mixed $version, string|callable $message = null, string $propertyPath = null) Assert that extension is loaded and a specific version is installed. + * @method LazyAssertion false(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean False. + * @method LazyAssertion file(string|callable $message = null, string $propertyPath = null) Assert that a file exists. + * @method LazyAssertion float(string|callable $message = null, string $propertyPath = null) Assert that value is a php float. + * @method LazyAssertion greaterOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater or equal than given limit. + * @method LazyAssertion greaterThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is greater than given limit. + * @method LazyAssertion implementsInterface(string $interfaceName, string|callable $message = null, string $propertyPath = null) Assert that the class implements the interface. + * @method LazyAssertion inArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is in array of choices. This is an alias of Assertion::choice(). + * @method LazyAssertion integer(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer. + * @method LazyAssertion integerish(string|callable $message = null, string $propertyPath = null) Assert that value is a php integer'ish. + * @method LazyAssertion interfaceExists(string|callable $message = null, string $propertyPath = null) Assert that the interface exists. + * @method LazyAssertion ip(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 or IPv6 address. + * @method LazyAssertion ipv4(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv4 address. + * @method LazyAssertion ipv6(int $flag = null, string|callable $message = null, string $propertyPath = null) Assert that value is an IPv6 address. + * @method LazyAssertion isArray(string|callable $message = null, string $propertyPath = null) Assert that value is an array. + * @method LazyAssertion isArrayAccessible(string|callable $message = null, string $propertyPath = null) Assert that value is an array or an array-accessible object. + * @method LazyAssertion isCallable(string|callable $message = null, string $propertyPath = null) Determines that the provided value is callable. + * @method LazyAssertion isCountable(string|callable $message = null, string $propertyPath = null) Assert that value is countable. + * @method LazyAssertion isInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is instance of given class-name. + * @method LazyAssertion isJsonString(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid json string. + * @method LazyAssertion isObject(string|callable $message = null, string $propertyPath = null) Determines that the provided value is an object. + * @method LazyAssertion isResource(string|callable $message = null, string $propertyPath = null) Assert that value is a resource. + * @method LazyAssertion isTraversable(string|callable $message = null, string $propertyPath = null) Assert that value is an array or a traversable object. + * @method LazyAssertion keyExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array. + * @method LazyAssertion keyIsset(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object using isset(). + * @method LazyAssertion keyNotExists(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key does not exist in an array. + * @method LazyAssertion length(int $length, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string has a given length. + * @method LazyAssertion lessOrEqualThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less or equal than given limit. + * @method LazyAssertion lessThan(mixed $limit, string|callable $message = null, string $propertyPath = null) Determines if the value is less than given limit. + * @method LazyAssertion max(mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that a number is smaller as a given limit. + * @method LazyAssertion maxCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at most $count elements. + * @method LazyAssertion maxLength(int $maxLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string value is not longer than $maxLength chars. + * @method LazyAssertion methodExists(mixed $object, string|callable $message = null, string $propertyPath = null) Determines that the named method is defined in the provided object. + * @method LazyAssertion min(mixed $minValue, string|callable $message = null, string $propertyPath = null) Assert that a value is at least as big as a given limit. + * @method LazyAssertion minCount(int $count, string|callable $message = null, string $propertyPath = null) Assert that the countable have at least $count elements. + * @method LazyAssertion minLength(int $minLength, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that a string is at least $minLength chars long. + * @method LazyAssertion noContent(string|callable $message = null, string $propertyPath = null) Assert that value is empty. + * @method LazyAssertion notBlank(string|callable $message = null, string $propertyPath = null) Assert that value is not blank. + * @method LazyAssertion notContains(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string does not contains a sequence of chars. + * @method LazyAssertion notEmpty(string|callable $message = null, string $propertyPath = null) Assert that value is not empty. + * @method LazyAssertion notEmptyKey(string|int $key, string|callable $message = null, string $propertyPath = null) Assert that key exists in an array/array-accessible object and its value is not empty. + * @method LazyAssertion notEq(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not equal (using ==). + * @method LazyAssertion notInArray(array $choices, string|callable $message = null, string $propertyPath = null) Assert that value is not in array of choices. + * @method LazyAssertion notIsInstanceOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is not instance of given class-name. + * @method LazyAssertion notNull(string|callable $message = null, string $propertyPath = null) Assert that value is not null. + * @method LazyAssertion notRegex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value does not match a regex. + * @method LazyAssertion notSame(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are not the same (using ===). + * @method LazyAssertion null(string|callable $message = null, string $propertyPath = null) Assert that value is null. + * @method LazyAssertion numeric(string|callable $message = null, string $propertyPath = null) Assert that value is numeric. + * @method LazyAssertion objectOrClass(string|callable $message = null, string $propertyPath = null) Assert that the value is an object, or a class that exists. + * @method LazyAssertion phpVersion(mixed $version, string|callable $message = null, string $propertyPath = null) Assert on PHP version. + * @method LazyAssertion propertiesExist(array $properties, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the properties all exist. + * @method LazyAssertion propertyExists(string $property, string|callable $message = null, string $propertyPath = null) Assert that the value is an object or class, and that the property exists. + * @method LazyAssertion range(mixed $minValue, mixed $maxValue, string|callable $message = null, string $propertyPath = null) Assert that value is in range of numbers. + * @method LazyAssertion readable(string|callable $message = null, string $propertyPath = null) Assert that the value is something readable. + * @method LazyAssertion regex(string $pattern, string|callable $message = null, string $propertyPath = null) Assert that value matches a regex. + * @method LazyAssertion same(mixed $value2, string|callable $message = null, string $propertyPath = null) Assert that two values are the same (using ===). + * @method LazyAssertion satisfy(callable $callback, string|callable $message = null, string $propertyPath = null) Assert that the provided value is valid according to a callback. + * @method LazyAssertion scalar(string|callable $message = null, string $propertyPath = null) Assert that value is a PHP scalar. + * @method LazyAssertion startsWith(string $needle, string|callable $message = null, string $propertyPath = null, string $encoding = 'utf8') Assert that string starts with a sequence of chars. + * @method LazyAssertion string(string|callable $message = null, string $propertyPath = null) Assert that value is a string. + * @method LazyAssertion subclassOf(string $className, string|callable $message = null, string $propertyPath = null) Assert that value is subclass of given class-name. + * @method LazyAssertion true(string|callable $message = null, string $propertyPath = null) Assert that the value is boolean True. + * @method LazyAssertion url(string|callable $message = null, string $propertyPath = null) Assert that value is an URL. + * @method LazyAssertion uuid(string|callable $message = null, string $propertyPath = null) Assert that the given string is a valid UUID. + * @method LazyAssertion version(string $operator, string $version2, string|callable $message = null, string $propertyPath = null) Assert comparison of two versions. + * @method LazyAssertion writeable(string|callable $message = null, string $propertyPath = null) Assert that the value is something writeable. + * @method LazyAssertion all() Switch chain into validation mode for an array of values. + * @method LazyAssertion nullOr() Switch chain into mode allowing nulls, ignoring further assertions. + */ +class LazyAssertion +{ + private $currentChainFailed = false; + private $alwaysTryAll = false; + private $thisChainTryAll = false; + private $currentChain; + private $errors = []; + + /** @var string The class to use as AssertionChain factory */ + private $assertClass = Assert::class; + + /** @var string|LazyAssertionException The class to use for exceptions */ + private $exceptionClass = LazyAssertionException::class; + + /** + * @param mixed $value + * @param string|null $propertyPath + * @param string|callable|null $defaultMessage + * + * @return static + */ + public function that($value, string $propertyPath = null, $defaultMessage = null) + { + $this->currentChainFailed = false; + $this->thisChainTryAll = false; + $assertClass = $this->assertClass; + $this->currentChain = $assertClass::that($value, $defaultMessage, $propertyPath); + + return $this; + } + + /** + * @return static + */ + public function tryAll() + { + if (!$this->currentChain) { + $this->alwaysTryAll = true; + } + + $this->thisChainTryAll = true; + + return $this; + } + + /** + * @param string $method + * @param array $args + * + * @return static + */ + public function __call($method, $args) + { + if (false === $this->alwaysTryAll + && false === $this->thisChainTryAll + && true === $this->currentChainFailed + ) { + return $this; + } + + try { + \call_user_func_array([$this->currentChain, $method], $args); + } catch (AssertionFailedException $e) { + $this->errors[] = $e; + $this->currentChainFailed = true; + } + + return $this; + } + + /** + * @return bool + * + * @throws LazyAssertionException + */ + public function verifyNow(): bool + { + if ($this->errors) { + throw \call_user_func([$this->exceptionClass, 'fromErrors'], $this->errors); + } + + return true; + } + + /** + * @param string $className + * + * @return static + */ + public function setAssertClass(string $className) + { + if (Assert::class !== $className && !\is_subclass_of($className, Assert::class)) { + throw new LogicException($className.' is not (a subclass of) '.Assert::class); + } + + $this->assertClass = $className; + + return $this; + } + + /** + * @param string $className + * + * @return static + */ + public function setExceptionClass(string $className) + { + if (LazyAssertionException::class !== $className && !\is_subclass_of($className, LazyAssertionException::class)) { + throw new LogicException($className.' is not (a subclass of) '.LazyAssertionException::class); + } + + $this->exceptionClass = $className; + + return $this; + } +} diff --git a/vendor/beberlei/assert/lib/Assert/LazyAssertionException.php b/vendor/beberlei/assert/lib/Assert/LazyAssertionException.php new file mode 100644 index 000000000..f76ecc699 --- /dev/null +++ b/vendor/beberlei/assert/lib/Assert/LazyAssertionException.php @@ -0,0 +1,55 @@ +getPropertyPath(), $error->getMessage()); + } + + return new static($message, $errors); + } + + public function __construct($message, array $errors) + { + parent::__construct($message, 0, null, null); + + $this->errors = $errors; + } + + /** + * @return InvalidArgumentException[] + */ + public function getErrorExceptions(): array + { + return $this->errors; + } +} diff --git a/vendor/beberlei/assert/lib/Assert/functions.php b/vendor/beberlei/assert/lib/Assert/functions.php new file mode 100644 index 000000000..e0ccbd7d9 --- /dev/null +++ b/vendor/beberlei/assert/lib/Assert/functions.php @@ -0,0 +1,80 @@ +notEmpty()->integer(); + * \Assert\that($value)->nullOr()->string()->startsWith("Foo"); + * + * The assertion chain can be stateful, that means be careful when you reuse + * it. You should never pass around the chain. + */ +function that($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain +{ + return Assert::that($value, $defaultMessage, $defaultPropertyPath); +} + +/** + * Start validation on a set of values, returns {@link AssertionChain}. + * + * @param mixed $values + * @param string|callable|null $defaultMessage + * @param string $defaultPropertyPath + * + * @return AssertionChain + */ +function thatAll($values, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain +{ + return Assert::thatAll($values, $defaultMessage, $defaultPropertyPath); +} + +/** + * Start validation and allow NULL, returns {@link AssertionChain}. + * + * @param mixed $value + * @param string|callable|null $defaultMessage + * @param string $defaultPropertyPath + * + * @return AssertionChain + * + * @deprecated In favour of Assert::thatNullOr($value, $defaultMessage = null, $defaultPropertyPath = null) + */ +function thatNullOr($value, $defaultMessage = null, string $defaultPropertyPath = null): AssertionChain +{ + return Assert::thatNullOr($value, $defaultMessage, $defaultPropertyPath); +} + +/** + * Create a lazy assertion object. + * + * @return LazyAssertion + */ +function lazy(): LazyAssertion +{ + return Assert::lazy(); +} diff --git a/vendor/beberlei/assert/phpstan-code.neon b/vendor/beberlei/assert/phpstan-code.neon new file mode 100644 index 000000000..49aa5723f --- /dev/null +++ b/vendor/beberlei/assert/phpstan-code.neon @@ -0,0 +1,10 @@ +parameters: + autoload_files: + - bin/MethodDocGenerator.php + ignoreErrors: + # is_countable() is available only in PHP 7.3+ + - '#Function is_countable not found#' + + # Calling count() on ResourceBundle and SimpleXMLElement is valid from PHP 7.0+, but does not correctly advertise + # the fact, and so PHPStan has an issue with this. This will be fixed in PHP 7.4+ + - '#Call to function count\(\) with argument type array|Countable|ResourceBundle|SimpleXMLElement will always result in number 1#' diff --git a/vendor/beberlei/assert/phpstan-tests.neon b/vendor/beberlei/assert/phpstan-tests.neon new file mode 100644 index 000000000..e9ab0bcf9 --- /dev/null +++ b/vendor/beberlei/assert/phpstan-tests.neon @@ -0,0 +1,10 @@ +parameters: + ignoreErrors: + # The following errors are ignored as they are testing for errors and exceptions that static analysis correctly identifies as problems. + - '#Call to an undefined method Assert\\AssertionChain::unknownAssertion\(\)#' + - '#Call to an undefined static method Assert\\Assertion::nullOrAssertionDoesNotExist\(\)#' + - '#Class Foo not found#' + - '#Parameter \#1 $value of static method Assert\\Assertion::isCountable\(\) expects array|Countable|ResourceBundle|SimpleXMLElement, string given#' + - '#Parameter \#2 \$operator of static method Assert\\Assertion::version\(\) expects string, null given#' + - '#Static method Assert\\Assertion::allTrue\(\) invoked with 0 parameters, 1-3 required#' + - '#Static method Assert\\Assertion::nullOrMax\(\) invoked with 0 parameters, 2-4 required#' diff --git a/vendor/chillerlan/php-qrcode/.github/FUNDING.yml b/vendor/chillerlan/php-qrcode/.github/FUNDING.yml new file mode 100644 index 000000000..fc89a6739 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.github/FUNDING.yml @@ -0,0 +1 @@ +ko_fi: codemasher diff --git a/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml b/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml new file mode 100644 index 000000000..5dd343abd --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml @@ -0,0 +1,55 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions +# https://github.com/localheinz/php-library-template/blob/master/.github/workflows/continuous-integration.yml +# https://github.com/sebastianbergmann/phpunit/blob/master/.github/workflows/ci.yml + +on: + - pull_request + - push + +name: "Continuous Integration" + +jobs: + + tests: + name: "Unit Tests" + runs-on: ubuntu-latest + + strategy: + matrix: + php-binary: + - php7.2 + - php7.3 + - php7.4 + + steps: + - name: "Checkout" + uses: actions/checkout@v1.1.0 + + - name: "Install dependencies with composer" + run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest + + - name: "Run unit tests with phpunit" + run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml --no-coverage + + + code-coverage: + name: "Code Coverage" + runs-on: ubuntu-latest + + steps: + - name: "Checkout" + uses: actions/checkout@v1.1.0 + + - name: "Install locked dependencies with composer" + run: php7.4 $(which composer) install --no-interaction --no-progress --no-suggest + + - name: "Dump Xdebug filter with phpunit/phpunit" + run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php + + - name: "Collect code coverage with Xdebug and phpunit/phpunit" + run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --prepend=.build/phpunit/xdebug-filter.php + + - name: "Send code coverage report to Codecov.io" + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + run: bash <(curl -s https://codecov.io/bash) diff --git a/vendor/chillerlan/php-qrcode/.gitignore b/vendor/chillerlan/php-qrcode/.gitignore new file mode 100644 index 000000000..ecebb9964 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.gitignore @@ -0,0 +1,5 @@ +.build/* +.idea/* +vendor/* +composer.lock +*.phpunit.result.cache diff --git a/vendor/chillerlan/php-qrcode/.scrutinizer.yml b/vendor/chillerlan/php-qrcode/.scrutinizer.yml new file mode 100644 index 000000000..7fdd2a4dc --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.scrutinizer.yml @@ -0,0 +1,5 @@ +filter: + excluded_paths: + - examples/* + - tests/* + - vendor/* diff --git a/vendor/chillerlan/php-qrcode/.travis.yml b/vendor/chillerlan/php-qrcode/.travis.yml new file mode 100644 index 000000000..78b8d79e9 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/.travis.yml @@ -0,0 +1,19 @@ +addons: + apt: + packages: + - imagemagick + +language: php + +matrix: + include: + - php: 7.2 + - php: 7.3 + - php: 7.4 + +before_install: + - pecl channel-update pecl.php.net + - printf "\n" | pecl install imagick +install: travis_retry composer install --no-interaction --prefer-source +script: vendor/bin/phpunit --configuration phpunit.xml --coverage-clover clover.xml +after_script: bash <(curl -s https://codecov.io/bash) diff --git a/vendor/chillerlan/php-qrcode/LICENSE b/vendor/chillerlan/php-qrcode/LICENSE new file mode 100644 index 000000000..dac852818 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Smiley + +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/chillerlan/php-qrcode/README.md b/vendor/chillerlan/php-qrcode/README.md new file mode 100644 index 000000000..075b2a376 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/README.md @@ -0,0 +1,392 @@ +# chillerlan/php-qrcode + +A PHP7.2+ QR Code library based on the [implementation](https://github.com/kazuhikoarase/qrcode-generator) by [Kazuhiko Arase](https://github.com/kazuhikoarase), +namespaced, cleaned up, improved and other stuff. + +[![Packagist version][packagist-badge]][packagist] +[![License][license-badge]][license] +[![Travis CI][travis-badge]][travis] +[![CodeCov][coverage-badge]][coverage] +[![Scrunitizer CI][scrutinizer-badge]][scrutinizer] +[![Packagist downloads][downloads-badge]][downloads] +[![PayPal donate][donate-badge]][donate] + +[![Continuous Integration][gh-action-badge]][gh-action] + +[packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-qrcode.svg?style=flat-square +[packagist]: https://packagist.org/packages/chillerlan/php-qrcode +[license-badge]: https://img.shields.io/github/license/chillerlan/php-qrcode.svg?style=flat-square +[license]: https://github.com/chillerlan/php-qrcode/blob/main/LICENSE +[travis-badge]: https://img.shields.io/travis/chillerlan/php-qrcode.svg?style=flat-square +[travis]: https://travis-ci.org/chillerlan/php-qrcode +[coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/php-qrcode.svg?style=flat-square +[coverage]: https://codecov.io/github/chillerlan/php-qrcode +[scrutinizer-badge]: https://img.shields.io/scrutinizer/g/chillerlan/php-qrcode.svg?style=flat-square +[scrutinizer]: https://scrutinizer-ci.com/g/chillerlan/php-qrcode +[downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-qrcode.svg?style=flat-square +[downloads]: https://packagist.org/packages/chillerlan/php-qrcode/stats +[donate-badge]: https://img.shields.io/badge/donate-paypal-ff33aa.svg?style=flat-square +[donate]: https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4 +[gh-action-badge]: https://github.com/chillerlan/php-qrcode/workflows/Continuous%20Integration/badge.svg +[gh-action]: https://github.com/chillerlan/php-qrcode/actions + +## Documentation + +### Requirements +- PHP 7.2+ + - `ext-mbstring` + - optional: + - `ext-json`, `ext-gd` + - `ext-imagick` with [ImageMagick](https://imagemagick.org) installed + - [`setasign/fpdf`](https://github.com/setasign/fpdf) for the PDF output module + +### Installation +**requires [composer](https://getcomposer.org)** + +via terminal: `composer require chillerlan/php-qrcode` + +*composer.json* (note: replace `dev-master` with a [version boundary](https://getcomposer.org/doc/articles/versions.md), e.g. `^3.2`) +```json +{ + "require": { + "php": "^7.2", + "chillerlan/php-qrcode": "^3.4" + } +} +``` + +### Usage +We want to encode this URI for a mobile authenticator into a QRcode image: +```php +$data = 'otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net'; + +//quick and simple: +echo 'QR Code'; +``` + +

+ QR codes are awesome! + QR codes are awesome! +

+ +Wait, what was that? Please again, slower! + +### Advanced usage + +Ok, step by step. First you'll need a `QRCode` instance, which can be optionally invoked with a `QROptions` (or a [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php), respectively) object as the only parameter. + +```php +$options = new QROptions([ + 'version' => 5, + 'outputType' => QRCode::OUTPUT_MARKUP_SVG, + 'eccLevel' => QRCode::ECC_L, +]); + +// invoke a fresh QRCode instance +$qrcode = new QRCode($options); + +// and dump the output +$qrcode->render($data); + +// ...with additional cache file +$qrcode->render($data, '/path/to/file.svg'); +``` + +In case you just want the raw QR code matrix, call `QRCode::getMatrix()` - this method is also called internally from `QRCode::render()`. See also [Custom output modules](#custom-qroutputinterface). + +```php +$matrix = $qrcode->getMatrix($data); + +foreach($matrix->matrix() as $y => $row){ + foreach($row as $x => $module){ + + // get a module's value + $value = $module; + $value = $matrix->get($x, $y); + + // boolean check a module + if($matrix->check($x, $y)){ // if($module >> 8 > 0) + // do stuff, the module is dark + } + else{ + // do other stuff, the module is light + } + + } +} +``` + +Have a look [in this folder](https://github.com/chillerlan/php-qrcode/tree/master/examples) for some more usage examples. + +#### Custom module values +Previous versions of `QRCode` held only boolean matrix values that only allowed to determine whether a module was dark or not. Now you can distinguish between different parts of the matrix, namely the several required patterns from the QR Code specification, and use them in different ways. + +The dark value is the module (light) value shifted by 8 bits to the left: `$value = $M_TYPE << ($bool ? 8 : 0);`, where `$M_TYPE` is one of the `QRMatrix::M_*` constants. +You can check the value for a type explicitly like... +```php +// for true (dark) +$value >> 8 === $M_TYPE; + +//for false (light) +$value === $M_TYPE; +``` +...or you can perform a loose check, ignoring the module value +```php +// for true +$value >> 8 > 0; + +// for false +$value >> 8 === 0 +``` + +See also `QRMatrix::set()`, `QRMatrix::check()` and [`QRMatrix` constants](#qrmatrix-constants). + +To map the values and properly render the modules for the given `QROutputInterface`, it's necessary to overwrite the default values: +```php +$options = new QROptions; + +// for HTML, SVG and ImageMagick +$options->moduleValues = [ + // finder + 1536 => '#A71111', // dark (true) + 6 => '#FFBFBF', // light (false) + // alignment + 2560 => '#A70364', + 10 => '#FFC9C9', + // timing + 3072 => '#98005D', + 12 => '#FFB8E9', + // format + 3584 => '#003804', + 14 => '#00FB12', + // version + 4096 => '#650098', + 16 => '#E0B8FF', + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + // darkmodule + 512 => '#080063', + // separator + 8 => '#AFBFBF', + // quietzone + 18 => '#FFFFFF', +]; + +// for the image output types +$options->moduleValues = [ + 512 => [0, 0, 0], + // ... +]; + +// for string/text output +$options->moduleValues = [ + 512 => '#', + // ... +]; +``` + +#### Custom `QROutputInterface` +Instead of bloating your code you can simply create your own output interface by extending `QROutputAbstract`. Have a look at the [built-in output modules](https://github.com/chillerlan/php-qrcode/tree/master/src/Output). + +```php +class MyCustomOutput extends QROutputAbstract{ + + // inherited from QROutputAbstract + protected $matrix; // QRMatrix + protected $moduleCount; // modules QRMatrix::size() + protected $options; // MyCustomOptions or QROptions + protected $scale; // scale factor from options + protected $length; // length of the matrix ($moduleCount * $scale) + + // ...check/set default module values (abstract method, called by the constructor) + protected function setModuleValues():void{ + // $this->moduleValues = ... + } + + // QROutputInterface::dump() + public function dump(string $file = null):string{ + $output = ''; + + for($row = 0; $row < $this->moduleCount; $row++){ + for($col = 0; $col < $this->moduleCount; $col++){ + $output .= (int)$this->matrix->check($col, $row); + } + } + + return $output; + } + +} +``` + +In case you need additional settings for your output module, just extend `QROptions`... +``` +class MyCustomOptions extends QROptions{ + protected $myParam = 'defaultValue'; + + // ... +} +``` +...or use the [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php), which is the more flexible approach. + +```php +trait MyCustomOptionsTrait{ + protected $myParam = 'defaultValue'; + + // ... +} +``` +set the options: +```php +$myOptions = [ + 'version' => 5, + 'eccLevel' => QRCode::ECC_L, + 'outputType' => QRCode::OUTPUT_CUSTOM, + 'outputInterface' => MyCustomOutput::class, + // your custom settings + 'myParam' => 'whatever value', + ]; + +// extends QROptions +$myCustomOptions = new MyCustomOptions($myOptions); + +// using the SettingsContainerInterface +$myCustomOptions = new class($myOptions) extends SettingsContainerAbstract{ + use QROptionsTrait, MyCustomOptionsTrait; +}; + +``` + +You can then call `QRCode` with the custom modules... +```php +(new QRCode($myCustomOptions))->render($data); +``` +...or invoke the `QROutputInterface` manually. +```php +$qrOutputInterface = new MyCustomOutput($myCustomOptions, (new QRCode($myCustomOptions))->getMatrix($data)); + +//dump the output, which is equivalent to QRCode::render() +$qrOutputInterface->dump(); +``` + +### API + +#### `QRCode` methods +method | return | description +------ | ------ | ----------- +`__construct(QROptions $options = null)` | - | see [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php) +`render(string $data, string $file = null)` | mixed, `QROutputInterface::dump()` | renders a QR Code for the given `$data` and `QROptions`, saves `$file` optional +`getMatrix(string $data)` | `QRMatrix` | returns a `QRMatrix` object for the given `$data` and current `QROptions` +`initDataInterface(string $data)` | `QRDataInterface` | returns a fresh `QRDataInterface` for the given `$data` +`isNumber(string $string)` | bool | checks if a string qualifies for `Number` +`isAlphaNum(string $string)` | bool | checks if a string qualifies for `AlphaNum` +`isKanji(string $string)` | bool | checks if a string qualifies for `Kanji` + +#### `QRCode` constants +name | description +---- | ----------- +`VERSION_AUTO` | `QROptions::$version` +`MASK_PATTERN_AUTO` | `QROptions::$maskPattern` +`OUTPUT_MARKUP_SVG`, `OUTPUT_MARKUP_HTML` | `QROptions::$outputType` markup +`OUTPUT_IMAGE_PNG`, `OUTPUT_IMAGE_JPG`, `OUTPUT_IMAGE_GIF` | `QROptions::$outputType` image +`OUTPUT_STRING_JSON`, `OUTPUT_STRING_TEXT` | `QROptions::$outputType` string +`OUTPUT_IMAGICK` | `QROptions::$outputType` ImageMagick +`OUTPUT_FPDF` | `QROptions::$outputType` PDF, using [FPDF](https://github.com/setasign/fpdf) +`OUTPUT_CUSTOM` | `QROptions::$outputType`, requires `QROptions::$outputInterface` +`ECC_L`, `ECC_M`, `ECC_Q`, `ECC_H`, | ECC-Level: 7%, 15%, 25%, 30% in `QROptions::$eccLevel` +`DATA_NUMBER`, `DATA_ALPHANUM`, `DATA_BYTE`, `DATA_KANJI` | `QRDataInterface::$datamode` + +#### `QROptions` properties +property | type | default | allowed | description +-------- | ---- | ------- | ------- | ----------- +`$version` | int | `QRCode::VERSION_AUTO` | 1...40 | the [QR Code version number](http://www.qrcode.com/en/about/version.html) +`$versionMin` | int | 1 | 1...40 | Minimum QR version (if `$version = QRCode::VERSION_AUTO`) +`$versionMax` | int | 40 | 1...40 | Maximum QR version (if `$version = QRCode::VERSION_AUTO`) +`$eccLevel` | int | `QRCode::ECC_L` | `QRCode::ECC_X` | Error correct level, where X = L (7%), M (15%), Q (25%), H (30%) +`$maskPattern` | int | `QRCode::MASK_PATTERN_AUTO` | 0...7 | Mask Pattern to use +`$addQuietzone` | bool | `true` | - | Add a "quiet zone" (margin) according to the QR code spec +`$quietzoneSize` | int | 4 | clamped to 0 ... `$matrixSize / 2` | Size of the quiet zone +`$dataMode` | string | `null` | `Number`, `AlphaNum`, `Kanji`, `Byte` | allows overriding the data type detection +`$outputType` | string | `QRCode::OUTPUT_IMAGE_PNG` | `QRCode::OUTPUT_*` | built-in output type +`$outputInterface` | string | `null` | * | FQCN of the custom `QROutputInterface` if `QROptions::$outputType` is set to `QRCode::OUTPUT_CUSTOM` +`$cachefile` | string | `null` | * | optional cache file path +`$eol` | string | `PHP_EOL` | * | newline string (HTML, SVG, TEXT) +`$scale` | int | 5 | * | size of a QR code pixel (SVG, IMAGE_*), HTML -> via CSS +`$cssClass` | string | `null` | * | a common css class +`$svgOpacity` | float | 1.0 | 0...1 | +`$svgDefs` | string | * | * | anything between [``](https://developer.mozilla.org/docs/Web/SVG/Element/defs) +`$svgViewBoxSize` | int | `null` | * | a positive integer which defines width/height of the [viewBox attribute](https://css-tricks.com/scale-svg/#article-header-id-3) +`$textDark` | string | '🔴' | * | string substitute for dark +`$textLight` | string | '⭕' | * | string substitute for light +`$markupDark` | string | '#000' | * | markup substitute for dark (CSS value) +`$markupLight` | string | '#fff' | * | markup substitute for light (CSS value) +`$imageBase64` | bool | `true` | - | whether to return the image data as base64 or raw like from `file_get_contents()` +`$imageTransparent` | bool | `true` | - | toggle transparency (no jpeg support) +`$imageTransparencyBG` | array | `[255, 255, 255]` | `[R, G, B]` | the RGB values for the transparent color, see [`imagecolortransparent()`](http://php.net/manual/function.imagecolortransparent.php) +`$pngCompression` | int | -1 | -1 ... 9 | `imagepng()` compression level, -1 = auto +`$jpegQuality` | int | 85 | 0 - 100 | `imagejpeg()` quality +`$imagickFormat` | string | 'png' | * | ImageMagick output type, see `Imagick::setType()` +`$imagickBG` | string | `null` | * | ImageMagick background color, see `ImagickPixel::__construct()` +`$moduleValues` | array | `null` | * | Module values map, see [Custom output modules](#custom-qroutputinterface) and `QROutputInterface::DEFAULT_MODULE_VALUES` + +#### `QRMatrix` methods +method | return | description +------ | ------ | ----------- +`__construct(int $version, int $eclevel)` | - | - +`matrix()` | array | the internal matrix representation as a 2 dimensional array +`version()` | int | the current QR Code version +`eccLevel()` | int | current ECC level +`maskPattern()` | int | the used mask pattern +`size()` | int | the absoulute size of the matrix, including quiet zone (if set). `$version * 4 + 17 + 2 * $quietzone` +`get(int $x, int $y)` | int | returns the value of the module +`set(int $x, int $y, bool $value, int $M_TYPE)` | `QRMatrix` | sets the `$M_TYPE` value for the module +`check(int $x, int $y)` | bool | checks whether a module is true (dark) or false (light) +`setLogoSpace(int $width, int $height, int $startX = null, int $startY = null)` | `QRMatrix` | creates a logo space in the matrix + +#### `QRMatrix` constants +name | light (false) | dark (true) | description +---- | ------------- | ----------- | ----------- +`M_NULL` | 0 | - | module not set (should never appear. if so, there's an error) +`M_DARKMODULE` | - | 512 | once per matrix at `$xy = [8, 4 * $version + 9]` +`M_DATA` | 4 | 1024 | the actual encoded data +`M_FINDER` | 6 | 1536 | the 7x7 finder patterns +`M_SEPARATOR` | 8 | - | separator lines around the finder patterns +`M_ALIGNMENT` | 10 | 2560 | the 5x5 alignment patterns +`M_TIMING` | 12 | 3072 | the timing pattern lines +`M_FORMAT` | 14 | 3584 | format information pattern +`M_VERSION` | 16 | 4096 | version information pattern +`M_QUIETZONE` | 18 | - | margin around the QR Code +`M_LOGO` | 20 | - | space for a logo image (not used yet) +`M_TEST` | 255 | 65280 | test value + + +### Notes +The QR encoder, especially the subroutines for mask pattern testing, can cause high CPU load on increased matrix size. +You can avoid a part of this load by choosing a fast output module, like `OUTPUT_IMAGE_*` and setting the mask pattern manually (which may result in unreadable QR Codes). +Oh hey and don't forget to sanitize any user input! + +### Disclaimer! +I don't take responsibility for molten CPUs, misled applications, failed log-ins etc.. Use at your own risk! + +#### Trademark Notice + +The word "QR Code" is registered trademark of *DENSO WAVE INCORPORATED*
+http://www.denso-wave.com/qrcode/faqpatent-e.html + +### Framework Integration +- Drupal [Google Authenticator Login `ga_login`](https://www.drupal.org/project/ga_login) +- WordPress [`wp-two-factor-auth`](https://github.com/sjinks/wp-two-factor-auth) +- WordPress [Simple 2FA `simple-2fa`](https://wordpress.org/plugins/simple-2fa/) +- WoltLab Suite [two-step-verification](http://pluginstore.woltlab.com/file/3007-two-step-verification/) +- [Cachet](https://github.com/CachetHQ/Cachet) +- [Appwrite](https://github.com/appwrite/appwrite) +- other uses: [dependents](https://github.com/chillerlan/php-qrcode/network/dependents) / [packages](https://github.com/chillerlan/php-qrcode/network/dependents?dependent_type=PACKAGE) + + +Hi, please check out my other projects that are way cooler than qrcodes! + +- [php-oauth-core](https://github.com/chillerlan/php-oauth-core) - an OAuth 1/2 client library along with a bunch of [providers](https://github.com/chillerlan/php-oauth-providers) +- [php-httpinterface](https://github.com/chillerlan/php-httpinterface) - a PSR-7/15/17/18 implemetation +- [php-database](https://github.com/chillerlan/php-database) - a database client & querybuilder for MySQL, Postgres, SQLite, MSSQL, Firebird + diff --git a/vendor/chillerlan/php-qrcode/composer.json b/vendor/chillerlan/php-qrcode/composer.json new file mode 100644 index 000000000..c2299a350 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/composer.json @@ -0,0 +1,51 @@ +{ + "name": "chillerlan/php-qrcode", + "description": "A QR code generator. PHP 7.2+", + "homepage": "https://github.com/chillerlan/php-qrcode", + "license": "MIT", + "minimum-stability": "stable", + "type": "library", + "keywords": [ + "QR code", "qrcode", "qr", "qrcode-generator", "phpqrcode" + ], + "authors": [ + { + "name": "Kazuhiko Arase", + "homepage": "https://github.com/kazuhikoarase" + }, + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + }, + { + "name": "Contributors", + "homepage":"https://github.com/chillerlan/php-qrcode/graphs/contributors" + } + ], + "require": { + "php": "^7.2", + "ext-mbstring": "*", + "chillerlan/php-settings-container": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.", + "setasign/fpdf": "Required to use the QR FPDF output." + }, + "autoload": { + "psr-4": { + "chillerlan\\QRCode\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "chillerlan\\QRCodePublic\\": "public/", + "chillerlan\\QRCodeTest\\": "tests/", + "chillerlan\\QRCodeExamples\\": "examples/" + } + } +} diff --git a/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php b/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php new file mode 100644 index 000000000..3c01f8646 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php @@ -0,0 +1,36 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\Output\QROutputAbstract; + +class MyCustomOutput extends QROutputAbstract{ + + protected function setModuleValues():void{ + // TODO: Implement setModuleValues() method. + } + + public function dump(string $file = null){ + + $output = ''; + + for($row = 0; $row < $this->moduleCount; $row++){ + for($col = 0; $col < $this->moduleCount; $col++){ + $output .= (int)$this->matrix->check($col, $row); + } + } + + return $output; + } + +} diff --git a/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php b/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php new file mode 100644 index 000000000..f9d94ae34 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php @@ -0,0 +1,81 @@ + + * @copyright 2020 smiley + * @license MIT + * + * @noinspection PhpComposerExtensionStubsInspection + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\Output\{QRCodeOutputException, QRImage}; + +use function imagecopyresampled, imagecreatefrompng, imagesx, imagesy, is_file, is_readable; + +/** + * @property \chillerlan\QRCodeExamples\LogoOptions $options + */ +class QRImageWithLogo extends QRImage{ + + /** + * @param string|null $file + * @param string|null $logo + * + * @return string + * @throws \chillerlan\QRCode\Output\QRCodeOutputException + */ + public function dump(string $file = null, string $logo = null):string{ + // set returnResource to true to skip further processing for now + $this->options->returnResource = true; + + // of course you could accept other formats too (such as resource or Imagick) + // i'm not checking for the file type either for simplicity reasons (assuming PNG) + if(!is_file($logo) || !is_readable($logo)){ + throw new QRCodeOutputException('invalid logo'); + } + + $this->matrix->setLogoSpace( + $this->options->logoWidth, + $this->options->logoHeight + // not utilizing the position here + ); + + // there's no need to save the result of dump() into $this->image here + parent::dump($file); + + $im = imagecreatefrompng($logo); + + // get logo image size + $w = imagesx($im); + $h = imagesy($im); + + // set new logo size, leave a border of 1 module + $lw = ($this->options->logoWidth - 2) * $this->options->scale; + $lh = ($this->options->logoHeight - 2) * $this->options->scale; + + // get the qrcode size + $ql = $this->matrix->size() * $this->options->scale; + + // scale the logo and copy it over. done! + imagecopyresampled($this->image, $im, ($ql - $lw) / 2, ($ql - $lh) / 2, 0, 0, $lw, $lh, $w, $h); + + $imageData = $this->dumpImage(); + + if($file !== null){ + $this->saveToFile($imageData, $file); + } + + if($this->options->imageBase64){ + $imageData = 'data:image/'.$this->options->outputType.';base64,'.base64_encode($imageData); + } + + return $imageData; + } + +} diff --git a/vendor/chillerlan/php-qrcode/examples/QRImageWithText.php b/vendor/chillerlan/php-qrcode/examples/QRImageWithText.php new file mode 100644 index 000000000..5ca572f30 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/QRImageWithText.php @@ -0,0 +1,104 @@ + + * @copyright 2019 smiley + * @license MIT + * + * @noinspection PhpComposerExtensionStubsInspection + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\Output\QRImage; +use function base64_encode, imagechar, imagecolorallocate, imagecolortransparent, imagecopymerge, imagecreatetruecolor, + imagedestroy, imagefilledrectangle, imagefontwidth, in_array, round, str_split, strlen; + +class QRImageWithText extends QRImage{ + + /** + * @param string|null $file + * @param string|null $text + * + * @return string + */ + public function dump(string $file = null, string $text = null):string{ + $this->image = imagecreatetruecolor($this->length, $this->length); + $background = imagecolorallocate($this->image, ...$this->options->imageTransparencyBG); + + if((bool)$this->options->imageTransparent && in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){ + imagecolortransparent($this->image, $background); + } + + imagefilledrectangle($this->image, 0, 0, $this->length, $this->length, $background); + + foreach($this->matrix->matrix() as $y => $row){ + foreach($row as $x => $M_TYPE){ + $this->setPixel($x, $y, $this->moduleValues[$M_TYPE]); + } + } + + // render text output if a string is given + if($text !== null){ + $this->addText($text); + } + + $imageData = $this->dumpImage($file); + + if((bool)$this->options->imageBase64){ + $imageData = 'data:image/'.$this->options->outputType.';base64,'.base64_encode($imageData); + } + + return $imageData; + } + + /** + * @param string $text + */ + protected function addText(string $text):void{ + // save the qrcode image + $qrcode = $this->image; + + // options things + $textSize = 3; // see imagefontheight() and imagefontwidth() + $textBG = [200, 200, 200]; + $textColor = [50, 50, 50]; + + $bgWidth = $this->length; + $bgHeight = $bgWidth + 20; // 20px extra space + + // create a new image with additional space + $this->image = imagecreatetruecolor($bgWidth, $bgHeight); + $background = imagecolorallocate($this->image, ...$textBG); + + // allow transparency + if((bool)$this->options->imageTransparent && in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){ + imagecolortransparent($this->image, $background); + } + + // fill the background + imagefilledrectangle($this->image, 0, 0, $bgWidth, $bgHeight, $background); + + // copy over the qrcode + imagecopymerge($this->image, $qrcode, 0, 0, 0, 0, $this->length, $this->length, 100); + imagedestroy($qrcode); + + $fontColor = imagecolorallocate($this->image, ...$textColor); + $w = imagefontwidth($textSize); + $x = round(($bgWidth - strlen($text) * $w) / 2); + + // loop through the string and draw the letters + foreach(str_split($text) as $i => $chr){ + imagechar($this->image, $textSize, $i * $w + $x, $this->length, $chr, $fontColor); + } + } + +} diff --git a/vendor/chillerlan/php-qrcode/examples/custom_output.php b/vendor/chillerlan/php-qrcode/examples/custom_output.php new file mode 100644 index 000000000..71ea62682 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/custom_output.php @@ -0,0 +1,38 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +// invoke the QROutputInterface manually +$options = new QROptions([ + 'version' => 5, + 'eccLevel' => QRCode::ECC_L, +]); + +$qrOutputInterface = new MyCustomOutput($options, (new QRCode($options))->getMatrix($data)); + +var_dump($qrOutputInterface->dump()); + + +// or just +$options = new QROptions([ + 'version' => 5, + 'eccLevel' => QRCode::ECC_L, + 'outputType' => QRCode::OUTPUT_CUSTOM, + 'outputInterface' => MyCustomOutput::class, +]); + +var_dump((new QRCode($options))->render($data)); diff --git a/vendor/chillerlan/php-qrcode/examples/example_image.png b/vendor/chillerlan/php-qrcode/examples/example_image.png new file mode 100644 index 000000000..b4a80f2ab Binary files /dev/null and b/vendor/chillerlan/php-qrcode/examples/example_image.png differ diff --git a/vendor/chillerlan/php-qrcode/examples/example_svg.png b/vendor/chillerlan/php-qrcode/examples/example_svg.png new file mode 100644 index 000000000..f1e7b32f7 Binary files /dev/null and b/vendor/chillerlan/php-qrcode/examples/example_svg.png differ diff --git a/vendor/chillerlan/php-qrcode/examples/fpdf.php b/vendor/chillerlan/php-qrcode/examples/fpdf.php new file mode 100644 index 000000000..9c690a7f7 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/fpdf.php @@ -0,0 +1,47 @@ + 7, + 'outputType' => QRCode::OUTPUT_FPDF, + 'eccLevel' => QRCode::ECC_L, + 'scale' => 5, + 'imageBase64' => false, + 'moduleValues' => [ + // finder + 1536 => [0, 63, 255], // dark (true) + 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default + // alignment + 2560 => [255, 0, 255], + 10 => [255, 255, 255], + // timing + 3072 => [255, 0, 0], + 12 => [255, 255, 255], + // format + 3584 => [67, 191, 84], + 14 => [255, 255, 255], + // version + 4096 => [62, 174, 190], + 16 => [255, 255, 255], + // data + 1024 => [0, 0, 0], + 4 => [255, 255, 255], + // darkmodule + 512 => [0, 0, 0], + // separator + 8 => [255, 255, 255], + // quietzone + 18 => [255, 255, 255], + ], +]); + +\header('Content-type: application/pdf'); + +echo (new QRCode($options))->render($data); diff --git a/vendor/chillerlan/php-qrcode/examples/html.php b/vendor/chillerlan/php-qrcode/examples/html.php new file mode 100644 index 000000000..aa5305d24 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/html.php @@ -0,0 +1,102 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once '../vendor/autoload.php'; + +header('Content-Type: text/html; charset=utf-8'); + +?> + + + + + + QRCode test + + + +
+ 5, + 'outputType' => QRCode::OUTPUT_MARKUP_HTML, + 'eccLevel' => QRCode::ECC_L, + 'moduleValues' => [ + // finder + 1536 => '#A71111', // dark (true) + 6 => '#FFBFBF', // light (false) + // alignment + 2560 => '#A70364', + 10 => '#FFC9C9', + // timing + 3072 => '#98005D', + 12 => '#FFB8E9', + // format + 3584 => '#003804', + 14 => '#00FB12', + // version + 4096 => '#650098', + 16 => '#E0B8FF', + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + // darkmodule + 512 => '#080063', + // separator + 8 => '#AFBFBF', + // quietzone + 18 => '#FFFFFF', + ], + ]); + + echo (new QRCode($options))->render($data); + +?> +
+ + + + + diff --git a/vendor/chillerlan/php-qrcode/examples/image.php b/vendor/chillerlan/php-qrcode/examples/image.php new file mode 100644 index 000000000..89ba2a9a8 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/image.php @@ -0,0 +1,60 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_IMAGE_PNG, + 'eccLevel' => QRCode::ECC_L, + 'scale' => 5, + 'imageBase64' => false, + 'moduleValues' => [ + // finder + 1536 => [0, 63, 255], // dark (true) + 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default + // alignment + 2560 => [255, 0, 255], + 10 => [255, 255, 255], + // timing + 3072 => [255, 0, 0], + 12 => [255, 255, 255], + // format + 3584 => [67, 191, 84], + 14 => [255, 255, 255], + // version + 4096 => [62, 174, 190], + 16 => [255, 255, 255], + // data + 1024 => [0, 0, 0], + 4 => [255, 255, 255], + // darkmodule + 512 => [0, 0, 0], + // separator + 8 => [255, 255, 255], + // quietzone + 18 => [255, 255, 255], + ], +]); + +header('Content-type: image/png'); + +echo (new QRCode($options))->render($data); + + + + + diff --git a/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php b/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php new file mode 100644 index 000000000..987e10c11 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php @@ -0,0 +1,44 @@ + + * @copyright 2020 smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; +/** + * @property int $logoWidth + * @property int $logoHeight + * + * @noinspection PhpIllegalPsrClassPathInspection + */ +class LogoOptions extends QROptions{ + protected $logoWidth; + protected $logoHeight; +} + +$options = new LogoOptions; + +$options->version = 7; +$options->eccLevel = QRCode::ECC_H; +$options->imageBase64 = false; +$options->logoWidth = 13; +$options->logoHeight = 13; +$options->scale = 5; +$options->imageTransparent = false; + +header('Content-type: image/png'); + +$qrOutputInterface = new QRImageWithLogo($options, (new QRCode($options))->getMatrix($data)); + +// dump the output, with an additional logo +echo $qrOutputInterface->dump(null, __DIR__.'/octocat.png'); diff --git a/vendor/chillerlan/php-qrcode/examples/imageWithText.php b/vendor/chillerlan/php-qrcode/examples/imageWithText.php new file mode 100644 index 000000000..050781cba --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/imageWithText.php @@ -0,0 +1,33 @@ + + * @copyright 2019 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_IMAGE_PNG, + 'scale' => 3, + 'imageBase64' => false, +]); + +header('Content-type: image/png'); + +$qrOutputInterface = new QRImageWithText($options, (new QRCode($options))->getMatrix($data)); + +// dump the output, with additional text +echo $qrOutputInterface->dump(null, 'example text'); diff --git a/vendor/chillerlan/php-qrcode/examples/imagick.php b/vendor/chillerlan/php-qrcode/examples/imagick.php new file mode 100644 index 000000000..6bec4d02e --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/imagick.php @@ -0,0 +1,59 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_IMAGICK, + 'eccLevel' => QRCode::ECC_L, + 'scale' => 5, + 'moduleValues' => [ + // finder + 1536 => '#A71111', // dark (true) + 6 => '#FFBFBF', // light (false) + // alignment + 2560 => '#A70364', + 10 => '#FFC9C9', + // timing + 3072 => '#98005D', + 12 => '#FFB8E9', + // format + 3584 => '#003804', + 14 => '#00FB12', + // version + 4096 => '#650098', + 16 => '#E0B8FF', + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + // darkmodule + 512 => '#080063', + // separator + 8 => '#DDDDDD', + // quietzone + 18 => '#DDDDDD', + ], +]); + +header('Content-type: image/png'); + +echo (new QRCode($options))->render($data); + + + + + diff --git a/vendor/chillerlan/php-qrcode/examples/octocat.png b/vendor/chillerlan/php-qrcode/examples/octocat.png new file mode 100644 index 000000000..f9050b935 Binary files /dev/null and b/vendor/chillerlan/php-qrcode/examples/octocat.png differ diff --git a/vendor/chillerlan/php-qrcode/examples/svg.php b/vendor/chillerlan/php-qrcode/examples/svg.php new file mode 100644 index 000000000..a7a159d70 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/svg.php @@ -0,0 +1,77 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; +$gzip = true; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_MARKUP_SVG, + 'eccLevel' => QRCode::ECC_L, + 'svgViewBoxSize' => 530, + 'addQuietzone' => true, + 'cssClass' => 'my-css-class', + 'svgOpacity' => 1.0, + 'svgDefs' => ' + + + + + + + + + ', + 'moduleValues' => [ + // finder + 1536 => 'url(#g1)', // dark (true) + 6 => '#fff', // light (false) + // alignment + 2560 => 'url(#g1)', + 10 => '#fff', + // timing + 3072 => 'url(#g1)', + 12 => '#fff', + // format + 3584 => 'url(#g1)', + 14 => '#fff', + // version + 4096 => 'url(#g1)', + 16 => '#fff', + // data + 1024 => 'url(#g2)', + 4 => '#fff', + // darkmodule + 512 => 'url(#g1)', + // separator + 8 => '#fff', + // quietzone + 18 => '#fff', + ], +]); + +$qrcode = (new QRCode($options))->render($data); + +header('Content-type: image/svg+xml'); + +if($gzip === true){ + header('Vary: Accept-Encoding'); + header('Content-Encoding: gzip'); + $qrcode = gzencode($qrcode ,9); +} +echo $qrcode; + + diff --git a/vendor/chillerlan/php-qrcode/examples/text.php b/vendor/chillerlan/php-qrcode/examples/text.php new file mode 100644 index 000000000..9bdf154f0 --- /dev/null +++ b/vendor/chillerlan/php-qrcode/examples/text.php @@ -0,0 +1,68 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 5, + 'outputType' => QRCode::OUTPUT_STRING_TEXT, + 'eccLevel' => QRCode::ECC_L, +]); + +//
 to view it in a browser
+echo '
'.(new QRCode($options))->render($data).'
'; + + +// custom values +$options = new QROptions([ + 'version' => 5, + 'outputType' => QRCode::OUTPUT_STRING_TEXT, + 'eccLevel' => QRCode::ECC_L, + 'moduleValues' => [ + // finder + 1536 => 'A', // dark (true) + 6 => 'a', // light (false) + // alignment + 2560 => 'B', + 10 => 'b', + // timing + 3072 => 'C', + 12 => 'c', + // format + 3584 => 'D', + 14 => 'd', + // version + 4096 => 'E', + 16 => 'e', + // data + 1024 => 'F', + 4 => 'f', + // darkmodule + 512 => 'G', + // separator + 8 => 'h', + // quietzone + 18 => 'i', + ], +]); + +//
 to view it in a browser
+echo '
'.(new QRCode($options))->render($data).'
'; + + + + + diff --git a/vendor/chillerlan/php-qrcode/phpdoc.xml b/vendor/chillerlan/php-qrcode/phpdoc.xml new file mode 100644 index 000000000..d191e98ee --- /dev/null +++ b/vendor/chillerlan/php-qrcode/phpdoc.xml @@ -0,0 +1,15 @@ + + + + public/docs + + + public/docs + + + src + + +